Esempio n. 1
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();
            }
        }
Esempio n. 2
0
 private void frmCallService_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!_CurrentCallServiceFinished)
     {
         if (MessageBoxAdapter.ShowConfirm("本次服务还未处理完成,退出时将自动保存,确定要退出吗", Properties.Settings.Default.MessageBoxTitle) == DialogResult.OK)
         {
             //执行BS上的自动保存动作
             string strCallServiceId = PageData.CallServiceId.ToString();
             webBrowser.Document.InvokeScript("saveCallService", new object[] { strCallServiceId, "{}", "坐席工号<" + EnvironmentVar.UserCode + ">保存并退出服务" });
         }
         else
         {
             e.Cancel = true;
         }
     }
 }
Esempio n. 3
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if ((sender as Button).Text == "确认领餐")
     {
         if (MessageBoxAdapter.ShowConfirm("确认要领餐么?") == System.Windows.Forms.DialogResult.OK)
         {
             FetchBookMeal((sender as Button));
         }
     }
     else
     {
         if (MessageBoxAdapter.ShowConfirm("确认要循环使用么?") == System.Windows.Forms.DialogResult.OK)
         {
             ReuseBookMeal((sender as Button));
         }
     }
 }
Esempio n. 4
0
 private void frmMain120701_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (queues.Count > 0)
     {
         if (MessageBoxAdapter.ShowConfirm("还有数据没有处理完成,您确定要退出吗", Properties.Settings.Default.MessageBoxTitle) == DialogResult.OK)
         {
             _Clean();
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         _Clean();
     }
 }
Esempio n. 5
0
        private void tsbtn_frmSetting_Click(object sender, EventArgs e)
        {
            frmSetting frm = new frmSetting();

            frm.SectionSettingsSave += new dSectionSettingsSave((o, ce) =>
            {
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, ce.SmsEndPoint, Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, ce.IsmgEndPoint, Common.INI_FILE_PATH);
            });
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (MessageBoxAdapter.ShowConfirm("您必须重新启动程序设置才能生效,是否重启程序?", Properties.Settings.Default.MessageBoxTitle) == System.Windows.Forms.DialogResult.OK)
                {
                    Application.Restart();
                }
            }
        }
Esempio n. 6
0
        private void tsmiNodeSetting_Click(object sender, EventArgs e)
        {
            frmSettings frm = new frmSettings();

            frm.SectionWebSettingsSave += new dSectionWebSettingsSave((o, ce) =>
            {
                INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH);
            });
            frm.SectionBizSettingsSave += new dSectionBizSettingsSave((o, ce) =>
            {
                SettingsVar.CurrentRemindType = ce.Type;
                INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, ((int)ce.Type).ToString(), Common.INI_FILE_PATH);
            });
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (MessageBoxAdapter.ShowConfirm("您必须重新启动程序设置才能生效,是否重启程序?", Properties.Settings.Default.MessageBoxTitle) == System.Windows.Forms.DialogResult.OK)
                {
                    Application.Restart();
                }
            }
        }
Esempio n. 7
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBoxAdapter.ShowConfirm("您确定要退出吗", Properties.Settings.Default.MessageBoxTitle) == DialogResult.OK)
     {
         isRunning = false;
         //清空线程
         Thread thread;
         if (sendSmsThreadDic != null)
         {
             foreach (var item in sendSmsThreadDic)
             {
                 thread = item.Value;
                 if (thread != null && thread.IsAlive)
                 {
                     thread.Abort();
                     thread = null;
                 }
                 sendSmsThreadDic.Remove(item.Key);
             }
         }
         if (getSmsThreadDic != null)
         {
             foreach (var item in getSmsThreadDic)
             {
                 thread = item.Value;
                 if (thread != null && thread.IsAlive)
                 {
                     thread.Abort();
                     thread = null;
                 }
                 getSmsThreadDic.Remove(item.Key);
             }
         }
     }
     else
     {
         e.Cancel = true;
     }
 }
Esempio n. 8
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();
            }
        }
