示例#1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (txtBoxUserName == false)
            {
                if (txtUserName.Text == "用户名/账号" || (txtUserName.Text == "" && txtUserName.Text == string.Empty))
                {
                    this.lblStarting.Text = "* 用户名不能为空!";
                    this.txtUserName.Focus();
                    return;
                }
            }

            if (txtBoxPassword == false)
            {
                if (txtPassword.Text == "  密码" || (txtPassword.Text == "" && txtPassword.Text == string.Empty))
                {
                    this.lblStarting.Text = "* 密码输入不能为空!";
                    this.txtPassword.Focus();
                    return;
                }
            }
            string password = EncryptionText.EncryptDES(txtPassword.Text, KeyManager.PWDKey);

            txtUserName.ReadOnly = true;
            txtPassword.ReadOnly = true;
            btnLogin.Enabled     = false;
            lblStarting.Text     = "登录中";
            overtime             = 0;
            timer1.Start();
            //progBarLogin.Visible = true;
            //progBarLogin.Value = 0;
            loginDic.Clear();
            loginDic.Add("UserLogin", new object[] { txtUserName.Text, password });
            SendInfoToService(loginDic);
        }
示例#2
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButLoging_Click(object sender, EventArgs e)
        {
            if (ComBoxAccount.Text == "用户名/账号" || (ComBoxAccount.Text == "" && ComBoxAccount.Text == string.Empty))
            {
                MessageBox.Show("账号不能为空!");
                this.ComBoxAccount.Focus();
                return;
            }

            if (TextPasswordValue.Text == "" && TextPasswordValue.Text == string.Empty)
            {
                MessageBox.Show("密码不能为空!");
                this.TextPasswordValue.Focus();
                return;
            }
            string account  = ComBoxAccount.Text;
            string password = EncryptionText.EncryptDES(TextPasswordValue.Text, KeyManager.PWDKey);
            ILogin loging   = new ILogin();
            string result   = loging.UserLogin("UserLogin", account, password);

            if (result == "登录成功!")
            {
                UserLoginInfo.SetUserLogInfo(loging.QueryUserAuthority("QueryUserAuthority", account));
                LoginSuccessEvent();
                this.Close();
                this.Dispose();
            }
        }
示例#3
0
        private void ButSave_Click(object sender, EventArgs e)
        {
            string OldPsw = EncryptionText.EncryptDES(TxtOldPassword.Text.Trim(), KeyManager.PWDKey);

            if (OldPsw != userInfo.UserPassword)
            {
                this.LabOldPswDisplay.Text      = "* 该密码与您之前使用的密码不一致!";
                this.LabOldPswDisplay.ForeColor = c;
                this.TxtOldPassword.Focus();
                return;
            }
            if (TxtPassword.Text.Trim().Length >= 23)
            {
                this.LabUserPassword.Text      = "* 新密码长度不能超过22位!";
                this.LabUserPassword.ForeColor = c;
                this.TxtPassword.Focus();
                return;
            }
            else if (TxtPassword.Text.Trim().Length < 6)
            {
                this.LabUserPassword.Text      = "* 新密码长度不能少于6位!";
                this.LabUserPassword.ForeColor = c;
                this.TxtPassword.Focus();
                return;
            }
            if (TxtAffirmPassword.Text.Trim() != TxtPassword.Text.Trim())
            {
                this.LabAffirmPassw.Text      = "* 密码不匹配,请新输入!";
                this.LabAffirmPassw.ForeColor = c;
                this.TxtAffirmPassword.Focus();
                return;
            }
            else
            {
                this.LabAffirmPassw.Text = "";
            }

            userInfo.UserID       = TxtAccount.Text.Trim();
            userInfo.UserName     = TxtName.Text.Trim();
            userInfo.UserPassword = EncryptionText.EncryptDES(TxtPassword.Text.Trim(), KeyManager.PWDKey);
            int iCount = new SystemUserManagement().IUpdateCommonUserInfo(userInfo);

            if (iCount > 0)
            {
                PassUserInfoEditEvent(userInfo);
                this.Invoke(new EventHandler(delegate
                {
                    UserLoginInfo.SetUserLogInfo(userInfo);
                    MessageBox.Show("用户修改成功!");
                    this.Close(); this.Dispose();
                }));
            }
            else
            {
                this.Invoke(new EventHandler(delegate { MessageBox.Show("用户修改失败!"); this.Close(); this.Dispose(); }));
            }
        }
