public void GetOperatingData(DoWorkEventArgs e) { using (var Client = new SRPiPeline.PipelineServiceClient()) { int iPageSize = (int)page.PageSize; int iCurrPage = (int)page.CurrentPage; Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>()); dtFilter.Item1.Append("1 = 1"); if (string.IsNullOrEmpty(te_CheckStartTime.Text) == false && string.IsNullOrEmpty(te_CheckEndTime.Text) == false) { var mindate = Convert.ToDateTime(te_CheckStartTime.Text).Date; var maxdate = Convert.ToDateTime(te_CheckEndTime.Text).Date.AddHours(23.99); FilterProcess.MergeFilterCondition("OperatingTime", mindate, ref dtFilter, objValues1: maxdate, dataType: FilterProcess.DataType.DateTime); //FilterProcess.MergeFilterCondition("OperatingTime", Convert.ToDateTime(te_CheckEndTime.Text).Date.AddHours(23.99), ref dtFilter, "<="); } var ret = Client.GetOperatingRecord(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iCurrPage, iPageSize); if (ret.IsSuccess) { page.CurrentPage = iCurrPage; page.RowCount = ret.TotalNum; e.Result = ret.Data; } else { backgroundWorker.ReportProgress(101, ret.Message); } } }
private void GetPipelineOpereate(string PipelineCode) { try { using (var client = new SRPiPeline.PipelineServiceClient()) { var ret = client.GetDaviceInformation(context.SessionID, "06", PipelineCode); if (ret.IsSuccess) { Model = new SRPiPeline.MainPipelineInfo(); Model.Operator = context.UserName; Model.Creator = context.UserName; //mainPipelineInfoBindingSource.DataSource = Model; Model.DeveCode = ret.Data.DevCode; Model.DeveName = ret.Data.DevName; mainPipelineInfoBindingSource.DataSource = Model; int iCurrPage = 0; int iPageSize = 0; Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>()); dtFilter.Item1.Append("1 = 1"); FilterProcess.MergeFilterCondition("DeveCode", ret.Data.DevCode, ref dtFilter); var mp_ret = client.GetOperatingRecord(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iCurrPage, iPageSize); if (mp_ret.IsSuccess && mp_ret.Data.Count() > 0) { // PipelineStatusTextEdit.Properties.ReadOnly = true; Model.PipelineStatus = mp_ret.Data.First(t => t.OperatingTime < DateTime.Now).PipelineStatus; //if (PipelineStatusTextEdit.Text == "管道打开") //{ // Model.PromptDes = "管道关闭"; //} //else if (PipelineStatusTextEdit.Text == "管道关闭") //{ // Model.PromptDes = "管道打开"; //} mainPipelineInfoBindingSource.DataSource = Model; } } else { ClsMsg.ShowInfoMsg(ret.Message); } } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowErrMsg(ex.Message); } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { backgroundWorker.ReportProgress(0); try { switch (e.Argument.ToString()) { case "AddOperatingData": using (var Client = new SRPiPeline.PipelineServiceClient()) { mainPipelineInfoBindingSource.EndEdit(); Model = mainPipelineInfoBindingSource.DataSource as SRPiPeline.MainPipelineInfo; Model.OperatingTime = Convert.ToDateTime(OperatingTimeTextEdit.Text); // Model.OperatorReamrk = PipelineStatusTextEdit.Text; Model.PipelineStatus = PromptDesTextEdit.Text; Model.CreateDate = Convert.ToDateTime(CreateDateDateEdit.Text); var ret = Client.AddOperatingData(context.SessionID, Model); if (ret.IsSuccess) { ClsMsg.ShowInfoMsg("操作数据保存成功!"); } } break; default: break; } } catch (System.ServiceModel.FaultException <CustomFaultMessage> fex) { backgroundWorker.ReportProgress(102, fex.Message); Utils.Logger.Error(fex.ToString()); } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } backgroundWorker.ReportProgress(100); }