Ejemplo n.º 1
0
        static void Main()
        {
            TaskBarAdapter.CheckCreated();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            PrepareAppEnvironment();
            string authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH);
            string smsEndPoint  = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH);

            DialogResult dr = DialogResult.OK;

            if (string.IsNullOrEmpty(authEndPoint) || string.IsNullOrEmpty(smsEndPoint))
            {
                frmSetting frmS = new frmSetting();
                frmS.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);
                });
                dr = frmS.ShowDialog();
            }
            if (dr == DialogResult.OK)
            {
                Application.Run(new frmMain());
            }
        }
Ejemplo n.º 2
0
        static void Main()
        {
            //TaskBarAdapter.CheckCreated();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            PrepareAppEnvironment();

            string remindType = INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, Common.INI_FILE_PATH);

            if (string.IsNullOrEmpty(remindType))
            {
                SettingsVar.CurrentRemindType = RemindType.提醒;
                INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, ((int)SettingsVar.CurrentRemindType).ToString(), Common.INI_FILE_PATH);
            }
            else
            {
                SettingsVar.CurrentRemindType = e0571.web.core.Utils.EnumAdapter.GetEnum <RemindType>(remindType);
            }
#if V2X
            SettingsVar.CurrentYYRemindFlag = INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_YYREMIND_FLAG, Common.INI_FILE_PATH) == "1" ? 1 : 0;
            INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_YYREMIND_FLAG, SettingsVar.CurrentYYRemindFlag.ToString(), Common.INI_FILE_PATH);

            frmLogin frm = new frmLogin();
            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                Application.Run(new frmMainV2X());
            }
#else
            //http://localhost/SmartLife.Auth.Merchant.Services/v1/AuthenticateMerchant
            string authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH);

            DialogResult dr = DialogResult.OK;
            if (string.IsNullOrEmpty(authEndPoint))
            {
                frmSettings frmS = new frmSettings();
                frmS.SectionWebSettingsSave += new dSectionWebSettingsSave((o, ce) =>
                {
                    INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH);
                });
                frmS.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);
                });
                dr = frmS.ShowDialog();
            }
            if (dr == DialogResult.OK)
            {
                frmLogin frm = new frmLogin();
                frm.ShowDialog();
                if (frm.DialogResult == DialogResult.OK)
                {
                    Application.Run(new frmMain());
                }
            }
#endif
        }
Ejemplo n.º 3
0
        private void DoLogin(string userName, string password)
        {
            //
            btnOk.Enabled = false;

            lblMsg.Text         = "登录中";
            _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.postAsyncAsJSON(authEndPoint + "/AuthenticateMerchant", new AuthMerchantParam {
                StationCode = userName, PasswordHash = MD5Provider.Generate(password)
            }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
            {
                //MessageBoxAdapter.ShowDebug(_MonitorId.ToString());
                //dynamic ret = new { Error = "", Success = false };
                //ret = JsonConvert.DeserializeObject(result);
                MerchantVar.Load(userName, ret.ret);

                if ((bool)ret.Success)
                {
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userName, Common.INI_FILE_PATH);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    lblMsg.Text = ret.ErrorMessage;

                    this.UIInvoke(() =>
                    {
                        btnOk.Enabled = true;
                    });
                }
                _tickTimer.Enabled = false;
                _tickTimer         = null;
            });
        }
Ejemplo n.º 4
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            lblProductName.Text           = Properties.Settings.Default.ProductName;
            lblProductVersionComment.Text = Properties.Settings.Default.ProductVersionComment;

            authEndPoint           = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH);
            authDataPoint          = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH);
            strUserNameSinceLast   = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, Common.INI_FILE_PATH);
            strObjectIdSinceLast   = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_ID_SINCE_LAST, Common.INI_FILE_PATH);
            strObjectNameSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_NAME_SINCE_LAST, Common.INI_FILE_PATH);
            strRunMode             = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH);
            string strDeployNodeObjects = INIAdapter.ReadValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, Common.INI_FILE_PATH);

            if (strDeployNodeObjects == "")
            {
                btnOk.Enabled = false;

                //远程获取deployNodeObjects
                ThreadAdapter.DoOnceTask(() =>
                {
                    HttpAdapter.getSyncTo(authDataPoint + "/GetDeployNodeObjects", (ret, res) =>
                    {
                        if ((bool)ret.Success)
                        {
                            strDeployNodeObjects = JsonConvert.SerializeObject(ret.rows);
                            INIAdapter.WriteValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, strDeployNodeObjects, Common.INI_FILE_PATH);
                            this.UIInvoke(() =>
                            {
                                btnOk.Enabled = true;
                            });
                            BindDeployNodeObjects(strDeployNodeObjects);
                        }
                        else
                        {
                            this.UIInvoke(() =>
                            {
                                btnOk.Enabled = true;
                            });
                        }
                    });
                });
            }
            else
            {
                BindDeployNodeObjects(strDeployNodeObjects);
            }

            if (strRunMode == "")
            {
                strRunMode = "0";
            }
            if (!string.IsNullOrEmpty(strUserNameSinceLast))
            {
                txtUserName.Text = strUserNameSinceLast;
            }
        }
