| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- public partial class F_PC_0802 : DKDockPanelBase
- {
- #region 成员变量
- // 单例模式
- private static F_PC_0802 _instance;
- // 正在查询
- private bool _isSearching = false;
- // 选中的名称
- private string _dictionaryvalue;
- #endregion
- #region 构造函数
- public F_PC_0802()
- {
- InitializeComponent();
- }
- public F_PC_0802( string dictionaryvalue)
- {
- InitializeComponent();
- this.Text = "编辑线边仓组件配置";
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- this._dictionaryvalue = dictionaryvalue;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PC_0802 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PC_0802();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 页面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_0802_Load(object sender, EventArgs e)
- {
- // 按钮权限控制
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- if(!string.IsNullOrEmpty(_dictionaryvalue))
- {
- // 调用服务器端获取数据集
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PC_0801";
- cre.Name = "GetIDNRKTYPE";
- cre.Properties["LGORT"] = _dictionaryvalue;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if(sre.Data.Tables[0]!=null && sre.Data.Tables[0].Rows.Count>0)
- {
- string filter = " check1 = 1";
- sre.Data.Tables[0].DefaultView.RowFilter= filter;
- DataTable CheckedDt = sre.Data.Tables[0].DefaultView.ToTable();
- this.dgvChecked.DataSource = CheckedDt;
- }
- }
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnSearch_Click(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(_dictionaryvalue))
- {
- // 调用服务器端获取数据集
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PC_0801";
- cre.Name = "GetIDNRKTYPE";
- cre.Properties["LGORT"] = _dictionaryvalue;
- cre.Properties["ModuleName"] = this.txtDICTIONARYTYPE.Text.Trim();
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
- {
- string filter = " check1 = 0";
- sre.Data.Tables[0].DefaultView.RowFilter = filter;
- DataTable CheckedDt = sre.Data.Tables[0].DefaultView.ToTable();
- this.dgvCheck.DataSource = CheckedDt;
- }
- }
- }
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- DataTable checkDt = (DataTable)this.dgvCheck.DataSource;
- DataTable checkedDt = (DataTable)this.dgvChecked.DataSource;
- DataTable paramDt = new DataTable();
- paramDt.Columns.Add("IDNRKTYPE", typeof(string));
- if (checkDt != null && checkDt.Rows.Count > 0)
- {
- foreach (DataRow item in checkDt.Rows)
- {
- if ("1".Equals(item["check1"].ToString()))
- {
- DataRow dr = paramDt.NewRow();
- dr["IDNRKTYPE"] = item["ModuleName"].ToString();
- paramDt.Rows.Add(dr);
- }
- }
- }
- if (checkedDt != null && checkedDt.Rows.Count > 0)
- {
- foreach (DataRow item in checkedDt.Rows)
- {
- if ("1".Equals(item["check1"].ToString()))
- {
- DataRow dr = paramDt.NewRow();
- dr["IDNRKTYPE"] = item["ModuleName"].ToString();
- paramDt.Rows.Add(dr);
- }
- }
- }
- // 调用服务器端获取数据集
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PC_0802";
- cre.Name = "SaveLgortIdnrktype";
- cre.Properties["LGORT"] = this._dictionaryvalue;
- paramDt.TableName = "SaveTable";
- DataSet ds = new DataSet();
- ds.Tables.Add(paramDt.Copy());
- cre.Data = ds;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "线边仓组件配置", "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
-
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtDICTIONARYTYPE.Clear();
- }
- /// <summary>
- /// 自适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void toolStripButton3_Click(object sender, EventArgs e)
- {
- this.dgvCheck.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvChecked.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 释放窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_0802_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- }
- }
|