Пример #1
0
        /// <summary>
        /// LookAndFeel_StyleChanged
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LookAndFeel_StyleChanged(object sender, EventArgs e)
        {
            if (GlobalParm.IsPopupOpening || this.IsLoadform || GlobalLogin.SkinName == Viewer.defaultLookAndFeel.LookAndFeel.SkinName)
            {
                return;
            }
            GlobalLogin.SkinName = Viewer.defaultLookAndFeel.LookAndFeel.SkinName;
            // 主题
            string skinName = Function.ReadLocalSettingValue("Main|skinName", "value");

            if (!string.IsNullOrEmpty(skinName))
            {
                Function.SetLocalSettingValue("Main|skinName", "value", GlobalLogin.SkinName);
            }
            else
            {
                EntityLocalSetting vo = new EntityLocalSetting();
                vo.EmpNo  = GlobalLogin.objLogin.EmpNo;
                vo.Type   = 3;
                vo.Parent = "Common";
                vo.Node   = "SkinName";
                vo.Value  = GlobalLogin.SkinName;
                ProxyFrame proxyFrame = new ProxyFrame();
                proxyFrame.Service.UpdateLocalSetting(vo);
            }
            if (Viewer.ActiveMdiChild != null && Viewer.ActiveMdiChild is frmBaseMdi)
            {
                ((frmBaseMdi)Viewer.ActiveMdiChild).SetNavBarStyleView();
            }
        }
