예제 #1
0
        private bool ConnectRemoteHost()
        {
            bool Connected = false;

            try
            {
                HttpWebRequest request =
                    (HttpWebRequest)HttpWebRequest.Create(formatRemoteHost() + "/" + txtVirPath.Text.Trim() + "/forClient.htm");
                request.Method = "GET";

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                if (response.StatusCode.ToString() == "OK")
                {
                    StreamReader myreader     = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                    string       responseText = myreader.ReadToEnd();
                    Connected = responseText == "ilovesmartlife";
                }
            }
            catch (Exception ex)
            {
                MessageBoxAdapter.ShowError(ex.Message, Properties.Settings.Default.MessageBoxTitle);
            }
            return(Connected);
        }
예제 #2
0
        public bool InvokeRemovePhone(int phoneType, string phoneNo, string message)
        {
            bool result = false;

            if (CloseForCountdown)
            {
                //当前窗口和电话不对应
                MessageBoxAdapter.ShowError("当前窗口马上将自动关闭,无法响应您的操作");
                return(result);
            }

            if (RemoveCall != null)
            {
                RemoveCallEventArgs rpe = new RemoveCallEventArgs {
                    CallServiceId = PageData.CallServiceId, PhoneType = phoneType, PhoneNo = phoneNo, Message = message
                };
                RemoveCall(this, rpe);
                if (!rpe.Cancel)
                {
                    //没有取消,则记录日志
                    result = true;
                }
            }
            return(result);
        }
예제 #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string authEndPoint = formatEndPoint(txtAuthEndPoint.Text.Trim());
            string smsEndPoint  = formatEndPoint(txtSmsEndPoint.Text.Trim());
            string ismgEndPoint = formatEndPoint(txtISMGEndPoint.Text.Trim());

            string connectUrl = authEndPoint + "/";

            HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) =>
            {
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                    return;
                }

                if (SectionSettingsSave != null)
                {
                    SectionSettingsSave(this, new SectionSettingsSaveEventArgs
                    {
                        AuthEndPoint = authEndPoint,
                        SmsEndPoint  = smsEndPoint,
                        IsmgEndPoint = ismgEndPoint
                    });
                }

                this.DialogResult = DialogResult.OK;

                this.UIInvoke(() =>
                {
                    this.Close();
                });
            });
        }
예제 #4
0
        private void FetchBookMeal(Button btn)
        {
            string mealType  = btn.Name.Substring(btn.Name.Length - 5);
            string setMealId = btn.Tag as string;

            HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PAFetchBookMeal", new { OldManId = _OldManId.ToGuid(), MealType = mealType, SetMealId = setMealId, OperatedBy = Data.UserId }.ToStringObjectDictionary(), new { PACode = SettingsVar.BindingPACode, ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
            {
                if ((bool)ret.Success)
                {
                    MessageBoxAdapter.ShowInfo("领取配餐成功");
                    BookMealInfo bookMealInfo = Data.BookMeals.Single(item => item.OldManId == _OldManId && item.MealType == mealType && item.SetMealId == setMealId);
                    bookMealInfo.FetchFlag    = "1";

                    if (Common.isInExhibition)
                    {
                        btn.ForeColor = SystemColors.ControlText;
                        btn.Enabled   = true;
                        btn.Text      = "循环使用";
                    }
                    else
                    {
                        btn.ForeColor = SystemColors.ControlLight;
                        btn.Enabled   = false;
                        btn.Text      = "确认领餐";
                    }
                }
                else
                {
                    MessageBoxAdapter.ShowError((string)ret.ErrorMessage);
                }
            });
        }
예제 #5
0
        public bool InvokeTransferPhone(int phoneType, string phoneNo, string message)
        {
            bool result = false;

            if (CloseForCountdown)
            {
                //当前窗口和电话不对应
                MessageBoxAdapter.ShowError("当前窗口马上将自动关闭,无法响应您的操作");
                return(result);
            }


            if (MakeCall != null)
            {
                MakeCallEventArgs tpe = new MakeCallEventArgs {
                    CallServiceId = PageData.CallServiceId, Uuid = PageData.UuidOfIPCC, PhoneType = phoneType, PhoneNo = phoneNo, Message = message
                };
                MakeCall(this, tpe);
                if (!tpe.Cancel)
                {
                    //没有取消,则记录日志
                    result = true;
                }
            }
            return(result);
        }
예제 #6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtUserName.Text.Trim() == "")
            {
                MessageBoxAdapter.ShowError("请输入商家编号");
                return;
            }

            if (txtUserName.Text.Trim() != "XLX1")
            {
                MessageBoxAdapter.ShowError("非法授权!");
                return;
            }

            if (txtPassword.Text.Trim() == "")
            {
                MessageBoxAdapter.ShowError("请输入密码");
                return;
            }
            if (CheckExpire())
            {
                DoLogin(txtUserName.Text.Trim(), txtPassword.Text.Trim());
            }
            else
            {
                MessageBoxAdapter.ShowError("expired !!!");
            }
        }