示例#4
0
        /// <summary>
        /// 制作数据
        /// </summary>
        /// <param name="dataset"></param>
        void CreateDataFile(DataSet dataset)
        {
            if (dataset == null)
            {
                this.DisplayDataDakingTip.Add("数据对象为空\r\n");
            }

            string file = this.ExccelFile + ".data";

            if (File.Exists(file))
            {
                File.Delete(file);

                this.DisplayDataDakingTip.Add("删除.data文件...\r\n");
            }
            this.DisplayDataDakingTip.Add("生产.data文件...\r\n");

            this.WriteDataFile("delete from ReagentItemTb");

            string str1 = "insert ReagentItemTb(Code,ItemName,LongName,Unit,RadixPointNum,AnalyzeMethod,MainWaveLength,SubWaveLength,FirstPointS,FirstPointE,SecondPointS,SecondPointE,IncreaseVol,NormalVol,DecreaseVol,SDTVol,R1Vol,R2Vol,DoCount,SDTCount,QCSpace,ReacteDirect,LineSerumLimitMin,LineSerumLimitMax,ReagentAbsMin,ReagentAbsMax,SerumPanicLimitMin,SerumPanicLimitMax,Stiring1Force,Stiring2Force) values";

            if (dataset != null && dataset.Tables.Count > 0)
            {
                foreach (DataRow row in dataset.Tables[0].Rows)
                {
                    string v = null;
                    for (int i = 0; i < row.ItemArray.Count(); i++)
                    {
                        if (row[i] == null)
                        {
                            v += "'',";
                        }
                        else
                        {
                            v += string.Format("'{0}',", row[i].ToString().Trim());
                            if (i == 0)
                            {
                                this.DisplayDataDakingTip.Add(row[i].ToString().Trim() + "生产完成. \r\n");
                            }
                        }
                    }
                    v = v.TrimEnd(',');
                    v = "(" + v + ")";

                    string d = str1 + v;

                    d = EncryptionText.EncryptDES(d, KeyManager.DataKey);

                    this.WriteDataFile(d);
                }
            }

            this.DisplayDataDakingTip.Add("完成生产文件. ");
            this.memoEdit1.Lines = DisplayDataDakingTip.ToArray();
        }
示例#5
0
        /// <summary>
        /// 运行脚本导入的SQL数据
        /// </summary>
        void RunScriptImportSQLData()
        {
            mybatis = new MyBatis();
            StreamReader sr = new StreamReader(this.SQLFile);
            String       line;
            int          i = 0;

            sr = new StreamReader(this.SQLFile);
            while ((line = sr.ReadLine()) != null)
            {
                i++;
                line = EncryptionText.DecryptDES(line, KeyManager.DataKey);
                //new DBService().ExecSQL(line.Trim());
                mybatis.SaveReagentProjectParamInfo(line.Trim());
            }

            splashScreenManager1.CloseWaitForm();
        }
示例#6
0
        /// <summary>
        /// 获取用户新增、修改信息和权限
        /// </summary>
        /// <returns></returns>
        private UserInfo Add()
        {
            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = textEdit1.Text;
            userInfo.UserName = textEdit2.Text;
            if (textEdit3.Text == textEdit4.Text)
            {
                userInfo.UserPassword = EncryptionText.EncryptDES(textEdit3.Text, KeyManager.PWDKey);
            }
            else
            {
                return(null);
            }
            userInfo.IsSuperAdmin = false;
            if (chkApplyTask.Checked)
            {
                userInfo.ApplyTask = true;
            }
            else
            {
                userInfo.ApplyTask = false;
            }
            if (chkDataCheck.Checked)
            {
                userInfo.DataCheck = true;
            }
            else
            {
                userInfo.DataCheck = false;
            }
            if (chkMissionVerification.Checked)
            {
                userInfo.MissionVerification = true;
            }
            else
            {
                userInfo.MissionVerification = false;
            }
            if (chkReagentSetting.Checked)
            {
                userInfo.ReagentSetting = true;
            }
            else
            {
                userInfo.ReagentSetting = false;
            }
            if (chkReagentState.Checked)
            {
                userInfo.ReagentState = true;
            }
            else
            {
                userInfo.ReagentState = false;
            }
            if (chkCalibState.Checked)
            {
                userInfo.CalibState = true;
            }
            else
            {
                userInfo.CalibState = false;
            }
            if (chkCalibMaintain.Checked)
            {
                userInfo.CalibMaintain = true;
            }
            else
            {
                userInfo.CalibMaintain = false;
            }
            if (cheCalibVerification.Checked)
            {
                userInfo.CalibDataCheck = true;
            }
            else
            {
                userInfo.CalibDataCheck = false;
            }
            if (chkQCState.Checked)
            {
                userInfo.QCState = true;
            }
            else
            {
                userInfo.QCState = false;
            }
            if (chkQCMaintain.Checked)
            {
                userInfo.QCMaintain = true;
            }
            else
            {
                userInfo.QCMaintain = false;
            }
            if (chkChemistryParam.Checked)
            {
                userInfo.ChemistryParam = true;
            }
            else
            {
                userInfo.ChemistryParam = false;
            }
            if (chkCombProject.Checked)
            {
                userInfo.CombProject = true;
            }
            else
            {
                userInfo.CombProject = false;
            }
            if (chkCalcProject.Checked)
            {
                userInfo.CalcProject = true;
            }
            else
            {
                userInfo.CalcProject = false;
            }
            if (chkEnvironmentParam.Checked)
            {
                userInfo.EnvironmentParam = true;
            }
            else
            {
                userInfo.EnvironmentParam = false;
            }
            if (chkCrossPollute.Checked)
            {
                userInfo.CrossPollute = true;
            }
            else
            {
                userInfo.CrossPollute = false;
            }
            if (chkDataConfiguration.Checked)
            {
                userInfo.DataConfiguration = true;
            }
            else
            {
                userInfo.DataConfiguration = false;
            }
            if (chkLISCommunicate.Checked)
            {
                userInfo.LISCommunicate = true;
            }
            else
            {
                userInfo.LISCommunicate = false;
            }
            if (chkRouMaintain.Checked)
            {
                userInfo.RouMaintain = true;
            }
            else
            {
                userInfo.RouMaintain = false;
            }
            if (chkEquipDebug.Checked)
            {
                userInfo.EquipDebug = true;
            }
            else
            {
                userInfo.EquipDebug = false;
            }
            if (chkUserManage.Checked)
            {
                userInfo.UserManage = true;
            }
            else
            {
                userInfo.UserManage = false;
            }
            if (chkDepartManage.Checked)
            {
                userInfo.DepartManage = true;
            }
            else
            {
                userInfo.DepartManage = false;
            }
            if (chkConfiguration.Checked)
            {
                userInfo.Configuration = true;
            }
            else
            {
                userInfo.Configuration = false;
            }
            if (chkLogCheck.Checked)
            {
                userInfo.LogCheck = true;
            }
            else
            {
                userInfo.LogCheck = false;
            }
            if (chkVersionInfo.Checked)
            {
                userInfo.VersionInfo = true;
            }
            else
            {
                userInfo.VersionInfo = false;
            }
            if (CheckConfigurationScript.Checked)
            {
                userInfo.ConfigurationScript = true;
            }
            else
            {
                userInfo.ConfigurationScript = false;
            }
            return(userInfo);
        }
