using DataEntity.Rack;
|
using DataEntity.Share;
|
using DataRWDAL.Rack;
|
using HandyControl.Data;
|
using HxEnum;
|
using System;
|
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
using System.Windows;
|
using System.Windows.Input;
|
using XCommon;
|
using XCommon.Log;
|
using XCommon.Tip;
|
using XHandler.Class.DataEx;
|
using XImagingXhandler.XDAL;
|
using static XCommon.Event.EventBind;
|
|
namespace XHandler.View.Rack
|
{
|
/// <summary>
|
/// 设置页面
|
/// </summary>
|
public partial class RackLayerEdit : Window
|
{
|
#region 变量
|
private RacksetLayerModel m_racksetLayerModel = null;
|
#endregion
|
|
#region 构造函数
|
public RackLayerEdit(RacksetLayerModel racksetLayerModel)
|
{
|
InitializeComponent();
|
m_racksetLayerModel = racksetLayerModel;
|
this.Owner = (Window)Shared.Main;
|
}
|
#endregion
|
|
#region 初期表示
|
private void SytemSettings_Loaded(object sender, RoutedEventArgs e)
|
{
|
#region 是否有耗材
|
cBoxHasLabware.ItemsSource = ComUtility.GetDropDownList<IsHasLabwareEnum>();
|
cBoxHasLabware.SelectedValue = m_racksetLayerModel.is_has_labware.ToString();
|
#endregion
|
|
#region 耗材名称
|
ObservableCollection<Labware> labwareList = DataModule.getInstance().GetLabwares();
|
cBoxLabware.ItemsSource = labwareList;
|
cBoxLabware.SelectedValue = m_racksetLayerModel.labware_id.ToString();
|
#endregion
|
|
tBoxTitle.Text = string.Format("编辑暂存架{0}", m_racksetLayerModel.rack_name);
|
}
|
#endregion
|
|
#region 确定
|
/// <summary>
|
/// 确定
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void btnOk_Click(object sender, RoutedEventArgs e)
|
{
|
try
|
{
|
var racksetLayerModel = RacksetLayerDB.GetInfodById(m_racksetLayerModel.id);
|
|
racksetLayerModel.is_has_labware = Convert.ToInt32(cBoxHasLabware.SelectedValue);
|
racksetLayerModel.labware_id = cBoxLabware.SelectedValue.ToString();
|
racksetLayerModel.modify_name = Shared.User.username;
|
racksetLayerModel.modify_time = DateTime.Now;
|
RacksetLayerDB.Update(racksetLayerModel);
|
|
ShowTip.ShowNotice("保存成功", InfoType.Success);
|
this.Close();
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 是否有耗材 选择变更
|
/// <summary>
|
/// 是否有耗材 选择变更
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void cBoxHasLabware_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
{
|
try
|
{
|
// 无耗材时,耗材类型不可选择
|
cBoxLabware.IsEnabled = Convert.ToInt32(cBoxHasLabware.SelectedValue) == EnumManagement.GetEnumValue(IsHasLabwareEnum.Yes);
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region 关闭窗口
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
{
|
this.Close();
|
}
|
#endregion
|
|
#region 拖动窗体
|
/// <summary>
|
/// 拖动窗体
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
|
{
|
try
|
{
|
if (e.ChangedButton == MouseButton.Left)
|
{
|
this.DragMove();
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
|
#region ESC关闭画面
|
/// <summary>
|
/// ESC关闭画面
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
{
|
try
|
{
|
if (e.Key == Key.Escape)
|
{
|
this.Close();
|
}
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.ErrorLog("ERROR:", ex);
|
}
|
}
|
#endregion
|
}
|
}
|