예제 #7
0
        private void FetchAccessPoints(Action success)
        {
            sendReminderUrl = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SEND_REMINDER_POINT, Common.INI_FILE_PATH);
            strRunMode      = INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH);
            string authEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH);

            //异步认证
            byte runMode = byte.Parse(strRunMode);//测试1 正式0

            HttpAdapter.postAsyncAsJSON(authEndPoint, new { RunMode = runMode }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
            {
                if ((bool)ret.Success)
                {
                    foreach (var accessPoint in ret.ret.AccessPoints)
                    {
                        accessPointParts.Add(new AccessPointPart {
                            ObjectId = accessPoint.ObjectId.ToString(), Url = accessPoint.Url.ToString()
                        });
                    }

                    if (success != null)
                    {
                        success();
                    }
                }
                else
                {
                    MessageBoxAdapter.ShowError(ret.ErrorMessage);
                }
            });
        }
예제 #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (testPlatformReady())
            {
                if (PlatformReady != null)
                {
                    PlatformReady(this, new PlatformReadyEventArgs {
                        PlatformAddress = formatPlatformAddress()
                    });
                }
            }

            if (SettingsSave != null)
            {
                SettingsSave(this, new SettingsSaveEventArgs {
                    ServiceOnline = chkServiceOnlineFlag.Checked
                });
            }

            if (dtpStart.Value < dtpEnd.Value)
            {
                if (PlayBackTone != null)
                {
                    PlayBackTone(this, new PlayBackToneEventArgs {
                        PlayTone = cbxPlayTone.Checked, StartPlayTime = dtpStart.Value.ToString("HH:mm"), EndPlayTime = dtpEnd.Value.ToString("HH:mm")
                    });
                }
            }
            else
            {
                MessageBoxAdapter.ShowError("报警起始时间不能大于结束时间!");
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
예제 #9
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string authEndPoint    = formatEndPoint(txtAuthEndPoint.Text.Trim());
            string authSmsEndPoint = formatEndPoint(txtAuthSmsEndPoint.Text.Trim());
            string smsEndPoint     = formatEndPoint(txtSmsEndPoint.Text.Trim());

            string showError = "";

            showError = txt_SpCode.Text.Trim();
            if (string.IsNullOrEmpty(showError))
            {
                MessageBoxAdapter.ShowError("企业编号不能为空!");
                return;
            }
            showError = txt_LoginName.Text.Trim();
            if (string.IsNullOrEmpty(showError))
            {
                MessageBoxAdapter.ShowError("用户名不能为空!");
                return;
            }
            showError = txt_Password.Text.Trim();
            if (string.IsNullOrEmpty(showError))
            {
                MessageBoxAdapter.ShowError("密码不能为空!");
                return;
            }

            string txtSmsSetting = "SpCode=" + txt_SpCode.Text.Trim() + "&LoginName=" + txt_LoginName.Text.Trim() + "&Password="******"/";

            HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) =>
            {
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                    return;
                }

                if (SectionSettingsSave != null)
                {
                    SectionSettingsSave(this, new SectionSettingsSaveEventArgs
                    {
                        AuthEndPoint    = authEndPoint,
                        AuthSmsEndPoint = authSmsEndPoint,
                        SmsEndPoint     = smsEndPoint,
                        TxtSmsSetting   = txtSmsSetting,
                    });
                }

                this.DialogResult = DialogResult.OK;

                this.UIInvoke(() =>
                {
                    this.Close();
                });
            });
        }
예제 #10
0
        private void SubmitData()
        {
            if (item != null)
            {
                new Action(() =>
                {
                    int doStatus = int.Parse(item.StringObjectDictionary.DoStatus);

                    if (doStatus == 0)
                    {
                        //响应工单
                        if (MessageBoxAdapter.ShowConfirm("您确定要响应工单吗") == System.Windows.Forms.DialogResult.OK)
                        {
                            //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/ResponseWorkOrder";
                            string url = AccessPoint + "/Oca/WorkOrderService/ResponseWorkOrder";
                            HttpAdapter.postSyncAsJSON(url, new { WorkOrderId = Guid.Parse(WorkOrderId) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) =>
                            {
                                if ((bool)ret.Success)
                                {
                                    LastError = null;
                                }
                                else
                                {
                                    LastError = ret.ErrorMessage;
                                }
                            });
                        }
                        else
                        {
                            LastError = Common.ERROR_USER_CANCEL;
                        }
                    }
                }).BeginInvoke(new AsyncCallback((ar) =>
                {
                    //AsyncResult result = (AsyncResult)ar;
                    this.UIInvoke(() =>
                    {
                        xLoadingPanel.Stop();

                        if (!string.IsNullOrEmpty(LastError))
                        {
                            if (LastError != Common.ERROR_USER_CANCEL)
                            {
                                MessageBoxAdapter.ShowError(LastError);
                            }
                        }
                        else
                        {
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    });
                }), null);

                xLoadingPanel.Start();
            }
        }
예제 #11
0
        private void BindingPA()
        {
            string bindingPACode = txtBindingCode.Text.Trim();

            if (bindingPACode.Substring(2, 6).Length < 6)
            {
                MessageBoxAdapter.ShowError("无效的PA码");
                return;
            }
            SettingsVar.BindingPACode = bindingPACode;
            INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, SettingsVar.BindingPACode, Common.INI_FILE_PATH);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
예제 #12
0
 public void SetCallTransfer()
 {
     if (CloseForCountdown)
     {
         //当前窗口和电话不对应
         MessageBoxAdapter.ShowError("当前窗口马上将自动关闭,无法响应您的操作");
         return;
     }
     if (InvokeTransfer != null)
     {
         InvokeTransfer(this, new EventArgs());
     }
 }
예제 #13
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (txtUserName.Text.Trim() == "")
     {
         MessageBoxAdapter.ShowError("请输入用户名");
         return;
     }
     if (txtPassword.Text.Trim() == "")
     {
         MessageBoxAdapter.ShowError("请输入密码");
         return;
     }
     DoLogin(txtUserName.Text.Trim(), txtPassword.Text.Trim());
 }
