private void FetchData()
        {
            if (!isFetchingData)
            {
                if (datas == null)
                {
                    datas = new List <WorkOrderInfo>();
                }
                else
                {
                    datas.Clear();
                }

                new Action(() =>
                {
                    isFetchingData = true;
                    if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0)
                    {
                        foreach (var nodeInfo in MerchantVar.CurrentMerchant.AuthNodeInfos)
                        {
                            //string url = nodeInfo.AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderToResponse";
                            string url = nodeInfo.AccessPoint + "/Oca/WorkOrderService/GetWorkOrderToResponse";
                            HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = nodeInfo.StationId }.ToStringObjectDictionary(), (ret, res) =>
                            {
                                if ((bool)ret.Success)
                                {
                                    foreach (var row in ret.rows)
                                    {
                                        dynamic item = new ExpandoObject();
                                        DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                                        WorkOrderInfo dataItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <WorkOrderInfo>();
                                        dataItem.DoStatusName  = WorkOrderInfo.getDoStatusName(int.Parse(item.StringObjectDictionary.DoStatus));
                                        dataItem.AccessPoint   = nodeInfo.AccessPoint;
                                        dataItem.StationId     = nodeInfo.StationId;

                                        datas.Add(dataItem);
                                    }
                                }
                            });
                        }
                    }
                }).BeginInvoke(new AsyncCallback((ar) =>
                {
                    //AsyncResult result = (AsyncResult)ar;
                    this.UIInvoke(() =>
                    {
                        xLoadingPanel.Stop();
                        xSource.DataSource = datas;
                        xSource.ResetBindings(false);
                    });

                    isFetchingData = false;
                }), null);
                xLoadingPanel.Start();
            }
        }
Пример #2
0
        private void FetchData()
        {
            if (!isFetchingData)
            {
                if (datas == null)
                {
                    datas = new List <WorkOrderInfo>();
                }
                else
                {
                    datas.Clear();
                }

                new Action(() =>
                {
                    isFetchingData = true;
                    if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0)
                    {
                        foreach (var nodeInfo in MerchantVar.CurrentMerchant.AuthNodeInfos)
                        {
                            //string url = nodeInfo.AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderFinished";
                            //string url = nodeInfo.AccessPoint + "/Oca/WorkOrderService/GetWorkOrderFinished";
                            string url = "http://localhost/SmartLife.CertManage.MerchantServices/Oca/WorkOrderService/GetWorkOrderFinished";
                            //string OldManName = txbOldManName.Text.Trim();
                            //string ServeManArriveTime = dateTimePickerArrivalTime.Text;
                            //string ServeManLeaveTime = dateTimePickerLeaveTime.Text;

                            //设置传递的参数
                            StringObjectDictionary postPram = new StringObjectDictionary();
                            if (txbOldManName.Text.Trim() != "")
                            {
                                postPram["OldManName"] = txbOldManName.Text.Trim();
                            }
                            else
                            {
                                postPram["OldManName"] = null;
                            }
                            //满意度
                            IEnumerable <RadioButton> rbsOfReturnVisit = pnlFeedbackToOldManName.Controls.OfType <RadioButton>().Where(x => x.Checked == true);
                            if (rbsOfReturnVisit != null)
                            {
                                foreach (var rb in rbsOfReturnVisit)
                                {
                                    if (rb.Name.Remove(0, 2).Remove(5) != "00000")
                                    {
                                        postPram["FeedbackToServiceStation"] = rb.Name.Remove(0, 2).Remove(5);
                                    }
                                    else
                                    {
                                        postPram["FeedbackToServiceStation"] = null;
                                    }
                                }
                            }
                            else
                            {
                                postPram["FeedbackToServiceStation"] = null;
                            }
                            //服务人员到达时间
                            postPram["ServeManArriveTime_Start"] = dateTimePickerArrivalTime.Text;

                            HttpAdapter.postSyncAsJSON(url, postPram, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = nodeInfo.StationId }.ToStringObjectDictionary(), (ret, res) =>
                            {
                                if ((bool)ret.Success)
                                {
                                    System.TimeSpan ts = new TimeSpan();
                                    foreach (var row in ret.rows)
                                    {
                                        dynamic item = new ExpandoObject();
                                        DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                                        WorkOrderInfo dataItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <WorkOrderInfo>();
                                        dataItem.DoStatusName  = WorkOrderInfo.getDoStatusName(int.Parse(item.StringObjectDictionary.DoStatus));
                                        dataItem.AccessPoint   = nodeInfo.AccessPoint;
                                        dataItem.StationId     = nodeInfo.StationId;
                                        ts = DateTime.Parse(dataItem.ServeManLeaveTime).Subtract(DateTime.Parse(dataItem.ServeManArriveTime));
                                        dataItem.ServiceTime = ts.TotalHours.ToString("0.00") + "小时";
                                        if (numUDServiceTimeFrom.Text.Trim() != "" && numUDServiceTimeTo.Text.Trim() != "")
                                        {
                                            if (int.Parse(numUDServiceTimeFrom.Text.Trim()) <= float.Parse(ts.TotalHours.ToString("0.00")) && float.Parse(ts.TotalHours.ToString("0.00")) <= int.Parse(numUDServiceTimeTo.Text.Trim()))
                                            {
                                                datas.Add(dataItem);
                                            }
                                        }
                                        else if (numUDServiceTimeFrom.Text.Trim() == "" && numUDServiceTimeTo.Text.Trim() != "")
                                        {
                                            if (float.Parse(ts.TotalHours.ToString("0.00")) <= int.Parse(numUDServiceTimeTo.Text.Trim()))
                                            {
                                                datas.Add(dataItem);
                                            }
                                        }
                                        else if (numUDServiceTimeFrom.Text.Trim() != "" && numUDServiceTimeTo.Text.Trim() == "")
                                        {
                                            if (int.Parse(numUDServiceTimeFrom.Text.Trim()) <= float.Parse(ts.TotalHours.ToString("0.00")))
                                            {
                                                datas.Add(dataItem);
                                            }
                                        }
                                        else if (numUDServiceTimeFrom.Text.Trim() == "" && numUDServiceTimeTo.Text.Trim() == "")
                                        {
                                            datas.Add(dataItem);
                                        }
                                    }
                                }
                            });
                        }
                    }
                }).BeginInvoke(new AsyncCallback((ar) =>
                {
                    //AsyncResult result = (AsyncResult)ar;
                    this.UIInvoke(() =>
                    {
                        xLoadingPanel.Stop();
                        xSource.DataSource = datas;
                        xSource.ResetBindings(false);
                    });

                    isFetchingData = false;
                }), null);
                xLoadingPanel.Start();
            }
        }
