| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662 |
- /*******************************************************************************
- * Copyright(c) 2018 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2702.cs
- * 2.功能描述:新建/编辑成型报损信息窗体
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 周兴 2018/03/27 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.Library;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 新建编辑成型报损信息窗体
- /// </summary>
- public partial class F_PM_2702 : FormBase
- {
- #region 成员变量
- //窗体模式ID
- private Constant.FormMode _formType;
- //修改产品报损信息ID
- private string _barCode;
- //报损信息ID
- private int _editSPId;
- //是否允许审批
- private bool _isScrap = false;
- //报损原因
- private DataTable _scrapReasonTable = null;
- //产品条码信息
- private DataRow _barCodeRow = null;
- // 编辑时不根据工号加载员工信息
- private bool _isLoadStaff = true;
- #endregion
- #region 构造函数
- /// <summary>
- /// 窗体构造
- /// </summary>
- public F_PM_2702(Constant.FormMode formType, string BarCode, int EditSPId, bool isScrap)
- {
- InitializeComponent();
- this._formType = formType;
- this._barCode = BarCode;
- this._editSPId = EditSPId;
- this._isScrap = isScrap;
- if (formType == Constant.FormMode.Add)
- {
- this.Text = FormTitles.F_PM_2702_ADD;
- }
- else
- {
- this.Text = FormTitles.F_PM_2702_EDIT;
- }
- this.btnViewApprover.Text = ButtonText.BTN_VIEWAPPROVER;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2702_Load(object sender, EventArgs e)
- {
- try
- {
- // 损坯原因
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "MST_ScrapReason";
- cre.Name = "GetScrapReasonData";
- ServiceResultEntity result = new ServiceResultEntity();
- result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() => { return SystemModuleProxy.Service.DoBarCodePrint(cre); }));
- // 没有数据时,直接返回
- if (result == null || result.Data == null || result.Data.Tables.Count <= 0)
- {
- return;
- }
- _scrapReasonTable = result.Data.Tables[0];
- //_scrapReasonTable.DefaultView.RowFilter = "valueflag='1'";
- this.cboRreason.DisplayMember = "ScrapReason";
- this.cboRreason.ValueMember = "ScrapReasonID";
- this.chkScrapTypeOne.Checked = false;
- //绑定损坯状态
- DataTable dtAuditStatus = new DataTable();
- dtAuditStatus.Columns.Add("AuditStatusID");
- dtAuditStatus.Columns.Add("AuditStatusValue");
- // 目前只需要审核通过
- DataRow dr = dtAuditStatus.NewRow();
- dr["AuditStatusID"] = 1;
- dr["AuditStatusValue"] = "审核通过";
- dtAuditStatus.Rows.Add(dr);
- //dr["AuditStatusID"] = 0;
- //dr["AuditStatusValue"] = "待审核";
- //dtAuditStatus.Rows.Add(dr);
- //if (this._isScrap)
- //{
- // dr = dtAuditStatus.NewRow();
- // dr["AuditStatusID"] = 1;
- // dr["AuditStatusValue"] = "损坯通过";
- // dtAuditStatus.Rows.Add(dr);
- // dr = dtAuditStatus.NewRow();
- // dr["AuditStatusID"] = 2;
- // dr["AuditStatusValue"] = "损坯驳回";
- // dtAuditStatus.Rows.Add(dr);
- //}
- this.cboAuditStatus.DisplayMember = "AuditStatusValue";
- this.cboAuditStatus.ValueMember = "AuditStatusID";
- this.cboAuditStatus.DataSource = dtAuditStatus;
- if (this._formType == Constant.FormMode.Edit)
- {
- BindEntity();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 条码输入完毕后
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtBarCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- try
- {
- string BarCode = this.txtBarCode.Text.Trim();
- if (!string.IsNullOrWhiteSpace(BarCode))
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "GroutingScrapProduct";
- cre.Name = "GetGroutingDailyDetail";
- cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
- ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- }));
- if (result == null || result.Data == null || result.Data.Tables.Count == 0
- || result.Data.Tables[0].Rows.Count == 0)
- {
- MessageBox.Show("未查询到该产品信息,请确认该产品是否已经进行注浆!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- //this.txtBarCode.Text = "";
- this.txtBarCode.Focus();
- return;
- }
- _barCodeRow = result.Data.Tables[0].Rows[0];
- // 判断是否进行了注浆
- if ("0".Equals(_barCodeRow["GroutingFlag"]))
- {
- MessageBox.Show("该产品还未进行注浆!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- //this.txtBarCode.Text = "";
- this.txtBarCode.Focus();
- return;
- }
- // 判断是否进行了交坯
- if ("1".Equals(_barCodeRow["DeliverFlag"]))
- {
- MessageBox.Show("该产品已经交坯!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- //this.txtBarCode.Text = "";
- this.txtBarCode.Focus();
- return;
- }
- // 判断是否已经报损
- if ("1".Equals(_barCodeRow["ScrapFlag"]))
- {
- MessageBox.Show("该产品已经报损!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- //this.txtBarCode.Text = "";
- this.txtBarCode.Focus();
- return;
- }
- this.txtGoodsCode.Text = _barCodeRow["GoodsCode"] + "";
- this.txtGroutingLine.Text = _barCodeRow["GroutingLineCode"] + "";
- this.txtMouldCode.Text = _barCodeRow["GroutingMouldCode"] + "";
- this.txtGroutingUser.Text = _barCodeRow["GroutingUserCode"] + "";
- }
- else
- {
- // 如果产品条码是空,那么就清空相关信息
- this.txtGoodsCode.Clear();
- this.txtGroutingLine.Clear();
- this.txtMouldCode.Clear();
- this.txtGroutingUser.Clear();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 切换报损类型,联动更换报损原因
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkScrapTypeOne_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- string scrapType = this.chkScrapTypeOne.Checked ? "0" : "1";
- if (_scrapReasonTable != null && _scrapReasonTable.Rows.Count > 0)
- {
- _scrapReasonTable.DefaultView.RowFilter = "ScrapType = '" + scrapType + "' and valueflag='1'";
- DataTable returnTable = _scrapReasonTable.DefaultView.ToTable();
- _scrapReasonTable.DefaultView.RowFilter = string.Empty;
- this.cboRreason.DataSource = returnTable;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 提交操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- this.btnSave.Focus();
- // 校验数据
- if (!IsValidData())
- {
- return;
- }
- // 给实体赋值
- ClientRequestEntity cre = SetEntity();
- ServiceResultEntity result = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- }));
- int resultRow = (int)result.Result;
- if (resultRow > Constant.INT_IS_ZERO)
- {
- //成功
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型报损", "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- }
- else if (resultRow == -99)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_006, "未查询到该产品信息,请确认该产品是否已经进行注浆"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (resultRow == -100)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品还未进行注浆"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (resultRow == -101)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品已经交坯"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (resultRow == -102)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_006, "该产品已经报损"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- //失败
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型报损", "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 察看审批意见
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnViewApprover_Click(object sender, EventArgs e)
- {
- try
- {
- string barCode = this.txtBarCode.Text;
- F_PM_1103 frmFPM1103 = new F_PM_1103(barCode, 1, _editSPId);
- DialogResult dialogresult = frmFPM1103.ShowDialog();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 选择工号改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- //private void dkUser_UserValueChanged(object sender, Controls.SearchTextBox.dkUserInfoSearchBox.TextChangeEventArgs e)
- //{
- // try
- // {
- // if (this.sbxUser.UserID != null && _isLoadStaff)
- // {
- // if (this.sbxUser.Text != "")
- // {
- // this.dgvResponsible.AutoGenerateColumns = false;
- // DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- // {
- // return HRModuleProxy.Service.SearchHrStaffInfo(Convert.ToInt32(this.sbxUser.UserID));
- // }));
- // if (dsUser != null && dsUser.Tables.Count > 0)
- // {
- // DataTable returnTable = dsUser.Tables[0];
- // if (!returnTable.Columns.Contains("UserSelected"))
- // {
- // returnTable.Columns.Add("UserSelected", typeof(int));
- // }
- // foreach (DataRow row in returnTable.Rows)
- // {
- // row["UserSelected"] = 1;
- // }
- // this.dgvResponsible.DataSource = returnTable;
- // }
- // }
- // else
- // {
- // this.dgvResponsible.DataSource = null;
- // this.sbxUser.ClearControl();
- // }
- // }
- // else
- // {
- // this.dgvResponsible.DataSource = null;
- // }
- // }
- // catch (Exception ex)
- // {
- // // 对异常进行共通处理
- // ExceptionManager.HandleEventException(this.ToString(),
- // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- // }
- //}
- /// <summary>
- /// 窗体关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 加载数据
- /// </summary>
- private void BindEntity()
- {
- try
- {
- //条码控件不可用
- this.txtBarCode.Enabled = false;
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "GroutingScrapProduct";
- cre.Name = "GetGroutingScrapProduct";
- cre.Properties["ScrapProductID"] = this._editSPId;
- cre.Properties["IsSearchStaff"] = true;
- ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
- // 给控件赋值
- if (result != null && result.Data != null && result.Data.Tables.Count > 0
- && result.Data.Tables[0].Rows.Count > 0)
- {
- _isLoadStaff = false;
- DataRow row = result.Data.Tables[0].Rows[0];
- this.txtBarCode.Text = row["BarCode"] + "";
- this.txtGoodsCode.Text = row["GoodsCode"] + "";
- this.txtGroutingLine.Text = row["GroutingLineCode"] + "";
- this.txtMouldCode.Text = row["GroutingMouldCode"] + "";
- this.txtGroutingUser.Text = row["GroutingUserCode"] + "";
- this.dtpScrapDate.Value = Convert.ToDateTime(row["ScrapDate"]);
- //this.sbxUser.Text = row["ResponUserCode"] + "";
- //this.sbxUser.UserName = row["ResponUserName"] + "";
- //this.sbxUser.UserID = Convert.ToInt32(row["ResponUserID"]);
- //this.sbxUser.UserCode = row["ResponUserCode"] + "";
- scbUser.SearchedPKMember = Convert.ToInt32(row["ResponUserID"]);
- scbUser.InitValue(row["ResponUserName"] + "", row["ResponUserCode"] + "");
- this.cboAuditStatus.SelectedValue = Convert.ToInt32(row["AuditStatus"]);
- // 报损类型
- if ("0".Equals(row["ScrapType"]))
- {
- this.chkScrapTypeOne.Checked = true;
- }
- this.cboRreason.SelectedValue = Convert.ToInt32(row["ScrapRreasonID"]);
- if (result.Data.Tables.Count > 1 && result.Data.Tables[1].Rows.Count > 0)
- {
- this.dgvResponsible.DataSource = result.Data.Tables[1];
- }
- _isLoadStaff = true;
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 保存前校验数据
- /// </summary>
- /// <returns></returns>
- private bool IsValidData()
- {
- try
- {
- // 产品条码
- if (string.IsNullOrWhiteSpace(this.txtBarCode.Text))
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_003, "产品条码"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.txtBarCode.Focus();
- return false;
- }
- // 责任工号
- if (scbUser.SearchedPKMember == 0)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任工号"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.scbUser.Focus();
- return false;
- }
- // 损坯原因
- if (string.IsNullOrWhiteSpace(this.cboRreason.SelectedValue + ""))
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_003, "损坯原因"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.cboRreason.Focus();
- return false;
- }
- // 责任员工 如果责任员工不输入给出提示
- DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
- if (returnTable == null || returnTable.Rows.Count == 0)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.dgvResponsible.Focus();
- return false;
- }
- else
- {
- DataRow[] dataRows = returnTable.Select("UserSelected = 1");
- if (dataRows.Length == 0)
- {
- MessageBox.Show(string.Format(Messages.W_CMN_C_003, "责任员工"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.dgvResponsible.Focus();
- return false;
- }
- }
- return true;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 保存之前给实体赋值
- /// </summary>
- /// <returns></returns>
- private ClientRequestEntity SetEntity()
- {
- try
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "GroutingScrapProduct";
- cre.Name = "SaveGroutingScrapProduct";
- if (_formType == Constant.FormMode.Add)
- {
- // 产品条码
- cre.Properties["BarCode"] = _barCodeRow["BarCode"];
- // 产品ID
- cre.Properties["GoodsID"] = _barCodeRow["GoodsID"];
- // 产品编码
- cre.Properties["GoodsCode"] = _barCodeRow["GoodsCode"];
- // 产品名称
- cre.Properties["GoodsName"] = _barCodeRow["GoodsName"];
- // 注浆日报ID
- cre.Properties["GroutingDailyID"] = _barCodeRow["GroutingDailyID"];
- // 注浆日报明细ID
- cre.Properties["GroutingDailyDetailID"] = _barCodeRow["GroutingDailyDetailID"];
- // 注浆日期
- cre.Properties["GroutingDate"] = _barCodeRow["GroutingDate"];
- // 成型生产线ID
- cre.Properties["GroutingLineID"] = _barCodeRow["GroutingLineID"];
- // 成型生产线编码
- cre.Properties["GroutingLineCode"] = _barCodeRow["GroutingLineCode"];
- // 成型生产线名称
- cre.Properties["GroutingLineName"] = _barCodeRow["GroutingLineName"];
- // 成型线类型ID
- cre.Properties["GMouldTypeID"] = _barCodeRow["GMouldTypeID"];
- // 成型生产线明细ID
- cre.Properties["GroutingLineDetailID"] = _barCodeRow["GroutingLineDetailID"];
- // 注浆模具编号
- cre.Properties["GroutingMouldCode"] = _barCodeRow["GroutingMouldCode"];
- // 模具编号
- cre.Properties["MouldCode"] = _barCodeRow["MouldCode"];
- // 注浆工号ID
- cre.Properties["GroutingUserID"] = _barCodeRow["GroutingUserID"];
- // 注浆工号编码
- cre.Properties["GroutingUserCode"] = _barCodeRow["GroutingUserCode"];
- // 注浆次数
- cre.Properties["GroutingNum"] = _barCodeRow["GroutingNum"];
- }
- else
- {
- // 报损ID
- cre.Properties["ScrapProductID"] = _editSPId;
- // 产品条码
- cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
- }
- // 报损类型
- cre.Properties["ScrapType"] = this.chkScrapTypeOne.Checked ? "0" : "1";
- // 损坯日期
- cre.Properties["ScrapDate"] = this.dtpScrapDate.Value.ToString("yyyy-MM-dd");
- // 报损原因
- cre.Properties["ScrapRreasonID"] = this.cboRreason.SelectedValue;
- // 责任工号ID
- cre.Properties["ResponUserID"] = scbUser.SearchedPKMember;
- // 责任工号编码
- cre.Properties["ResponUserCode"] = scbUser.SearchedValue;
- // 备注
- cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
- // 审核状态
- cre.Properties["AuditStatus"] = this.cboAuditStatus.SelectedValue;
- // 责任员工
- DataTable returnTable = this.dgvResponsible.DataSource as DataTable;
- returnTable.AcceptChanges();
- returnTable = returnTable.Copy();
- returnTable.DefaultView.RowFilter = "UserSelected = 1";
- returnTable = returnTable.DefaultView.ToTable();
- cre.Data = new DataSet();
- cre.Data.Tables.Add(returnTable);
- return cre;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- /// <summary>
- /// 选择工号改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void scbUser_TextValueChanged(object sender, WinForm.Controls.ScbSearchBox.TextChangeEventArgs e)
- {
- try
- {
- if (scbUser.SearchedPKMember != 0 && _isLoadStaff)
- {
- if (this.scbUser.Text != "")
- {
- this.dgvResponsible.AutoGenerateColumns = false;
- DataSet dsUser = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return HRModuleProxy.Service.SearchHrStaffInfo(scbUser.SearchedPKMember);
- }));
- if (dsUser != null && dsUser.Tables.Count > 0)
- {
- DataTable returnTable = dsUser.Tables[0];
- if (!returnTable.Columns.Contains("UserSelected"))
- {
- returnTable.Columns.Add("UserSelected", typeof(int));
- }
- foreach (DataRow row in returnTable.Rows)
- {
- row["UserSelected"] = 1;
- }
- this.dgvResponsible.DataSource = returnTable;
- }
- }
- else
- {
- this.dgvResponsible.DataSource = null;
- this.scbUser.ClearValue();
- }
- }
- else
- {
- this.dgvResponsible.DataSource = null;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|