예제 #14
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH);
            smsEndPoint  = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH);
            ismgEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, Common.INI_FILE_PATH);

            lblMsg.Show();
            _tickTimer          = new System.Timers.Timer(1 * 200);
            _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee)
            {
                BeginInvoke(new Action(() =>
                {
                    if (lblMsg.Text.IndexOf(".") == -1)
                    {
                        lblMsg.Text += ".";
                    }
                    else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length)
                    {
                        lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5);
                    }
                    else
                    {
                        lblMsg.Text += ".";
                    }
                }));
            });                          //到达时间的时候执行事件;
            _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true);
            _tickTimer.Enabled   = true; //是否执行System.Timers.Timer.Elapsed事件;

            HttpAdapter.optionsAsyncTo(authEndPoint + "/", new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) =>
            {
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                    return;
                }

                this.UIInvoke(() =>
                {
                    lblMsg.Hide();
                });

                _tickTimer.Enabled = false;
                _tickTimer         = null;

                InitSms();
            });
        }
예제 #15
0
        private void btnMakeCard_Click(object sender, EventArgs e)
        {
            _icAPI.Beep();
            int sector = 0;

            if (_icAPI.AuthenticationKey(sector))
            {
                int address = 1;

                string read1 = _icAPI.ReadIC16Byte(address);
                string read2 = _icAPI.ReadIC16Byte(address + 1);
                string raw   = read1 + read2;
                int    ret0  = _icAPI.WriteIC(address, _IDNo);
                if (ret0 == 0)
                {
                    HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PAMakeCard", new { OldManId = _OldManId.ToGuid(), OperatedBy = Data.UserId, ICNo = _CurrentICNo }.ToStringObjectDictionary(), new { PACode = SettingsVar.BindingPACode, ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            MessageBoxAdapter.ShowInfo("制卡成功");
                            lblTip.Text           = "制卡成功";
                            OldManInfo oldmanInfo = Data.OldMans.SingleOrDefault(item => item.OldManId == _OldManId);
                            if (oldmanInfo != null)
                            {
                                oldmanInfo.ICNo = _CurrentICNo;
                                lblICNo.Text    = _CurrentICNo;
                            }
                            isStop            = true;
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        }
                        else
                        {
                            ret0 = _icAPI.WriteIC(address, raw);
                            MessageBoxAdapter.ShowError((string)ret.ErrorMessage);
                        }
                    });
                }
                else
                {
                    MessageBoxAdapter.ShowError("写入卡失败" + ret0.ToString());
                }
            }
            else
            {
                MessageBoxAdapter.ShowError("验证密码失败");
            }
        }
예제 #16
0
        private void pbOrder_Click(object sender, EventArgs e)
        {
            API icAPI = new API();

            icAPI.InitIC();
            if (icAPI.IcDev < 0)
            {
                MessageBoxAdapter.ShowError("初始化IC读卡设备失败,请确认是否已连接IC读卡设备");
                return;
            }
            frmOrder frm = new frmOrder();

            frm.LoadAPI(icAPI);
            DialogResult result = frm.ShowDialog();

            icAPI.ExitIC();
        }
예제 #17
0
 private void txtPassword_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Return)
     {
         if (txtUserName.Text.Trim() == "")
         {
             MessageBoxAdapter.ShowError("请输入用户名");
             return;
         }
         if (txtPassword.Text.Trim() == "")
         {
             MessageBoxAdapter.ShowError("请输入密码");
             return;
         }
         DoLogin(txtUserName.Text.Trim(), txtPassword.Text.Trim());
     }
 }
예제 #18
0
        //验证
        private void _LoopForAuth()
        {
            Auth_CircleThread = ThreadAdapter.UIDoCircleTask(lblMsg, () =>
            {
                if (lblMsg.Text.IndexOf(".") == -1)
                {
                    lblMsg.Text += ".";
                }
                else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length)
                {
                    lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5);
                }
                else
                {
                    lblMsg.Text += ".";
                }
            },
                                                             200,
                                                             () =>
            {
                return(bStopAuthThread);
            },//验证未通过永远不停止
                                                             () =>
            {
                return(false);
            }//暂时永远不跳过
                                                             );

            //验证请求
            HttpAdapter.optionsAsyncTo(authEndPoint + "/", new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) =>
            {
                this.Invoke(new Action(() => {
                    lblMsg.Hide();      //
                }));
                bStopAuthThread = true; //停止验证
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                }
                else
                {
                    bPassValidated = true;
                }
            });
        }