示例#7
0
        private void ButSave_Click(object sender, EventArgs e)
        {
            UserInfo u = userInfoList.SingleOrDefault(t => t.UserID == TxtAccount.Text.Trim());

            if (u != null)
            {
                if (u.UserID.Contains(TxtAccount.Text.Trim()))
                {
                    this.LabAccountPropmt.Text = "* 该账号已被使用,请重新输入!";
                    this.LabName.ForeColor     = c;
                    this.TxtAccount.Focus();
                    return;
                }
            }
            if (System.Text.Encoding.Default.GetBytes(TxtName.Text).Length < 2)
            {
                this.LabName.Text      = "* 账号名称长度不能小于4位!";
                this.LabName.ForeColor = c;
                this.TxtName.Focus();
                return;
            }
            if (System.Text.Encoding.Default.GetBytes(TxtName.Text).Length >= 15)
            {
                this.LabName.Text      = "* 账号名称长度不能超过14位!";
                this.LabName.ForeColor = c;
                this.TxtName.Focus();
                return;
            }
            if (System.Text.Encoding.Default.GetBytes(TxtAccount.Text.Trim()).Length < 4)
            {
                this.LabAccountPropmt.Text      = "* 账号长度不能小于4位!";
                this.LabAccountPropmt.ForeColor = c;
                this.TxtAccount.Focus();
                return;
            }
            if (TxtAccount.Text.Trim().Length >= 19)
            {
                this.LabAccountPropmt.Text      = "* 账号长度不能超过18位!";
                this.LabAccountPropmt.ForeColor = c;
                this.TxtAccount.Focus();
                return;
            }
            if (TxtPassword.Text.Trim().Length >= 23)
            {
                this.LabUserPassword.Text      = "* 密码长度不能超过22位!";
                this.LabUserPassword.ForeColor = c;
                this.TxtPassword.Focus();
                return;
            }
            else if (TxtPassword.Text.Trim().Length < 6)
            {
                this.LabUserPassword.Text      = "* 密码长度不能少于6位!";
                this.LabUserPassword.ForeColor = c;
                this.TxtPassword.Focus();
                return;
            }
            if (TxtAffirmPassword.Text.Trim() != TxtPassword.Text.Trim())
            {
                this.LabAffirmPassw.Text      = "* 密码不匹配,请新输入!";
                this.LabAffirmPassw.ForeColor = c;
                this.TxtAffirmPassword.Focus();
                return;
            }
            else
            {
                this.LabAffirmPassw.Text = "";
            }

            UserInfo userInfo = new UserInfo();

            userInfo.UserID       = TxtAccount.Text.Trim();
            userInfo.UserName     = TxtName.Text.Trim();
            userInfo.UserPassword = EncryptionText.EncryptDES(TxtPassword.Text.Trim(), KeyManager.PWDKey);
            int iCount = new SystemUserManagement().AddUserInfo("AddUserInfo", userInfo);

            if (iCount > 0)
            {
                PassUserInfoEvent(userInfo);
                this.Invoke(new EventHandler(delegate
                {
                    MessageBox.Show("用户创建成功!");
                    this.Close(); this.Dispose();
                }));
            }
            else
            {
                this.Invoke(new EventHandler(delegate { MessageBox.Show("用户创建失败!"); this.Close(); this.Dispose(); }));
            }
        }