using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WMS.Frm.Base;
using WMS.Model.Strategy;
using WMS.Common;
using WMS.Model.Base;
using WMS.Model.SystemManage;
using WMS.Business;
using WMS.Business.Strategy;
using WMS.Business.SystemManage;
using WMS.Business.Base;
namespace WMS.FrmStrategy
{
public partial class FrmAutoTask : FormBase
{
///
/// 自动分配任务权限
///
public List list = new List();
///
/// 自动分配任务权限实体Model
///
AutoTaskModel model = new AutoTaskModel();
public FrmAutoTask()
{
InitializeComponent();
}
#region 绑定数据
///
/// 绑定数据
///
public void BindData()
{
model = new AutoTaskModel();
string str_list = "";
try
{
list = IBussFactory.Instance().GetAutoTask(model);
}
catch (Exception ex)
{
SystemCommon.ShowInfoMessageBox("网络连接出现错误!");
return;
}
bs_AutoTask.DataSource = list;
}
#endregion
#region 按钮事件
#region 新增
///
/// 新增
///
public void Add()
{
FrmAutoTaskDet det = new FrmAutoTaskDet(0, userData);
det.ShowDialog();
BindData();
}
#endregion
#region 编辑
///
/// 编辑
///
public void Edit()
{
if (gridView1.FocusedRowHandle < 0)
{
SystemCommon.ShowInfoMessageBox("请选择需要编辑的策略");
return;
}
FrmAutoTaskDet det = new FrmAutoTaskDet(1, userData);
model = gridView1.GetFocusedRow() as AutoTaskModel;
det.au_model = model;
det.ShowDialog();
BindData();
}
#endregion
#region 删除
///
/// 删除
///
public void Del()
{
model = gridView1.GetFocusedRow() as AutoTaskModel;
string errText = "";
try
{
errText =IBussFactory.Instance().DeleteAutoTask(model);
}
catch (Exception ex)
{
SystemCommon.ShowInfoMessageBox("网络连接错误!");
}
if (errText == "")
{
SystemCommon.ShowInfoMessageBox("删除成功!");
BindData();
return;
}
SystemCommon.ShowInfoMessageBox("删除失败!");
}
#endregion
#endregion
#region 窗体加载
///
/// 窗体加载
///
///
///
private void FrmAutoTask_Load(object sender, EventArgs e)
{
#region 工种类型
string errText = "";
List li_worl = IBussFactory.Instance().GetDictionaryTab("workkind_type");
if (li_worl != null)
{
lue_worktype.ValueMember = "VC_CHAR_VALUE";
lue_worktype.DisplayMember = "VC_DICTIONARY_NAME";
lue_worktype.DataSource = li_worl;
}
#endregion
#region 事务类型
WorkTypeModel model = new WorkTypeModel();
string str_work_list = "";
try
{
List tran_type = IBussFactory.Instance().GetList(model);
if (tran_type != null)
{
lue_tran_type.DataSource = tran_type;
}
}
catch (Exception ex)
{
SystemCommon.ShowInfoMessageBox("网络连接错误!");
return;
}
lue_tran_type.ValueMember = "WORK_ID";
lue_tran_type.DisplayMember = "WORK_NAME";
#endregion
BindData();
}
#endregion
#region 自定义列显示
///
/// 自定义列显示
///
///
///
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
if (e.Column.Name == "colIS_AUTO")
{
if (e.Value != null)
{
switch (e.Value.ToString())
{
case "0":
e.DisplayText = "否";
break;
case "1":
e.DisplayText = "是";
break;
default:
break;
}
}
}
if (e.Column.Name == "colIS_AUTOCREATE")
{
if (e.Value != null)
{
switch (e.Value.ToString())
{
case "0":
e.DisplayText = "否";
break;
case "1":
e.DisplayText = "是";
break;
default:
break;
}
}
}
}
#endregion
}
}