예제 #19
0
        private void btnAreaSync_Click(object sender, EventArgs e)
        {
            //远程获取deployNodeObjects
            string authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH);

            ThreadAdapter.DoOnceTask(() =>
            {
                HttpAdapter.getSyncTo(authDataPoint + "/GetDeployNodeObjects", (ret, res) =>
                {
                    if ((bool)ret.Success)
                    {
                        string strDeployNodeObjects = JsonConvert.SerializeObject(ret.rows);
                        INIAdapter.WriteValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, strDeployNodeObjects, Common.INI_FILE_PATH);
                        MessageBoxAdapter.ShowInfo("区域同步成功");
                    }
                    else
                    {
                        MessageBoxAdapter.ShowError(ret.ErrorMessage.ToString());
                    }
                });
            });
        }
예제 #20
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //
            string     authEndPoint = formatAuthEndPoint();
            RemindType rt           = EnumAdapter.GetEnum <RemindType>(e0571.web.core.Utils.TypeConverter.ChangeString(cbRemindType.SelectedValue));
            string     connectUrl   = authEndPoint + "/";

            HttpAdapter.optionsAsyncTo(connectUrl, new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
            {
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                    return;
                }

                if (SectionWebSettingsSave != null)
                {
                    SectionWebSettingsSave(this, new SectionWebSettingsSaveEventArgs {
                        AuthEndPoint = authEndPoint
                    });
                }

                if (SectionBizSettingsSave != null)
                {
                    SectionBizSettingsSave(this, new SectionBizSettingsSaveEventArgs {
                        Type = rt, YYRemindFlag = (chkPlayYY.Checked ? 1 : 0)
                    });
                }

                this.DialogResult = DialogResult.OK;

                this.UIInvoke(() =>
                {
                    this.Close();
                });
            });
        }
예제 #21
0
        private bool testPlatformReady()
        {
            bool isReady = false;

            try
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(formatPlatformAddress() + "/forClient.htm");
                request.Method = "GET";

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                if (response.StatusCode.ToString() == "OK")
                {
                    StreamReader myreader     = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                    string       responseText = myreader.ReadToEnd();
                    isReady = responseText == "ilovesmartlife";
                }
            }
            catch (Exception ex)
            {
                MessageBoxAdapter.ShowError(ex.Message, Properties.Settings.Default.MessageBoxTitle);
            }
            return(isReady);
        }
        private void SubmitDataOfMerchantServeItem()
        {
            //if (item != null)
            //{
            new Action(() =>
            {
                if (MessageBoxAdapter.ShowConfirm("您确定要提交修改吗") == System.Windows.Forms.DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(stationId))
                    {
                        string url = MerchantVar.CurrentMerchant.AuthNodeInfos.FirstOrDefault(s => s.StationId.ToString() == stationId).AccessPoint;

                        if (!string.IsNullOrEmpty(url))
                        {
                            StringObjectDictionary postParam = new { Status = 1 }.ToStringObjectDictionary();
                            IList <string> ServeItemBList    = new List <string>();
                            IList <string> ServeFeeList      = new List <string>();
                            IList <string> ServeModeList     = new List <string>();

                            serveControlList.Clear();
                            dymicFindControl(tlpServerItem);
                            IEnumerable <object> checkedList = serveControlList.Where(s => (s is CheckBox) && ((CheckBox)s).Checked == true);
                            UnderlineTextBox obj_Txt;
                            CheckBox obj_Cbx;
                            foreach (var c in checkedList)
                            {
                                obj_Cbx       = (CheckBox)c;
                                string txtKey = obj_Cbx.Name.Replace("cbx", "txt");
                                obj_Txt       = (UnderlineTextBox)serveControlList.FirstOrDefault(s => (s is UnderlineTextBox) && ((UnderlineTextBox)s).Name == txtKey);
                                if (obj_Txt != null && !string.IsNullOrEmpty(obj_Txt.Text))
                                {
                                    ServeItemBList.Add(txtKey.Substring(3, 5));
                                    ServeFeeList.Add(obj_Txt.Text);
                                    postParam["Status"] = 1;
                                }
                                else
                                {
                                    postParam["Status"] = 0;
                                    LastError           = "必须填写【" + obj_Cbx.Text + "】每小时的服务费用";
                                    obj_Cbx.Focus();
                                    break;
                                }
                            }

                            if ((int)postParam["Status"] > 0)
                            {
                                IEnumerable <CheckBox> cbxModeTypes = tabPage2.Controls.OfType <CheckBox>();
                                foreach (var c in cbxModeTypes)
                                {
                                    if (c.Checked)
                                    {
                                        ServeModeList.Add(c.Name.Substring(3, 5));
                                    }
                                }
                                postParam["ServeItemB"] = ServeItemBList;
                                postParam["ServeFee"]   = ServeFeeList;
                                postParam["ServeMode"]  = ServeModeList;

                                //url = url.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/MerchantService/SetServeItemsAndServeModes/" + stationId;
                                url = url + "/Oca/MerchantService/SetServeItemsAndServeModes/" + stationId;
                                HttpAdapter.postSyncAsJSON(url, postParam, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) =>
                                {
                                    if ((bool)ret.Success)
                                    {
                                        LastError = null;
                                    }
                                    else
                                    {
                                        LastError = ret.ErrorMessage;
                                    }
                                });
                            }
                        }
                    }
                }
                else
                {
                    LastError = Common.ERROR_USER_CANCEL;
                }
            }).BeginInvoke(new AsyncCallback((ar) =>
            {
                this.UIInvoke(() =>
                {
                    xLoadingPanel.Stop();
                    if (!string.IsNullOrEmpty(LastError))
                    {
                        if (LastError != Common.ERROR_USER_CANCEL)
                        {
                            MessageBoxAdapter.ShowError(LastError);
                        }
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                });
            }), null);
            xLoadingPanel.Start();
            //}
        }
