| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_User.cs
- * 2.功能描述:工号Search查询页面
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 付斌 2018/07/23 1.00 新建
- *******************************************************************************/
- using System;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.Controls.SearchBox
- {
- /// <summary>
- /// 工号
- /// </summary>
- public partial class F_User : SearchBoxForm
- {
- #region 成员变量
- private bool _isWorker;
- // 额外条件 默认0 1为盘点的成型工号的值,以后可以额外增加其他的值
- private int _additionalConditionValue = 0;
- #endregion
- #region 构造函数
- /// <summary>
- /// 查询窗体
- /// </summary>
- public F_User()
- {
- InitializeComponent();
- }
- #endregion
- #region 公有方法
- /// <summary>
- /// 设置查询条件
- /// </summary>
- public override void SetConditions(params object[] values)
- {
- if (values.Length > 1)
- {
- //this.txtUserName.Text = values[0].ToString();
- _isWorker = Convert.ToBoolean(values[1] + "");
- }
- if (values.Length > 2)
- {
- _additionalConditionValue = Convert.ToInt32(values[2]+"");
- }
- }
- /// <summary>
- /// 清除查询条件
- /// </summary>
- public override void ClearConditions()
- {
- this.txtUserCode.Clear();
- this.txtUserName.Clear();
- }
- #endregion
- #region 保护方法
- /// <summary>
- /// 初始化Form
- /// </summary>
- protected override void InitForm()
- {
- DataGridViewTextBoxColumn UserID = new DataGridViewTextBoxColumn();
- UserID.Name = "UserID";
- UserID.HeaderText = "用户ID";
- UserID.ReadOnly = true;
- UserID.Visible = false;
- UserID.SortMode = DataGridViewColumnSortMode.Automatic;
- UserID.DataPropertyName = "UserID";
- UserID.DefaultCellStyle = new DataGridViewCellStyle();
- DataGridViewTextBoxColumn UserCode = new DataGridViewTextBoxColumn();
- UserCode.Name = "UserCode";
- UserCode.HeaderText = "用户编码";
- UserCode.ReadOnly = true;
- UserCode.SortMode = DataGridViewColumnSortMode.Automatic;
- UserCode.DataPropertyName = "UserCode";
- DataGridViewTextBoxColumn UserName = new DataGridViewTextBoxColumn();
- UserName.Name = "UserName";
- UserName.HeaderText = "用户名称";
- UserName.ReadOnly = true;
- UserName.SortMode = DataGridViewColumnSortMode.Automatic;
- UserName.DataPropertyName = "UserName";
- this.dgvSelected.Columns.AddRange(UserID, UserCode, UserName);
- base.InitForm();
- }
- /// <summary>
- /// 查询数据。
- /// </summary>
- /// <returns>验证通过true,其他false</returns>
- protected override bool QueryDataFromOther()
- {
- ServiceResultEntity sre = this.GetDataTable();
- if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
- {
- this.dgvSelected.DataSource = sre.Data.Tables[0];
- this.dgvSelected.Rows[0].Selected = true;
- return true;
- }
- else
- {
- return false;
- }
- }
- #endregion
- #region 私有方法
- private ServiceResultEntity GetDataTable()
- {
- try
- {
- // 异步处理,获取系统参数信息
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_User";
- cre.Name = "GetUser";
- cre.Properties["UserCode"] = this.txtUserCode.Text.Trim();
- cre.Properties["UserName"] = this.txtUserName.Text.Trim();
- cre.Properties["IsWorker"] = _isWorker ? "1" : "0";
- cre.Properties["AdditionalConditionValue"] = _additionalConditionValue;
- // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
- ServiceResultEntity sre = null;
- DoAsync(() => { return CommonModuleProxy.Service.DoRequest(cre); }, out sre);
- if (!(sre.Status == Constant.ServiceResultStatus.Success))
- {
- //StateMessageClass.GetErrorMessageByStatus(this, sre.Status);
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- return sre;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- #endregion
- }
- }
|