Пример #1
0
        private void BgwWait_DoWork(object sender, DoWorkEventArgs e)
        {
            //BgwWait.ReportProgress(0);



            try
            {
                switch (e.Argument.ToString())
                {
                case "SaveData":
                    using (SRDevice.DeviceServiceClient client = new SRDevice.DeviceServiceClient())
                    {
                        var ret = client.AddDevParameter(context.SessionID, model);

                        if (ret.IsSuccess)
                        {
                            SearchData(e);
                            BgwWait.ReportProgress(99, "保存成功!");
                        }
                        break;
                    }

                case "DelData":

                    using (SRDevice.DeviceServiceClient client = new SRDevice.DeviceServiceClient())
                    {
                        var ret = client.DelDevParameterByCode(context.SessionID, DevpCodeTextEdit.Text);
                        if (ret.IsSuccess)
                        {
                            SearchData(e);
                            BgwWait.ReportProgress(99, "删除成功!");
                        }

                        break;
                    }

                case "SearchData":

                    //earchData(e);strDevCode

                    int iTotalNum = 1;
                    int iCurrPage = (int)page.CurrentPage;
                    int iPageSize = (int)page.PageSize;
                    //    int iPageSize = 2;


                    using (var client = new SRDevice.DeviceServiceClient())
                    {
                        var ret = client.GetDevParByCodePaging(context.SessionID, iPageSize, iCurrPage, ref iTotalNum, strDevCode);

                        if (ret.IsSuccess)
                        {
                            page.CurrentPage = iCurrPage;
                            page.RowCount    = iTotalNum;
                            e.Result         = ret.Data;
                        }
                        else
                        {
                            BgwWait.ReportProgress(101, ret.Message);
                        }
                    }
                    break;

                case "UpdData":


                    using (SRDevice.DeviceServiceClient client = new SRDevice.DeviceServiceClient())
                    {
                        var ret = client.UpdatDevParameter(context.SessionID, model);

                        if (ret.IsSuccess)
                        {
                            SearchData(e);
                            BgwWait.ReportProgress(99, "修改成功!");
                        }

                        break;
                    }

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                BgwWait.ReportProgress(101, ex.Message);
            }
        }
Пример #2
0
        private void BgwWait_DoWork(object sender, DoWorkEventArgs e)
        {
            BgwWait.ReportProgress(PubConstant.WaitMessageStatus.START);
            try
            {
                switch (e.Argument.ToString())
                {
                case "SearchData":
                    using (SRCfPExecute.CfPExecuteServiceClient client = new SRCfPExecute.CfPExecuteServiceClient())
                    {
                        var ret = client.GetAllIPRegistForm(context.SessionID);
                        e.Result = ret.Data;
                    }

                    break;

                case "SaveData":
                    using (SRCfPExecute.CfPExecuteServiceClient client = new SRCfPExecute.CfPExecuteServiceClient())
                    {
                        var ret = client.InsterRegistForm(context.SessionID, model);

                        if (ret.IsSuccess)
                        {
                            e.Result = client.GetAllIPRegistForm(context.SessionID).Data;

                            BgwWait.ReportProgress(99, "保存成功!");
                        }

                        break;
                    }

                case "DelData":

                    using (SRCfPExecute.CfPExecuteServiceClient client = new SRCfPExecute.CfPExecuteServiceClient())
                    {
                        var ret = client.DeleteRegistFormById(context.SessionID, model);
                        if (ret.IsSuccess)
                        {
                            e.Result = client.GetAllIPRegistForm(context.SessionID).Data;
                            BgwWait.ReportProgress(99, "删除成功!");
                        }

                        break;
                    }

                case "UpdData":


                    using (SRCfPExecute.CfPExecuteServiceClient client = new SRCfPExecute.CfPExecuteServiceClient())
                    {
                        var ret = client.UpdateRegistForm(context.SessionID, model);
                        if (ret.IsSuccess)
                        {
                            e.Result = client.GetAllIPRegistForm(context.SessionID).Data;
                            BgwWait.ReportProgress(99, "修改成功!");
                        }

                        break;
                    }

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                BgwWait.ReportProgress(101, ex.Message);
            }

            BgwWait.ReportProgress(PubConstant.WaitMessageStatus.END);
        }