예제 #23
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH);

            lblMsg.Show();
            _tickTimer          = new System.Timers.Timer(1 * 200);
            _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee)
            {
                BeginInvoke(new Action(() =>
                {
                    if (lblMsg.Text.IndexOf(".") == -1)
                    {
                        lblMsg.Text += ".";
                    }
                    else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length)
                    {
                        lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5);
                    }
                    else
                    {
                        lblMsg.Text += ".";
                    }
                }));
            });                          //到达时间的时候执行事件;
            _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true);
            _tickTimer.Enabled   = true; //是否执行System.Timers.Timer.Elapsed事件;


            HttpUtility.optionsAsyncTo(authEndPoint + "/", null, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) =>
            {
                if (ret != "ok")
                {
                    MessageBoxAdapter.ShowError("无效的认证节点");
                    return;
                }

                this.UIInvoke(() =>
                {
                    AnchorStyles anS = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                              | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));

                    frmSendSms fmSendSms      = new frmSendSms();
                    fmSendSms.FormBorderStyle = FormBorderStyle.None;
                    fmSendSms.TopLevel        = false;
                    fmSendSms.Parent          = this;
                    fmSendSms.Anchor          = anS;
                    fmSendSms.Size            = this.panel1.Size;
                    this.panel1.Controls.Add(fmSendSms);//将子窗体载入panel
                    fmSendSms.Show();

                    frmGetSms fmGetSms       = new frmGetSms();
                    fmGetSms.FormBorderStyle = FormBorderStyle.None;
                    fmGetSms.TopLevel        = false;
                    fmGetSms.Parent          = this;
                    fmGetSms.Anchor          = anS;
                    fmGetSms.Size            = this.panel2.Size;
                    this.panel2.Controls.Add(fmGetSms);//将子窗体载入panel
                    fmGetSms.Show();
                    lblMsg.Hide();
                });

                _tickTimer.Enabled = false;
                _tickTimer         = null;
            });
        }