Пример #2
0
        /// <summary>
        /// Delete
        /// </summary>
        internal void Delete()
        {
            EntitySysReport reportVo = Viewer.txtRptNo.Tag as EntitySysReport;

            if (reportVo == null || reportVo.rptId == 0)
            {
                return;
            }
            if (DialogBox.Msg("是否删除当前报表?", MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (ProxyFrame proxy = new ProxyFrame())
                {
                    int ret = proxy.Service.DeleteReport(reportVo.rptId);
                    if (ret > 0)
                    {
                        SetMainInfo(null);
                        Viewer.tvRport.Nodes.Remove(Viewer.tvRport.FocusedNode);
                        DialogBox.Msg("删除成功!");
                    }
                    else
                    {
                        DialogBox.Msg("删除失败。");
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// GetDataSource
        /// </summary>
        /// <returns></returns>
        DataTable GetDataSource()
        {
            string Sql = Viewer.txtSql.Text.Trim();

            if (string.IsNullOrEmpty(Sql))
            {
                return(new DataTable("数据源"));
            }
            using (ProxyFrame proxy = new ProxyFrame())
            {
                return(proxy.Service.GetRptDataTable(Sql));
            }
        }
Пример #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (CheckInfo())
     {
         int        intRet = 0;
         ProxyFrame proxy  = new ProxyFrame();
         intRet = proxy.Service.ChangePassword(txtEmpNo.Text.Trim(), txtOldPW.Text.Trim(), txtNewPW.Text.Trim());
         proxy.Dispose();
         if (intRet > 0)
         {
             DialogBox.Msg("修改密码成功", MessageBoxIcon.Information);
             this.DialogResult = DialogResult.OK;
         }
         else if (intRet == 0)
         {
             DialogBox.Msg("原密码有误", MessageBoxIcon.Information);
         }
         else
         {
             DialogBox.Msg("修改密码失败", MessageBoxIcon.Information);
         }
     }
 }
Пример #5
0
        /// <summary>
        /// Save
        /// </summary>
        internal bool Save()
        {
            if (isSave)
            {
                return(false);
            }
            isSave = true;
            try
            {
                bool            isNew    = false;
                EntitySysReport reportVo = null;
                if (Viewer.txtRptNo.Tag == null)
                {
                    reportVo            = new EntitySysReport();
                    reportVo.creatorId  = GlobalLogin.objLogin.EmpNo;
                    reportVo.createDate = Utils.ServerTime();
                    isNew = true;
                }
                else
                {
                    reportVo = Viewer.txtRptNo.Tag as EntitySysReport;
                }
                reportVo.rptNo   = Viewer.txtRptNo.Text.Trim();
                reportVo.rptName = Viewer.txtRptName.Text.Trim();
                reportVo.rptSql  = Viewer.txtSql.Text.Trim();

                if (string.IsNullOrEmpty(reportVo.rptNo))
                {
                    DialogBox.Msg("请输入报表编号。");
                    Viewer.txtRptNo.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(reportVo.rptName))
                {
                    DialogBox.Msg("请输入报表名称。");
                    Viewer.txtRptName.Focus();
                    return(false);
                }
                reportVo.pyCode = SpellCodeHelper.GetPyCode(reportVo.rptName);
                reportVo.wbCode = SpellCodeHelper.GetWbCode(reportVo.rptName);
                reportVo.type   = 1;
                reportVo.status = 1;

                using (ProxyFrame proxy = new ProxyFrame())
                {
                    if (proxy.Service.SaveReport(ref reportVo) > 0)
                    {
                        Viewer.txtRptNo.Tag = reportVo;
                        if (isNew)
                        {
                            (Viewer.tvRport.DataSource as List <EntitySysReport>).Add(reportVo);
                            Viewer.tvRport.RefreshDataSource();
                            Viewer.tvRport.FocusedNode = Viewer.tvRport.FindNodeByKeyID(reportVo.rptId);
                        }
                        else
                        {
                            int index = (Viewer.tvRport.DataSource as List <EntitySysReport>).FindIndex(t => t.rptId == reportVo.rptId);
                            (Viewer.tvRport.DataSource as List <EntitySysReport>)[index] = reportVo;
                            Viewer.tvRport.RefreshDataSource();
                        }
                        DialogBox.Msg("保存报表成功!");
                    }
                    else
                    {
                        DialogBox.Msg("保存报表失败。");
                    }
                }
                Viewer.ValueChanged = false;
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
                return(false);
            }
            finally
            {
                isSave = false;
            }
            return(true);
        }
Пример #6
0
        /// <summary>
        /// Verify
        /// </summary>
        /// <returns></returns>
        private bool Verify()
        {
            string accountNo = this.txtAccountNo.Text.Trim();
            string pwd       = this.txtPwd.Text;

            if (accountNo == string.Empty)
            {
                return(false);
            }
            if (lstAccount == null || lstAccount.Count == 0)
            {
                DialogBox.Msg("登录账号信息未配置,请联系管理员。", MessageBoxIcon.Information);
                return(false);
            }

            List <EntityAccount> acc   = lstAccount.FindAll(t => t.EmpNo == accountNo);
            ProxyLogin           proxy = new ProxyLogin();

            try
            {
                if (acc == null || acc.Count == 0)
                {
                    DialogBox.Msg("登录账号不存在,请重新输入。", MessageBoxIcon.Information);
                    this.txtAccountNo.Focus();
                    return(false);
                }
                GlobalAppConfig.AccountFuncs = acc;

                EntityLogin    dcLoginInfo    = null;
                EntityHospital dcHospitalInfo = null;
                proxy.Service.GetLoginInfo(accountNo, ref dcLoginInfo, ref dcHospitalInfo);

                if (dcLoginInfo != null)
                {
                    //本机信息
                    dcLoginInfo.IP       = Function.LocalIP();
                    dcLoginInfo.Mac      = Function.LocalMac();
                    dcLoginInfo.HostName = Function.LocalHostName();

                    GlobalLogin.objLogin       = dcLoginInfo;
                    GlobalHospital.objHospital = dcHospitalInfo;
                    string oriPwd = GlobalLogin.objLogin.Pwd;
                    if (pwd != string.Empty)
                    {
                        if (1 != 1)
                        {
                            oriPwd = (new clsSymmetricAlgorithm()).Decrypt(oriPwd, clsSymmetricAlgorithm.enmSymmetricAlgorithmType.DES);
                        }
                    }
                    if (pwd != oriPwd)      //GlobalLogin.objLogin.Pwd)
                    {
                        //if (CheckCAType())
                        //{
                        //    if (!HopeBridge.Common.Ca.CA.IDVerify(acc[0].SignDigital))
                        //    {
                        //        DialogBox.Msg("电子认证失败,请检查电子密钥KEY盘。");
                        //        return false;
                        //    }
                        //}
                        if (dcLoginInfo.AcctLock)
                        {
                            DialogBox.Msg("账户被锁定,请与管理员联系。", MessageBoxIcon.Information);
                            return(false);
                        }

                        this.ErrorNums++;
                        if (this.AllowErrorNums == this.ErrorNums)
                        {
                            ProxyFrame proxy1 = new ProxyFrame();
                            if (proxy1.Service.LockAccount(accountNo) > 0)
                            {
                                DialogBox.Msg("密码输入超过系统允许的最大错误次数(" + this.AllowErrorNums.ToString() + "次)\r\n\r\n系统将被锁定,请与管理员联系。", MessageBoxIcon.Information);
                                Application.Exit();
                                return(false);
                            }
                        }
                        this.txtPwd.Focus();
                        DialogBox.Msg("密码不正确,请重新输入。\r\n\r\n错误" + this.ErrorNums.ToString() + "次,剩余" + Convert.ToString((3 - this.ErrorNums)) + "次。");
                        return(false);
                    }

                    //if (dcLoginInfo.Pwd == GlobalAppConfig.INIT_PWD)
                    //{
                    //    DialogBox.Msg("使用系统前请先修改初始密码!", MessageBoxIcon.Information);

                    //    frmPassWord frmPwd = new frmPassWord(accountNo);
                    //    if (frmPwd.ShowDialog() != DialogResult.OK)
                    //    {
                    //        return false;
                    //    }
                    //}
                    //if (dcLoginInfo.PwdValidDays > 0 && dcLoginInfo.PwdUseDate != null)
                    //{
                    //    DateTime dtmNow = Utils.ServerTime();
                    //    TimeSpan ts = new TimeSpan(dcLoginInfo.PwdValidDays, 0, 0, 0);
                    //    if (dtmNow.Subtract(ts) >= dcLoginInfo.PwdUseDate)
                    //    {
                    //        DialogBox.Msg("密码超过系统默认的有效期(" + dcLoginInfo.PwdValidDays.ToString() + "天),请重设密码。");
                    //        frmPassWord frmPwd = new frmPassWord(accountNo);
                    //        if (frmPwd.ShowDialog() != DialogResult.OK)
                    //        {
                    //            return false;
                    //        }
                    //    }
                    //}
                    if (dcLoginInfo.EmpFlag == 1 || dcLoginInfo.EmpFlag == 3)
                    {
                        if (string.IsNullOrEmpty(dcLoginInfo.DeptCode) || dcLoginInfo.lstDept.Count == 0)
                        {
                            DialogBox.Msg("当前登录人没有默认科室,请联系管理员。");
                            return(false);
                        }
                    }
                    //if (dcLoginInfo.EmpFlag == 2)
                    //{
                    //    if (dcLoginInfo.AreaID <= 0 || dcLoginInfo.lstArea.Count == 0)
                    //    {
                    //        DialogBox.Msg("当前登录人没有默认病区,请联系管理员。");
                    //        return false;
                    //    }
                    //}

                    // 重新.加载本地参数
                    GlobalAppConfig.AppConfig = GetAppConfig(dcLoginInfo.EmpNo);
                    // 医院组织机构系统编码
                    //GlobalHospital.OrgSysCode = Function.LocalSettingValue("Login", "Hospital", "OrgSysCode");

                    // 主题
                    string skinName = Function.ReadLocalSettingValue("Main|skinName", "value");
                    if (string.IsNullOrEmpty(skinName))
                    {
                        EntityLocalSetting vo = new EntityLocalSetting();
                        vo.MachName = Function.LocalHostName();
                        vo.MacAddr  = Function.LocalMac();
                        vo.IpAddr   = Function.LocalIP();
                        vo.EmpNo    = dcLoginInfo.EmpNo;
                        vo.Parent   = "Common";
                        vo.Node     = "SkinName";
                        ProxyFrame proxyFrame = new ProxyFrame();
                        proxyFrame.Service.GetLocalSetting(ref vo);
                        skinName = vo.Value;
                    }
                    if (!string.IsNullOrEmpty(skinName))
                    {
                        GlobalLogin.SkinName = skinName;
                    }

                    // 写账号
                    WriteAccountNo();
                    return(true);
                }
            }
            finally
            {
                proxy = null;
            }
            return(false);
        }