Пример #1
0
        private void BgWait1_DoWork(object sender, DoWorkEventArgs e)
        {
            BgWait1.ReportProgress(0);
            try
            {
                switch (e.Argument.ToString())
                {
                case "SearchData":

                    Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>());
                    dtFilter.Item1.Append("1=1");

                    FilterProcess.MergeFilterCondition("ArrangedVouchCode", textEdit1.EditValue, ref dtFilter);
                    FilterProcess.MergeFilterCondition("MaterialVouchCode", textEdit2.EditValue, ref dtFilter);
                    FilterProcess.MergeFilterCondition("FormulaCode", textEdit3.EditValue, ref dtFilter);
                    FilterProcess.MergeFilterCondition("FormulaName", textEdit4.EditValue, ref dtFilter);
                    FilterProcess.MergeFilterCondition("UserStatus", Convert.ToInt32(UseStatusLookUpEdit.EditValue), ref dtFilter, dataType: FilterProcess.DataType.Int);

                    FilterProcess.MergeFilterCondition("VouchDate", dStartDate.EditValue, ref dtFilter, objValues1: dEndDate.EditValue, dataType: FilterProcess.DataType.DateTime);    //按日期区间查询

                    int iCurrPage = (int)page.CurrentPage;
                    int iPageSize = (int)page.PageSize;

                    //using (var client = new SRArrangedVouch.ArrangedVServiceClient())
                    //{


                    var ret = WCFHelper.InvokeService <SRArrangedVouch.IArrangedVServiceChannel, SRArrangedVouch.CommonResultOfArrayOfArrangedVouchdYMi5huk>(context, wcf => wcf.GetArrangedVouchList(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage));
                    //var ret = client.GetArrangedVouchList(context.SessionID, Tuple.Create<string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage);
                    if (ret.IsSuccess)
                    {
                        page.CurrentPage = iCurrPage;
                        page.RowCount    = ret.TotalNum;
                        e.Result         = ret.Data;
                    }
                    else
                    {
                        BgWait1.ReportProgress(101, ret.Message);
                    }
                    // }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                BgWait1.ReportProgress(102, ex.Message);
            }

            BgWait1.ReportProgress(100);
        }