Exemple #1
0
        private bool CheckPassword(string Password)
        {
            string strWrongPass = "******";

            if (Static.Encrypt(Password) == _remote.User.UserPassword)
            {
                return(true);
            }
            MessageBox.Show(strWrongPass, _AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            return(false);
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateFields() == true)
            {
                #region [ Нууц үг солих]
                string   OldPass;
                string   NewPass;
                object[] M = new object[5];

                Result res = new Result();


                OldPass = Static.Encrypt(txtOldPass.Text);
                NewPass = Static.Encrypt(txtNewPass.Text);
                M[0]    = moUser.UserNo;
                M[1]    = OldPass;
                M[2]    = NewPass;
                M[3]    = txtNewPass.Text.Length;
                M[4]    = Count;
                try
                {
                    res = moConnection.Call(moUser.UserNo, 101, 110002, 110002, M);

                    if (res.ResultNo == 0)
                    {
                        moUser.UserPassword = NewPass;

                        MessageBox.Show("Нууц үгийг амжилттай солилоо",
                                        "", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(res.ResultDesc, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.DialogResult = DialogResult.Cancel;
                }

                #endregion
            }
        }
Exemple #3
0
        }    //Борлуулалтын мэдээлэл хайх

        public Result Txn606005(ClientInfo ci, RequestInfo ri, DbConnections db, ref Log lg)
        {
            Result res = new Result();

            try
            {
                #region Prepare parameter

                int    userno = Static.ToInt(ri.ReceivedParam[0]);
                string pwd    = Static.Encrypt(Static.ToStr(ri.ReceivedParam[1]));

                #endregion
                #region Execute
                string sql = @"select userno
,decode(userfname,null,userlname,substr(userfname,0,1)||'.'||userlname) username
,upassword from hpuser where userno=:1 and upassword=:2";
                res = db.ExecuteQuery("core", sql, enumCommandType.SELECT, "Txn606005", userno, pwd);
                if (res != null && res.ResultNo != 0)
                {
                    goto OnExit;
                }
                if (res.AffectedRows <= 0)
                {
                    res = new Result(1000, "Хэрэглэгчийн нэр эсвэл нууц үг буруу байна.");
                }

                #endregion
            }
            catch (Exception ex)
            {
                res = new Result(9110002, "Програм руу нэвтрэхэд алдаа гарлаа" + ex.Message);
            }
            finally
            {
                lg.item.Desc = "Түрээсийн ажилтан системд нэвтрэх";
            }
OnExit:
            return(res);
        }    //Түрээсийн ажилтан нэвтрэх
Exemple #4
0
        private bool ValidateFields()
        {
            if (moUser.UserPassword != Static.Encrypt(txtOldPass.Text))
            {
                MessageBox.Show("Хуучин нууц үг бүруу байна .", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (txtOldPass.Text.Length == 0)
            {
                return(false);
            }
            if (txtNewPass.Text.Length == 0)
            {
                return(false);
            }
            if (txtNewPassAgain.Text.Length == 0)
            {
                return(false);
            }

            if (txtNewPass.Text != txtNewPassAgain.Text)
            {
                MessageBox.Show("Шинэ нууц үг ижил биш байна.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            else
            {
                if (txtNewPass.Text.Length == 0)
                {
                    MessageBox.Show("Шинэ нууц үг оруулна уу.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
            }

            return(true);
        }
Exemple #5
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            Result res = null;

            #region Validation

            int    userno  = Static.ToInt(numUserNo.EditValue);
            string userpwd = Static.ToStr(txtPass.EditValue);

            if (userno == 0)
            {
                res = new Result(1000, "Хэрэглэгчийн дугаар буруу байна.");
                goto OnExit;
            }
            if (userpwd == "")
            {
                res = new Result(1001, "Хэрэглэгчийн нууц үг буруу байна.");
                goto OnExit;
            }

            #endregion

            #region Кэйшлэсэн мэдээллээс хайх

            string[] data = (string[])_hash[userno];
            if (data != null)
            {
                if (data[1] != Static.Encrypt(userpwd))
                {
                    res = new Result(1001, "Хэрэглэгчийн нууц үг буруу байна.");
                    goto OnExit;
                }
                _username         = data[0];
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
                return;
            }

            #endregion

            #region Нэвтрэх хүсэлт илгээх

            object[] param = new object[] { numUserNo.EditValue, txtPass.EditValue };
            res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 606, 606005, 110000, param);
            if (res != null && res.ResultNo != 0)
            {
                goto OnExit;
            }

            #endregion
            #region Хэрэглэгчийн мэдээлийг хадгалах
            DataTable dt = res.Data.Tables[0];
            _username = Static.ToStr(dt.Rows[0]["USERNAME"]);
            _userno   = Static.ToInt(numUserNo.EditValue);
            #endregion
            #region Нэвтэрсэн нууц үгийг кэйшлэх

            string pwd = Static.ToStr(dt.Rows[0]["UPASSWORD"]);
            _hash[_userno] = new string[] { _username, pwd };

            #endregion

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();

OnExit:
            ISM.Template.FormUtility.ValidateQuery(res);
        }
Exemple #6
0
        void EventSave(bool isnew, ref bool cancel)
        {
            _userno = Static.ToInt(numUserNo.Text);
            res     = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 203, 110113, 110113, null);
            try
            {
                if (res.ResultNo == 0)
                {
                    _dr       = res.Data.Tables[0].Rows[0];
                    creattype = Static.ToInt(_dr["CREATETYPE"]);
                }
                if (_userno != 0)
                {
                    if (Validate())
                    {
                        //string enpass = Static.ToStr(Static.Encrypt(txtPassword.Text));
                        obj[0] = Static.ToInt(numUserNo.EditValue); // UserNo
                        obj[1] = txtUserFName.Text.Trim();          //UserFname
                        obj[2] = txtUserLName.Text.Trim();          //UserLname
                        obj[3] = txtUserFName2.Text.Trim();         //UserFname2
                        obj[4] = txtUserLName2.Text.Trim();         //UserLname2
                        obj[5] = txtRegister.Text;                  //RegisterNo
                        obj[6] = txtPosition.Text;                  //Position
                        obj[7] = (chkStatus.Checked ? 0 : 9);       //Status
                        obj[8] = Static.ToInt(cboBranch.EditValue); //BranchNo
                        obj[9] = Static.ToInt(cboLevel.EditValue);  //UserLevel
                        if (Static.ToStr(txtPassword.EditValue) == _upassword && creattype == 0)
                        {
                            obj[10] = Static.ToStr(txtPassword.EditValue); //UPassword
                        }
                        else
                        {
                            obj[10] = Static.Encrypt(Static.ToStr(txtPassword.Text)); //UPassword
                        }
                        obj[11] = Static.ToInt(cboUserType.EditValue);                //UserType
                        obj[12] = Static.ToStr(txtEMail.Text);                        //Email
                        obj[13] = txtMobile.Text;                                     //Mobile
                        obj[14] = Static.ToInt(cboLogintype.EditValue);               //Logintype
                        obj[15] = 0;
                        obj[16] = Static.ToDate(_core.TxnDate);                       //Change Pass Date
                        obj[17] = Static.ToInt(cboAgentCorp.EditValue);
                        obj[18] = Static.ToInt(cboAgentBranch.EditValue);
                        if (gvwPriv.DataSource == null)
                        {
                            obj[19] = null;
                        }

                        else
                        {
                            DataTable dtPriv = (DataTable)grdPriv.DataSource;
                            obj[19] = dtPriv;
                        }
                        if (grdSupervisor.DataSource == null)
                        {
                            obj[20] = null;
                        }
                        else
                        {
                            DataTable dtSupervisor = (DataTable)grdSupervisor.DataSource;
                            dtSupervisor.AcceptChanges();
                            obj[20] = dtSupervisor;
                        }
                        fieldValue[0]  = "UserNo";
                        fieldValue[1]  = "UserFname";
                        fieldValue[2]  = "UserLname";
                        fieldValue[3]  = "UserFname2";
                        fieldValue[4]  = "UserLname2";
                        fieldValue[5]  = "RegisterNo";
                        fieldValue[6]  = "Position";
                        fieldValue[7]  = "Status";
                        fieldValue[8]  = "BranchNo";
                        fieldValue[9]  = "ulevel";
                        fieldValue[10] = "UPASSWORD";
                        fieldValue[11] = "UserType";
                        fieldValue[12] = "Email";
                        fieldValue[13] = "Mobile";
                        fieldValue[14] = "LoginType";
                        fieldValue[15] = "WRONGCOUNT";
                        fieldValue[16] = "PASSCHDATE";
                        //fieldValue[17] = "AGENTCORP";
                        //fieldValue[18] = "AGENTBRANCH";

                        object[] msgs = new object[3];
                        msgs[0] = msg;

                        object[] upassword = new object[1];
                        upassword[0] = txtPassword.EditValue;
                        object[] olpassvalue = new object[1];
                        olpassvalue[0] = txtPassword.OldEditValue;

                        if (isnew)
                        {
                            res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 203, 110102, 110102, new object[] { obj, fieldValue, upassword });
                            msg = "Амжилттай нэмлээ";
                        }
                        else
                        {
                            res = _core.RemoteObject.Connection.Call(_core.RemoteObject.User.UserNo, 203, 110104, 110104, new object[] { obj, fieldValue, oldValue, olpassvalue, upassword, _userno });
                            if (res.ResultNo == 0)
                            {
                                msg = "Амжилттай засварлалаа";
                            }
                            else
                            {
                                MessageBox.Show(res.ResultNo + " " + res.ResultDesc);
                            }
                        }
                        if (res.ResultNo == 0)
                        {
                            ucUserProp.FieldLinkSetEditState();
                            RefreshData(_userno);
                            MessageBox.Show(msg);
                        }
                        else
                        {
                            MessageBox.Show(Static.ToStr(res.ResultNo) + " " + res.ResultDesc);
                            cancel = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(string.Format("{0} бүлгийн хүчинтэй хугацаа оруулгаагүй байна.", errorname));
                    }
                }
            }
            catch (Exception ex)
            {
                cancel = true;
                MessageBox.Show(ex.Message);
            }
        }