| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_Goods.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_Goods : SearchBoxForm
- {
- #region 构造函数
- /// <summary>
- /// 查询窗体
- /// </summary>
- public F_Goods()
- {
- InitializeComponent();
- }
- #endregion
- #region 公有方法
- /// <summary>
- /// 设置查询条件
- /// </summary>
- //public override void SetConditions(params object[] values)
- //{
- // if (values.Length > 1)
- // {
- // //this.txtGoodsName.Text = values[0].ToString();
- // }
- //}
- /// <summary>
- /// 清除查询条件
- /// </summary>
- public override void ClearConditions()
- {
- this.txtGoodsCode.Clear();
- this.txtGoodsName.Clear();
- }
- #endregion
- #region 保护方法
- /// <summary>
- /// 初始化Form
- /// </summary>
- protected override void InitForm()
- {
- DataGridViewTextBoxColumn GoodsID = new DataGridViewTextBoxColumn();
- GoodsID.Name = "GoodsID";
- GoodsID.HeaderText = "产品ID";
- GoodsID.ReadOnly = true;
- GoodsID.Visible = false;
- GoodsID.SortMode = DataGridViewColumnSortMode.Automatic;
- GoodsID.DataPropertyName = "GoodsID";
- GoodsID.DefaultCellStyle = new DataGridViewCellStyle();
- DataGridViewTextBoxColumn GoodsCode = new DataGridViewTextBoxColumn();
- GoodsCode.Name = "GoodsCode";
- GoodsCode.HeaderText = "产品编码";
- GoodsCode.ReadOnly = true;
- GoodsCode.SortMode = DataGridViewColumnSortMode.Automatic;
- GoodsCode.DataPropertyName = "GoodsCode";
- DataGridViewTextBoxColumn GoodsName = new DataGridViewTextBoxColumn();
- GoodsName.Name = "GoodsName";
- GoodsName.HeaderText = "产品名称";
- GoodsName.ReadOnly = true;
- GoodsName.SortMode = DataGridViewColumnSortMode.Automatic;
- GoodsName.DataPropertyName = "GoodsName";
- this.dgvSelected.Columns.AddRange(GoodsID, GoodsCode, GoodsName);
- 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_Goods";
- cre.Name = "GetGoods";
- cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
- cre.Properties["GoodsName"] = this.txtGoodsName.Text.Trim();
- // 调用服务器端获取数据集(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);
- //}
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults ||
- sre.Data == null || sre.Data.Tables.Count == 0 || sre.Data.Tables[0].Rows.Count == 0)
- {
- // 提示未查找到数据
- 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
- }
- }
|