Пример #3
0
        private void FetchData()
        {
            new Action(() =>
            {
                //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId;
                string url = AccessPoint + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId;
                HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) =>
                {
                    if ((bool)ret.Success)
                    {
                        item = new ExpandoObject();
                        DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString()));
                        LastError = null;
                    }
                    else
                    {
                        LastError = ret.ErrorMessage;
                    }
                });
            }).BeginInvoke(new AsyncCallback((ar) =>
            {
                //AsyncResult result = (AsyncResult)ar;
                this.UIInvoke(() =>
                {
                    if (item != null)
                    {
                        int doStatus = int.Parse(item.StringObjectDictionary.DoStatus);
                        IDictionary <string, object> dataItem = (item.StringObjectDictionary as IDictionary <string, object>);

                        lblWorkOrderNo.Text    = item.StringObjectDictionary.WorkOrderNo;
                        lblOperatedByName.Text = item.StringObjectDictionary.OperatedByName;
                        lblDoStatus.Text       = WorkOrderInfo.getDoStatusName(doStatus);

                        foreach (var key in dataItem.Keys)
                        {
                            Control[] controlsOfInfo = tlpInfo.Controls.Find("lbl" + key, true);
                            if (controlsOfInfo.Length == 1)
                            {
                                (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);

                                if (key == "Gender")
                                {
                                    (controlsOfInfo[0] as Label).Text = WorkOrderInfo.getGenderName(e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]));
                                }
                                else if (key == "ServeFee" || key == "ServeFeeByGov" || key == "ServeFeeBySelf")
                                {
                                    if (e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) != "")
                                    {
                                        (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "/小时";
                                    }
                                }
                            }
                        }
                    }
                    xLoadingPanel.Stop();

                    if (!string.IsNullOrEmpty(LastError))
                    {
                        MessageBoxAdapter.ShowError(LastError);
                    }
                });
            }), null);
            xLoadingPanel.Start();
        }