예제 #24
0
        private void DoLogin(string userCode, string password)
        {
            //
            btnOK.SafeButtonEnable(false);

            this.UIDoStepTasks(new List <Func <bool> >()
            {
                () => {
                    #region 检查硬件环境
                    lblLoadItems.Text = _LoadItem = "检查硬件环境";
                    Application.DoEvents();
                    API icAPI = new API();
                    icAPI.InitIC();
                    if (icAPI.IcDev < 0)
                    {
                        if (MessageBoxAdapter.ShowConfirm("初始化IC读卡设备失败,请确认是否已连接IC读卡设备!是否要跳过该步骤?") == System.Windows.Forms.DialogResult.OK)
                        {
                            btnOK.SafeButtonEnable(true);
                            isBreak = false;
                        }
                        else
                        {
                            isBreak = true;
                            return(false);
                        }
                    }
                    else
                    {
                        icAPI.ExitIC();
                    }
                    isBreak = false;
                    return(true);

                    #endregion
                },
                () => {
                    #region 读取服务机构编码
                    lblLoadItems.Text = _LoadItem = "读取服务机构编码";
                    isBreak           = false;
                    Application.DoEvents();
                    if (string.IsNullOrEmpty(SettingsVar.BindingPACode))
                    {
                        frmBindingPA frm = new frmBindingPA();
                        frm.ShowDialog();
                        if (frm.DialogResult != System.Windows.Forms.DialogResult.OK)
                        {
                            isBreak           = true;
                            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                            btnOK.SafeButtonEnable(true);
                            return(false);
                        }
                        else
                        {
                            this.Activate();
                        }
                    }
                    return(true);

                    #endregion
                },
                () => {
                    #region 用户认证
                    lblLoadItems.Text = _LoadItem = "用户认证";
                    isBreak           = false;
                    Application.DoEvents();
                    string authEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH);
                    string objectId     = SettingsVar.BindingPACode.Substring(2, 6);
                    HttpAdapter.postSyncAsJSON(authEndPoint, new { RunMode = SettingsVar.RunMode, ObjectId = objectId, UserCode = userCode, PasswordHash = MD5Provider.Generate(password) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            Data.UserId = Guid.Parse((string)ret.ret.UserId);
                            SettingsVar.DataExchangePoint = (string)ret.ret.AccessPoint;
                            INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userCode, Common.INI_FILE_PATH);
                        }
                        else
                        {
                            MessageBoxAdapter.ShowError((string)ret.ErrorMessage);
                            isBreak = true;
                            btnOK.SafeButtonEnable(true);
                        }
                    });
                    if (isBreak)
                    {
                        return(false);
                    }
                    return(true);

                    #endregion
                },
                () => {
                    #region 更新老人数据
                    lblLoadItems.Text = _LoadItem = "更新老人数据";
                    isBreak           = false;
                    Application.DoEvents();
                    HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetOldManInfoForSelfServiceMachine", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            Data.OldMans = new List <OldManInfo>();
                            foreach (var row in ret.rows)
                            {
                                dynamic item = new ExpandoObject();
                                DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                                Data.OldMans.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <OldManInfo>());
                            }

                            //MessageBoxAdapter.ShowInfo("老人:" + Data.OldMans.Count.ToString());
                        }
                        else
                        {
                            isBreak       = true;
                            lblError.Text = ret.ErrorCode;
                        }
                    });
                    if (isBreak)
                    {
                        return(false);
                    }
                    return(true);

                    #endregion
                },
                () => {
                    #region 更新配餐数据
                    lblLoadItems.Text = _LoadItem = "更新配餐数据";
                    isBreak           = false;
                    Application.DoEvents();
                    HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetOldManBookMealForToday", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            Data.BookMeals = new List <BookMealInfo>();
                            foreach (var row in ret.rows)
                            {
                                dynamic item = new ExpandoObject();
                                DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                                Data.BookMeals.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <BookMealInfo>());
                            }

                            //MessageBoxAdapter.ShowInfo("订餐:" + Data.BookMeals.Count.ToString());
                        }
                        else
                        {
                            isBreak       = true;
                            lblError.Text = ret.ErrorCode;
                        }
                    });
                    if (isBreak)
                    {
                        return(false);
                    }
                    return(true);

                    #endregion
                },
                () => {
                    allLoaded         = true;
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    return(true);
                }
            }, Common.msDelay);

            lblLoadItems.UIDoCircleTask(() =>
            {
                if (dotNum == 3)
                {
                    lblLoadItems.Text = _LoadItem;
                    dotNum            = 0;
                }
                else
                {
                    lblLoadItems.Text += ".";
                    dotNum++;
                }
            }, Common.msDot, () =>
            {
                return(allLoaded || isBreak);
            });
        }
예제 #25
0
        private void BuildControls()
        {
            this.UIDoStepTasks(new List <Func <bool> >()
            {
                () => {
                    xTab.TabPages.Clear();
                    return(true);
                },
                () => {
                    #region 数据源
                    dataSource.Clear();
                    dataSource.AddRange(Data.OldMans);
                    return(true);

                    #endregion
                },
                () => {
                    #region 构建UI
                    //计算页数
                    int needCreateTabPageCount = 1 + dataSource.Count / 20;
                    int padding   = 15;
                    int indexPage = 0;

                    int indexOfOldMan = 0;
                    int x, y          = 0;
                    do
                    {
                        int currentPageSize = pageSize;
                        xTab.TabPages.Add(indexPage.ToString());
                        needCreateTabPageCount--;
                        if (needCreateTabPageCount == 0)
                        {
                            currentPageSize = dataSource.Count % pageSize;
                        }

                        TabPage tb   = xTab.TabPages[indexPage];
                        tb.BackColor = Color.FromArgb(129, 61, 222);
                        int i        = 0;
                        for (indexOfOldMan = indexPage * pageSize + i; i < currentPageSize; i++)
                        {
                            OldManInfo oldman = dataSource[indexOfOldMan];


                            x = i % 4;
                            y = i / 4;

                            ucOldManCard card = new ucOldManCard();

                            card.BackColor = string.IsNullOrEmpty(oldman.ICNo) ? Color.Silver : Color.FromArgb(255, 192, 192);
                            card.Location  = new Point(padding * (x + 1) + x * card.Size.Width, padding * (y + 1) + y * card.Size.Height);

                            card.ClickLabel.Text = oldman.OldManName;
                            card.ClickLabel.Tag  = oldman.OldManId;

                            tb.Controls.Add(card);


                            indexOfOldMan++;
                        }

                        indexPage++;
                    } while (needCreateTabPageCount > 0);
                    #endregion
                    return(true);
                },
                () => {
                    lblPageNo.Text             = "1";
                    lblPageAll.Text            = "/ " + (dataSource.Count / pageSize + 1).ToString();
                    xSlideTab                  = new SlideableTabControl(xTab);
                    xSlideTab.SlidePageEamless = true;

                    return(true);
                },
                () => {
                    #region 绑定卡片点击事件
                    ThreadAdapter.DoOnceTask(() =>
                    {
                        foreach (TabPage page in xTab.TabPages)
                        {
                            Common.DebugLog(page.Text + ":" + page.Controls.Count);
                            foreach (ucOldManCard card in page.Controls)
                            {
                                card.ClickLabel.Click += new EventHandler((o, de) =>
                                {
                                    API icAPI = new API();
                                    icAPI.InitIC();
                                    if (icAPI.IcDev < 0)
                                    {
                                        MessageBoxAdapter.ShowError("初始化IC读卡设备失败,请确认是否已连接IC读卡设备");
                                        return;
                                    }
                                    frmCardView frm = new frmCardView();
                                    frm.LoadInfo(icAPI, (string)(o as Control).Tag);
                                    DialogResult result = frm.ShowDialog();
                                    if (result == System.Windows.Forms.DialogResult.OK)
                                    {
                                        (o as Control).Parent.BackColor = Color.FromArgb(255, 192, 192);
                                    }
                                    icAPI.ExitIC();
                                });
                            }
                        }
                    });
                    return(true);

                    #endregion
                }
            }, 0);
        }