Ejemplo n.º 5
0
        private void llblSettings_Click(object sender, EventArgs e)
        {
            frmSettings settings = new frmSettings();

            settings.SectionBizSettingsSave += new dSectionBizSettingsSave((co, ce) =>
            {
                INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, ((int)ce.Type).ToString(), Common.INI_FILE_PATH);
                INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_YYREMIND_FLAG, ce.YYRemindFlag.ToString(), Common.INI_FILE_PATH);
            });
            settings.ShowDialog();
        }
Ejemplo n.º 6
0
        static void PrepareAppEnvironment()
        {
            Assembly assem = Assembly.GetExecutingAssembly();

            log4net.Config.XmlConfigurator.Configure(assem.GetManifestResourceStream("SmartLife.Client.PensionAgency.Order.log4net.config"));
            SettingsVar.BindingPACode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, Common.INI_FILE_PATH);
            SettingsVar.RunMode       = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH);
            if (SettingsVar.RunMode == "")
            {
                SettingsVar.RunMode = "0";
                INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, SettingsVar.RunMode, Common.INI_FILE_PATH);
            }
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        static void PrepareAppEnvironment()
        {
            Assembly assem = Assembly.GetExecutingAssembly();

            log4net.Config.XmlConfigurator.Configure(assem.GetManifestResourceStream("SmartLife.Client.PensionAgency.SelfService.log4net.config"));
            SettingsVar.BindingPACode     = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, Common.INI_FILE_PATH);
            SettingsVar.BindingPAName     = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_NAME, Common.INI_FILE_PATH);
            SettingsVar.DataExchangePoint = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_DATA_EXCHANGE_POINT, Common.INI_FILE_PATH);
            SettingsVar.RunMode           = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH);
            if (SettingsVar.RunMode == "")
            {
                SettingsVar.RunMode = "0";
                INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, SettingsVar.RunMode, Common.INI_FILE_PATH);
            }

            Common.MachineKey = ZPCrypto.GetMachineKey(MachineHardwareType.CPU | MachineHardwareType.HARDDISK | MachineHardwareType.MAINBOARD);
        }
Ejemplo n.º 9
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();
                }
            }
        }
Ejemplo n.º 10
0
        private void InitActions()
        {
            pbdActions.AddDropDownItemAndHandle("全屏", (o, fe) =>
            {
                pnlHead.Visible   = false;
                pnlLeft.Visible   = false;
                pnlRight.Visible  = false;
                pnlTop.Visible    = false;
                pnlBottom.Visible = false;

                fullScreenWB        = xTabs.SelectedTab.Controls[0] as WebBrowser;
                fullScreenWB.Parent = this;
                fullScreenWB.Size   = this.Size;
                fullScreenWB.Url    = fullScreenWB.Url;
                fullScreenWB.BringToFront();
            });
            pbdActions.AddDropDownItemAndHandle("设置", (o, se) =>
            {
                frmSettings settings = new frmSettings();
                settings.ShowDialog();
            });


            pbdActions.AddDropDownItemAndHandle(new ToolStripMenuItem {
                Text = "辅助工具栏", CheckState = assistToolbarState
            }, (o, te) =>
            {
                ToolStripMenuItem clickedItem = ((te as ToolStripItemClickedEventArgs).ClickedItem as ToolStripMenuItem);
                if (clickedItem.CheckState == CheckState.Checked)
                {
                    clickedItem.CheckState = CheckState.Unchecked;
                }
                else
                {
                    clickedItem.CheckState = CheckState.Checked;
                }
                assistToolbarState = clickedItem.CheckState;
                INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_ASSIST_TOOLBAR_FLAG, assistToolbarState.ToString(), Common.INI_FILE_PATH);

                pnlAssistToolbarContainer.Visible = assistToolbarState == CheckState.Checked;
            });
        }
