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