예제 #26
0
        private void BindingPA()
        {
            string bindingPACode = txtBindingCode.Text.Trim();

            ObjectId = bindingPACode.Substring(2, 6);
            if (ObjectId.Length < 6)
            {
                MessageBoxAdapter.ShowError("无效的PA码");
                return;
            }


            string authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH);


            this.UIDoStepTasks(new List <Func <bool> >()
            {
                () => {
                    lblLoadItems.Text = _LoadItem = "获取业务服务器地址";
                    isBreak           = false;
                    HttpAdapter.getSyncTo(authDataPoint + string.Format("/GetDeployNode/{0},{1},IC001", ObjectId, SettingsVar.RunMode), null, new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            SettingsVar.DataExchangePoint = (string)ret.ret.AccessPoint;
                            INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_DATA_EXCHANGE_POINT, SettingsVar.DataExchangePoint, Common.INI_FILE_PATH);
                        }
                        else
                        {
                            isBreak = true;
                            MessageBoxAdapter.ShowError((string)ret.ErrorMessage);
                        }
                    });

                    if (isBreak)
                    {
                        return(false);
                    }
                    return(true);
                },
                () => {
                    lblLoadItems.Text = _LoadItem = "绑定设备";
                    isBreak           = false;
                    HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PADeviceBindingForSelfServiceTerminal", new { PACode = bindingPACode, MachineKey = Common.MachineKey, Action = "binding" }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            SettingsVar.BindingPACode = bindingPACode;
                            INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, SettingsVar.BindingPACode, Common.INI_FILE_PATH);
                        }
                        else
                        {
                            MessageBoxAdapter.ShowError((string)ret.ErrorCode);
                        }
                    });
                    if (isBreak)
                    {
                        return(false);
                    }
                    return(true);
                },
                () => {
                    allLoaded         = true;
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    return(true);
                }
            }, Common.msDelay);

            lblLoadItems.UIDoCircleTask(() =>
            {
                if (dotNum == 3)
                {
                    lblLoadItems.Text = _LoadItem;
                    dotNum            = 0;
                }
                else
                {
                    lblLoadItems.Text += ".";
                    dotNum++;
                }
            }, Common.msDot, () =>
            {
                return(allLoaded || isBreak);
            });
        }
예제 #27
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();
        }
예제 #28
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();
        }