Esempio n. 9
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);
            });
        }
        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();
            //}
        }
        private void SubmitDataOfMerchant()
        {
            //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
                            {
                                StationId = Guid.Parse(stationId)
                            }.ToStringObjectDictionary();

                            //接单方式
                            var cbxAcceptTypeList = pnlAcceptType.Controls.OfType <CheckBox>().Where(c => c.Checked);
                            if (cbxAcceptTypeList != null)
                            {
                                foreach (var row in cbxAcceptTypeList)
                                {
                                    postParam["AcceptType"] = row.Name.Substring(3, 5) + ",";
                                }
                            }
                            //结算周期
                            RadioButton rbOfSettlementPeriod = pnlSettlementPeriod.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                            if (rbOfSettlementPeriod != null)
                            {
                                postParam["SettlementPeriod"] = rbOfSettlementPeriod.Name.Substring(2, 5);
                            }
                            //结算方式
                            RadioButton rbOfSettlementMode = pnlSettlementMode.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
                            if (rbOfSettlementPeriod != null)
                            {
                                postParam["SettlementMode"] = rbOfSettlementPeriod.Name.Substring(2, 5);
                            }

                            //接单方式
                            var cbxWorkDayList = pnlWorkDay.Controls.OfType <CheckBox>().Where(c => c.Checked);
                            if (cbxWorkDayList != null)
                            {
                                string strday = "";
                                foreach (var row in cbxWorkDayList)
                                {
                                    strday += row.Name.Substring(row.Name.Length - 1, 1) + ",";
                                }
                                postParam["WorkDay"] = strday;
                            }
                            //
                            DateTime serveBeginTime, serveEndTime;
                            if (DateTime.TryParse(dtpServeTimeBeginOfDay.Text, out serveBeginTime))
                            {
                                postParam["ServeTimeBeginOfDay"] = serveBeginTime.ToString("HH:mm");
                            }
                            if (DateTime.TryParse(dtpServeTimeEndOfDay.Text, out serveEndTime))
                            {
                                postParam["ServeTimeEndOfDay"] = serveEndTime.ToString("HH:mm");
                            }

                            postParam["ServeTimeOfDayDescription"] = txtServeTimeOfDayDescription.Text.Trim();
                            postParam["ServeExtraComment"]         = txtServeExtraComment.Text.Trim();

                            //url = url.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") ;
                            HttpAdapter.postSyncAsJSON(url + "/Oca/MerchantService", 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();
            //}
        }
Esempio n. 12
0
        private void frmSplash_Load(object sender, EventArgs e)
        {
            InitForm();

            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)
                        {
                            isBreak = false;
                        }
                        else
                        {
                            isBreak           = true;
                            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                            return(false);
                        }
                    }
                    else
                    {
                        icAPI.ExitIC();
                    }
                    isBreak = false;
                    return(true);

                    #endregion
                },
                () => {
                    #region 获取业务服务器地址
                    lblLoadItems.Text = _LoadItem = "获取业务服务器地址";
                    isBreak           = false;
                    Application.DoEvents();
                    if (string.IsNullOrEmpty(SettingsVar.DataExchangePoint))
                    {
                        frmBindingPA frm = new frmBindingPA();
                        frm.ShowDialog();
                        if (frm.DialogResult != System.Windows.Forms.DialogResult.OK)
                        {
                            isBreak           = true;
                            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                            return(false);
                        }
                        else
                        {
                            this.Activate();
                        }
                    }
                    return(true);

                    #endregion
                },
                () => {
                    #region 连接到业务服务器
                    lblLoadItems.Text = _LoadItem = "连接到业务服务器";
                    isBreak           = false;
                    Application.DoEvents();
                    int errorCode = 0;
                    HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PADeviceBindingForSelfServiceTerminal", new { PACode = SettingsVar.BindingPACode, MachineKey = Common.MachineKey, Action = "check" }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if (!(bool)ret.Success)
                        {
                            errorCode     = (int)ret.ErrorCode;
                            lblError.Text = ret.ErrorCode;
                        }
                    });
                    if (errorCode == 53010 || errorCode == 53011)
                    {
                        //设备未绑定或已解绑
                        frmBindingPA frm = new frmBindingPA();
                        frm.ShowDialog();
                        if (frm.DialogResult != System.Windows.Forms.DialogResult.OK)
                        {
                            isBreak           = true;
                            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                            return(false);
                        }
                    }
                    else if (errorCode == 53012)
                    {
                        //失效
                        MessageBoxAdapter.ShowError("您的设备使用期已到,请联系管理员!");
                        isBreak           = true;
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                        return(false);
                    }
                    return(true);

                    #endregion
                },
                () => {
                    #region 更新机构信息
                    lblLoadItems.Text = _LoadItem = "更新机构信息";
                    isBreak           = false;
                    Application.DoEvents();
                    HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetPAStationInfo", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            dynamic item = new ExpandoObject();
                            DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString()));
                            PAStationInfo stationInfo = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <PAStationInfo>();
                            SettingsVar.BindingPAName = stationInfo.StationName;
                            INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_NAME, SettingsVar.BindingPAName, Common.INI_FILE_PATH);
                        }
                        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/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>());
                            }
                        }
                        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
                },
                () => {
                    #region 更新课程数据
                    lblLoadItems.Text = _LoadItem = "更新课程数据";
                    isBreak           = false;
                    Application.DoEvents();
                    HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/LoadStationCourseList", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            Data.Courses = new List <CourseInfo>();
                            foreach (var row in ret.rows)
                            {
                                dynamic item = new ExpandoObject();
                                DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                                Data.Courses.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <CourseInfo>());
                            }

                            //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);
            });
        }