using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Basics.DockPanel; using Dongke.IBOSS.PRD.Client.CommonModule; 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.Text; using System.Windows.Forms; namespace Dongke.IBOSS.PRD.Client.SystemModule { public partial class F_MST_1501 : DockPanelBase { #region 成员变量 private static F_MST_1501 _instance; #endregion #region 构造函数 public F_MST_1501() { InitializeComponent(); this.Text = "版面信息"; this.tsbtnAdd.Text = ButtonText.TSBTN_ADD; this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; } #endregion #region 单列模式 public static F_MST_1501 Instance { get { if (_instance == null) { _instance = new F_MST_1501(); } return _instance; } } #endregion #region 事件 /// /// 页面加载事件 /// /// /// private void F_MST_1401_Load(object sender, EventArgs e) { // 按钮权限控制 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); //设置表格不自动创建列 this.dgvLayout.AutoGenerateColumns = false; } /// /// 查询事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { this.DataSource = this.GetSearchData(); if (this.DataSource != null) { if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0) { this.dgvLayout.DataSource = this.DataSource.Tables[0]; } else { // 清空明细中的数据 this.dgvLayout.DataSource = null; // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { // 清空明细中的数据 this.dgvLayout.DataSource = null; // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } /// /// 自适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvLayout.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 退出 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 编辑 /// /// /// private void tsbtnEdit_Click(object sender, EventArgs e) { try { if (this.dgvLayout.SelectedRows.Count != 0) { string Layoutid = this.dgvLayout.SelectedRows[0].Cells["LAYOUTID"].Value.ToString(); F_MST_1502 frmFPC1302 = new F_MST_1502(Constant.FormMode.Edit, Layoutid); DialogResult dialogresult = frmFPC1302.ShowDialog(); btnSearch_Click(sender, null); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 新建 /// /// /// private void tsbtnAdd_Click(object sender, EventArgs e) { try { F_MST_1502 frmMST1502 = new F_MST_1502(Constant.FormMode.Add, ""); DialogResult dialogResult = frmMST1502.ShowDialog(); // 重新加载GridView btnSearch_Click(sender, null); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空按钮 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtCustomerCode.Clear(); this.txtLayoutCode.Clear(); this.txtLayoutName.Clear(); this.txtGoodsCode.Clear(); this.cbflagtrue.Checked = true; this.cbflagfalse.Checked = true; } /// /// 窗体关闭事件 /// /// /// private void F_MST_1501_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 /// /// 根据界面查询条件获取数据集 /// private DataSet GetSearchData() { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1501"; cre.Name = "GetLayout"; cre.Properties["Layoutid"] = ""; cre.Properties["CustomerCode"] = txtCustomerCode.Text; cre.Properties["LayoutCode"] = txtLayoutCode.Text; cre.Properties["LayoutName"] = txtLayoutName.Text; cre.Properties["GOODSCODE"] = txtGoodsCode.Text; if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true) { cre.Properties["ValueFlag"] = ""; } else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false) { cre.Properties["ValueFlag"] = 1; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true) { cre.Properties["ValueFlag"] = 0; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false) { cre.Properties["ValueFlag"] = 2; } ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { return sre.Data; } return null; } catch (Exception ex) { throw ex; } } #endregion } }