コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
            }
        }