Пример #4
0
        private void FetchData()
        {
            new Action(() =>
            {
                //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId;
                string url = AccessPoint + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId;
                HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) =>
                {
                    if ((bool)ret.Success)
                    {
                        item = new ExpandoObject();
                        DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString()));
                        LastError = null;
                    }
                    else
                    {
                        LastError = ret.ErrorMessage;
                    }
                });
            }).BeginInvoke(new AsyncCallback((ar) =>
            {
                //AsyncResult result = (AsyncResult)ar;
                this.UIInvoke(() =>
                {
                    if (item != null)
                    {
                        int doStatus = int.Parse(item.StringObjectDictionary.DoStatus);
                        IDictionary <string, object> dataItem = (item.StringObjectDictionary as IDictionary <string, object>);
                        if (doStatus > 0 && doStatus < 4)
                        {
                            if (e0571.web.core.Utils.TypeConverter.ChangeString(dataItem["ServeResult"]) == ""
                                ||
                                e0571.web.core.Utils.TypeConverter.ChangeString(dataItem["FeedbackToOldMan"]) == ""
                                )
                            {
                                //处置督办
                                txtServeManName.Visible   = true;
                                dtpServeBeginTime.Visible = true;
                                dtpServeEndTime.Visible   = true;

                                IEnumerable <RadioButton> rbsOfServeResultName = pnlServeResultName.Controls.OfType <RadioButton>();
                                foreach (var rb in rbsOfServeResultName)
                                {
                                    rb.Visible = true;
                                }
                                txtServeResultRemark.Visible = true;

                                IEnumerable <RadioButton> rbsOfFeedbackToOldManName = pnlFeedbackToOldManName.Controls.OfType <RadioButton>();
                                foreach (var rb in rbsOfFeedbackToOldManName)
                                {
                                    rb.Visible = true;
                                }

                                txtFeedbackRemarkToOldMan.Visible = true;
                            }
                        }
                        else if (doStatus == 4)
                        {
                            btnOK.Visible = false;
                        }
                        else
                        {
                            btnPrint.Visible = false;
                            btnOK.Text       = "响应";
                        }

                        lblWorkOrderNo.Text = item.StringObjectDictionary.WorkOrderNo;
                        lblDoStatus.Text    = WorkOrderInfo.getDoStatusName(doStatus);

                        foreach (var key in dataItem.Keys)
                        {
                            Control[] controlsOfInfo = tlpInfo.Controls.Find("lbl" + key, true);
                            if (controlsOfInfo.Length == 1)
                            {
                                (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);

                                if (key == "Gender")
                                {
                                    (controlsOfInfo[0] as Label).Text = WorkOrderInfo.getGenderName(e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]));
                                }
                            }

                            //查找process内的主动控件
                            if (txtServeManName.Visible && txtServeManName.Name == ("txt" + key))
                            {
                                txtServeManName.Text      = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);
                                txtServeManName.BackColor = Color.LightGreen;
                            }
                            if (dtpServeBeginTime.Visible && dtpServeBeginTime.Name == ("dtp" + key))
                            {
                                dtpServeBeginTime.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);
                            }
                            if (dtpServeEndTime.Visible && dtpServeEndTime.Name == ("dtp" + key))
                            {
                                dtpServeEndTime.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);
                            }
                            if (pnlServeResultName.Name == ("pnl" + key + "Name"))
                            {
                                IEnumerable <RadioButton> rbsOfServeResult = pnlServeResultName.Controls.OfType <RadioButton>().Where(x => x.Visible == true);
                                if (rbsOfServeResult.Count() > 0)
                                {
                                    pnlServeResultName.BackColor = Color.LightGreen;
                                }
                                foreach (var rb in rbsOfServeResult)
                                {
                                    if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "Of11016")
                                    {
                                        rb.Checked = true;
                                        break;
                                    }
                                }
                            }
                            if (txtServeResultRemark.Visible && txtServeResultRemark.Name == ("txt" + key))
                            {
                                txtServeResultRemark.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);
                            }
                            if (pnlFeedbackToOldManName.Name == ("pnl" + key + "Name"))
                            {
                                IEnumerable <RadioButton> rbsOfReturnVisit = pnlFeedbackToOldManName.Controls.OfType <RadioButton>().Where(x => x.Visible == true);
                                if (rbsOfReturnVisit.Count() > 0)
                                {
                                    pnlFeedbackToOldManName.BackColor = Color.LightGreen;
                                }
                                foreach (var rb in rbsOfReturnVisit)
                                {
                                    if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "Of11017")
                                    {
                                        rb.Checked = true;
                                        break;
                                    }
                                }
                            }
                            if (txtFeedbackRemarkToOldMan.Visible && txtFeedbackRemarkToOldMan.Name == ("txt" + key))
                            {
                                txtFeedbackRemarkToOldMan.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]);
                            }
                        }
                    }
                    xLoadingPanel.Stop();

                    if (!string.IsNullOrEmpty(LastError))
                    {
                        MessageBoxAdapter.ShowError(LastError);
                    }
                });
            }), null);
            xLoadingPanel.Start();
        }