예제 #29
0
        private void SubmitData()
        {
            if (item != null)
            {
                new Action(() =>
                {
                    int doStatus = int.Parse(item.StringObjectDictionary.DoStatus);

                    if (doStatus == 0)
                    {
                        //响应工单
                        if (MessageBoxAdapter.ShowConfirm("您确定要响应工单吗") == System.Windows.Forms.DialogResult.OK)
                        {
                            //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/ResponseWorkOrder";
                            string url = AccessPoint + "/Oca/WorkOrderService/ResponseWorkOrder";
                            HttpAdapter.postSyncAsJSON(url, new { WorkOrderId = Guid.Parse(WorkOrderId) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) =>
                            {
                                if ((bool)ret.Success)
                                {
                                    LastError = null;
                                }
                                else
                                {
                                    LastError = ret.ErrorMessage;
                                }
                            });
                        }
                        else
                        {
                            LastError = Common.ERROR_USER_CANCEL;
                        }
                    }
                    else
                    {
                        //商家填写工单服务过程信息
                        if (MessageBoxAdapter.ShowConfirm("您确定要提交工单服务处理与反馈吗") == System.Windows.Forms.DialogResult.OK)
                        {
                            bool canSubmit = true;
                            StringObjectDictionary postParam = new { WorkOrderId = Guid.Parse(WorkOrderId), ServeResultRemark = txtServeResultRemark.Text.Trim(), FeedbackRemarkToOldMan = txtFeedbackRemarkToOldMan.Text.Trim() }.ToStringObjectDictionary();

                            if (txtServeManName.Text.Trim() != "")
                            {
                                postParam["ServeManName"] = txtServeManName.Text.Trim();
                            }
                            else
                            {
                                LastError = "必须填写服务人";
                                canSubmit = false;
                            }
                            DateTime serveBeginTime, serveEndTime;
                            if (canSubmit)
                            {
                                if (DateTime.TryParse(dtpServeBeginTime.Text, out serveBeginTime))
                                {
                                    postParam["ServeBeginTime"] = serveBeginTime;
                                }
                                else
                                {
                                    LastError = "必须填写服务开始时间";
                                    canSubmit = false;
                                }
                            }
                            if (canSubmit)
                            {
                                if (DateTime.TryParse(dtpServeEndTime.Text, out serveEndTime))
                                {
                                    postParam["ServeEndTime"] = serveEndTime;
                                }
                                else
                                {
                                    LastError = "必须填写服务结束时间";
                                    canSubmit = false;
                                }
                            }
                            if (canSubmit)
                            {
                                RadioButton rbOfServeResultName = pnlServeResultName.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                                if (rbOfServeResultName != null)
                                {
                                    string serveResult       = rbOfServeResultName.Name.Substring(2, 5);
                                    postParam["ServeResult"] = serveResult;
                                }
                                else
                                {
                                    LastError = "必须填写服务结果";
                                    canSubmit = false;
                                }
                            }

                            if (canSubmit)
                            {
                                RadioButton rbOfFeedbackToOldManName = pnlFeedbackToOldManName.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                                if (rbOfFeedbackToOldManName != null)
                                {
                                    string feedbackToOldMan       = rbOfFeedbackToOldManName.Name.Substring(2, 5);
                                    postParam["FeedbackToOldMan"] = feedbackToOldMan;
                                }
                                else
                                {
                                    LastError = "必须评价老人";
                                    canSubmit = false;
                                }
                            }


                            if (canSubmit)
                            {
                                //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/InputWorkOrder";
                                string url = AccessPoint + "/Oca/WorkOrderService/InputWorkOrder";
                                HttpAdapter.postSyncAsJSON(url, postParam, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) =>
                                {
                                    if ((bool)ret.Success)
                                    {
                                        LastError = null;
                                    }
                                    else
                                    {
                                        LastError = ret.ErrorMessage;
                                    }
                                });
                            }
                        }
                        else
                        {
                            LastError = Common.ERROR_USER_CANCEL;
                        }
                    }
                }).BeginInvoke(new AsyncCallback((ar) =>
                {
                    //AsyncResult result = (AsyncResult)ar;
                    this.UIInvoke(() =>
                    {
                        xLoadingPanel.Stop();

                        if (!string.IsNullOrEmpty(LastError))
                        {
                            if (LastError != Common.ERROR_USER_CANCEL)
                            {
                                MessageBoxAdapter.ShowError(LastError);
                            }
                        }
                        else
                        {
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    });
                }), null);

                xLoadingPanel.Start();
            }
        }
예제 #30
0
        private void btnTestSpeed_Click(object sender, EventArgs e)
        {
            string oldText = btnTestSpeed.Text;

            btnTestSpeed.Enabled   = false;
            testSpeedLoadingThread = ThreadAdapter.DoCircleTask(() =>
            {
                BeginInvoke(new Action(() =>
                {
                    if (btnTestSpeed.Text.IndexOf(".") == -1)
                    {
                        btnTestSpeed.Text += ".";
                    }
                    else if (btnTestSpeed.Text.IndexOf(".") + 3 == btnTestSpeed.Text.Length)
                    {
                        btnTestSpeed.Text = btnTestSpeed.Text.Substring(0, btnTestSpeed.Text.Length - 3);
                    }
                    else
                    {
                        btnTestSpeed.Text += ".";
                    }
                }));
            }, 700, () =>
            {
                return(btnTestSpeed.Enabled);
            });

            string commandStr = string.Format("iperf.exe -c {0} -p 12347 -t 10 -y C", callCenterIP);

            CommandLineAdapter.Execute(commandStr, (o, dre) =>
            {
                string output = dre.Data;
                if (!string.IsNullOrEmpty(output))
                {
                    if (output.Contains("fail") || output.Contains("timed out"))
                    {
                        MessageBoxAdapter.ShowError("无法连接到呼叫中心,请检查网络!");
                    }
                    else
                    {
                        string[] results = output.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        if (results.Length == 9)
                        {
                            long bps = long.Parse(results[8]) / 8 / 1024;
                            MessageBoxAdapter.ShowInfo("连接到呼叫中心的即时速度为【" + bps.ToString() + "k】!");
                        }
                    }
                }

                if (!String.IsNullOrEmpty(dre.Data))
                {
                    Console.WriteLine(dre.Data);
                }
            }, "./tools", (o, ee) =>
            {
                BeginInvoke(new Action(() =>
                {
                    btnTestSpeed.Enabled = true;
                    btnTestSpeed.Text    = oldText;
                }));
            });
        }