Ejemplo n.º 11
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();
                }
            }
        }
Ejemplo n.º 12
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());
                    }
                });
            });
        }
Ejemplo n.º 13
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);
            });
        }
Ejemplo n.º 14
0
        private void DoLogin(string userCode, string password)
        {
            //
            btnOk.Enabled = false;

            lblMsg.Text         = "登录中";
            _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事件;

            byte     runMode         = byte.Parse(strRunMode); //测试1 正式0
            string   objectId        = null;
            string   objectName      = null;
            TreeNode theSelectedNode = ctvObjectNodes.TreeView.SelectedNode;

            if (theSelectedNode != null && theSelectedNode.Name != "default")
            {
                objectId   = theSelectedNode.Name;
                objectName = theSelectedNode.Text;
            }
            else
            {
                objectName = "自动";
            }



            HttpAdapter.postAsyncAsJSON(authEndPoint, new { RunMode = runMode, ObjectId = objectId, UserCode = userCode, PasswordHash = MD5Provider.Generate(password) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) =>
            {
                if ((bool)ret.Success)
                {
                    PensionAgencyVar.UserCode = userCode;
                    PensionAgencyVar.Password = password;
                    PensionAgencyVar.Load(ret.ret);
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userCode, Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_ID_SINCE_LAST, (objectId ?? "default"), Common.INI_FILE_PATH);
                    INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_NAME_SINCE_LAST, objectName, Common.INI_FILE_PATH);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    lblMsg.Text = ret.ErrorMessage;

                    this.UIInvoke(() =>
                    {
                        btnOk.Enabled = true;
                    });
                }
                _tickTimer.Enabled = false;
                _tickTimer         = null;
            });
        }
Ejemplo n.º 15
0
 private void pnlAssistToolbarTitle_MouseUp(object sender, MouseEventArgs e)
 {
     INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_ASSIST_TOOLBAR_POSITION_LAST, pnlAssistToolbarContainer.Location.X.ToString() + "," + pnlAssistToolbarContainer.Location.Y.ToString(), Common.INI_FILE_PATH);
 }
Ejemplo n.º 16
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);
            });
        }
Ejemplo n.º 17
0
        public Welcome(bool CheckUpdate)
        {
            //2012-09-03 LiuQi 启动时检查是否有word进程
            Process[] process;
            process = Process.GetProcesses();
            foreach (Process p in process)
            {
                try
                {
                    if (p.Id != 0 && p.Modules != null && p.Modules.Count > 0)
                    {
                        System.Diagnostics.ProcessModule pm = p.Modules[0];
                        if (pm.ModuleName.ToLower() == "winword.exe")
                        {
                            MessageBox.Show("其他程序影响电子病历正常使用须关闭!", "提示");
                            p.Kill();
                            break;
                        }
                    }
                }
                catch { }
            }
            InitializeComponent();
            //开始日志
            udt.jj.LoadlogAdapter();

            if (ini.ReadValue("System", "CheckClient").Trim() == true.ToString())
            {
                CheckClient();
            }

            try
            {
                tLoadData   = new Thread(LoadData);
                tShowStatus = new Thread(ShowStatus);
                if (ini.ReadValue("System", "LiveUpdate").Trim() == true.ToString())
                {
                    try
                    {
                        pUpdate.StartInfo.FileName  = Application.StartupPath + "\\liveupdate.exe";
                        pUpdate.StartInfo.Arguments = "-liveupdate[" + FileMethod.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) + "]";
                        pUpdate.Start();
                    }
                    catch (Win32Exception)
                    {
                        ini.WriteValue("System", "LiveUpdate", false.ToString());
                        MessageBox.Show(this, "启动自动更新程序失败,自动更新功能已关闭,若要重新开启此功能请联系系统管理员或重新安装。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                    }
                }
                else
                {
                }

                ThisAddIn.logon = new Logon();
            }
            catch (Exception ex)
            {
                Globals.logAdapter.Record("EX756987457748", ex.Message + ">>" + ex.ToString(), true);

                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 18
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);
            });
        }