| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PAM_0201.cs
- * 2.功能描述:工价分类
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/08/18 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
- namespace Dongke.IBOSS.PRD.Client.PAMModule
- {
- /// <summary>
- /// 工价分类
- /// </summary>
- public partial class F_PAM_0201 : DockPanelBase
- {
- #region 成员变量
- //单例模式
- private static F_PAM_0201 _instance;
- // 最后选择行
- private int _selecedRow;
- #endregion
- #region 构造函数
- public F_PAM_0201()
- {
- InitializeComponent();
- this.Text = FormTitles.F_PAM_0201;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
- // this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PAM_0201 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PAM_0201();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- private void F_PAM_0201_Load(object sender, EventArgs e)
- {
- this.dgvJobsPayPlan.AutoGenerateColumns = false;
- }
- /// <summary>
- /// 查询事件
- /// </summary>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- // 记录当前选中行
- int selectRowIndex = this._selecedRow;
- // 异步处理
- this.btnSearch.Enabled = false;
- this.btnClearCondition.Enabled = false;
- DataSet dsProductionData = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetGoodsWagesType(this.txtWagesTypeName.Text.Trim(),this.txtGoodsCode.Text.Trim());
- }));
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- if (dsProductionData != null)
- {
- base.DataSource = dsProductionData;
- if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
- {
- this.dgvJobsPayPlan.DataSource = this.DataSource.Tables[0];
- if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- if (selectRowIndex >= Constant.INT_IS_ZERO)
- {
- if (selectRowIndex >= dsProductionData.Tables[0].Rows.Count)
- {
- this.dgvJobsPayPlan.Rows[this.dgvJobsPayPlan.Rows.Count - 1].Selected = true;
- this.dgvJobsPayPlan.CurrentCell = this.dgvJobsPayPlan.Rows[this.dgvJobsPayPlan.Rows.Count - 1].Cells["WagesTypeName"];
- }
- else
- {
- this.dgvJobsPayPlan.Rows[selectRowIndex].Selected = true;
- this.dgvJobsPayPlan.CurrentCell = this.dgvJobsPayPlan.Rows[selectRowIndex].Cells["WagesTypeName"];
- }
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 清空事件
- /// </summary>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtWagesTypeName.Text = string.Empty;
- this.txtGoodsCode.Text = string.Empty;
- }
- /// <summary>
- /// 关闭窗体事件
- /// </summary>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自适应事件
- /// </summary>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvJobsPayPlan.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); ;
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- private void F_PAM_0201_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 添加事件
- /// </summary>
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //以新建模式打开信息窗体
- F_PAM_0203 frmPAM0203 = new F_PAM_0203(Constant.FormMode.Add, Constant.INT_IS_ZERO);
- DialogResult dialogResult = frmPAM0203.ShowDialog();
- if (dialogResult == DialogResult.OK)
- {
- btnSearch_Click(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- ///编辑事件
- /// </summary>
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvJobsPayPlan.CurrentRow;
- if (currentRow != null)
- {
- //获取需要的信息ID
- int entityId = Convert.ToInt32(currentRow.Cells["PayPlanID"].Value);
- //以复制模式打开信息窗体
- F_PAM_0103 frmPAM0103 = new F_PAM_0103(Constant.FormMode.Edit, entityId);
- DialogResult dialogResult = frmPAM0103.ShowDialog();
- //操作成功后刷新数据源
- if (dialogResult == DialogResult.OK)
- {
- btnSearch_Click(sender, e);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- }
- }
|