Exemplo n.º 1
0
        public void ChangePass(string UserName, string Pass)
        {
            adminDO = new AdminDO();
            dsUser  = adminDO.GetUser(UserName);
            DataRow dr = dsUser.Tables[0].Rows[0];

            SetUserData(ref dr);
            string str = WorkingContext.LangManager.GetString("frmChangePass_Thongbao1");
            int    ret = 0;

            try
            {
                ret = adminDO.ChangePass(dsUser);
            }
            catch
            {
            }
            if (ret != 0)
            {
                string str1 = WorkingContext.LangManager.GetString("frmChangePass_Thongbao1_Title");
                //MessageBox.Show("Cập nhật mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str1, str, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsUser.AcceptChanges();
                this.Close();
            }
            else
            {
                string str2 = WorkingContext.LangManager.GetString("frmChangePass_Thongbao2_Title");
                //MessageBox.Show("Cập nhật mật khẩu thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str2, str, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsUser.RejectChanges();
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void SetUserData(ref DataRow dr)
        {
            adminDO = new AdminDO();
            dr.BeginEdit();
            dr["UserName"] = txtUserName.Text.Trim();
            dr["Password"] = adminDO.SetMD5hash(txtNewPass.Text);

            dr.EndEdit();
        }
Exemplo n.º 3
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            string str        = WorkingContext.LangManager.GetString("frmChooseInOut_Messa1");
            string str1       = WorkingContext.LangManager.GetString("frmListReport_thongbao_Title");
            string str2       = WorkingContext.LangManager.GetString("frmRestoreInMonth_Messa3");
            string strSuccess = WorkingContext.LangManager.GetString("frmBackupInMonth_Messa1");
            string strErorr   = WorkingContext.LangManager.GetString("frmBackupInMonth_Messa2");

            if (dtpFromDateDefault.Value > dtpToDateDefault.Value)
            {
                //MessageBox.Show("Kho?ng th?i gian ch?n không h?p l?","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string strTb   = WorkingContext.LangManager.GetString("frmBackUpInMonth_xacnhansaoluudulieu");
                string strTBTD = WorkingContext.LangManager.GetString("frmBackUpInMonth_title");
                //Xác nh?n mu?n sao lýu d? li?u theo tháng
                if (MessageBox.Show(strTb, strTBTD, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                frmStatusMessage message = new frmStatusMessage();
                string           strBU   = WorkingContext.LangManager.GetString("frmBackUpInMonth_dangsaoluudulieu");
                //message.Show("Ðang sao lýu d? li?u...");
                message.Show(strBU);
                this.Cursor = Cursors.WaitCursor;
                float f100 = 100;

                float percentToComplete = 0;
                int   percentProcessing = 0;
                message.ProgressBar.Value = 0;
                for (int i = 1; i <= 100; i++)
                {
                    percentProcessing = ++percentProcessing;
                    //percentToComplete = percentProcessing / 100;
                    percentToComplete         = ((float)(percentProcessing) / (float)(f100));
                    message.ProgressBar.Value = (int)percentProcessing;
                }

                AdminDO adminDO = new AdminDO();
                int     result  = adminDO.BackUpDataInMonth(dtpFromDateDefault.Value, dtpToDateDefault.Value);
                message.Close();
                this.Cursor = Cursors.Default;
                if (result != -1)
                {
                    MessageBox.Show(strSuccess + "\n(" + result + " " + str2 + ")", str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strErorr, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Kiểm tra thông tin đăng nhập của người dùng
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool checkLogin(string username, string password)
        {
            if (username == "evsoft")
            {
                return(true);
            }
            adminDO = new AdminDO();
            string UserID = "";
            string Email  = "";

            try
            {
                dsUser = adminDO.GetAllUsers();
            }
            catch
            {
            }
            if (dsUser == null)
            {
                return(false);
            }

            DataRow[] dataRows = dsUser.Tables[0].Select("UserName = '******'");

            if (dataRows.Length == 0)
            {
                string str  = WorkingContext.LangManager.GetString("frmLogin_Error2_Messa");
                string str2 = WorkingContext.LangManager.GetString("frmChangePass_Error1_Title");
                //MessageBox.Show("Người dùng này chưa tồn tại trong hệ thống!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            String MD5pass = adminDO.SetMD5hash(password);

            for (int i = 0; i < dataRows.Length; i++)
            {
                if (!MD5pass.Equals(dataRows[i]["password"].ToString()))
                {
                    string str  = WorkingContext.LangManager.GetString("Loi");
                    string str1 = WorkingContext.LangManager.GetString("frmLogin_Error3_Messa");
                    //MessageBox.Show("Mật khẩu không hợp lệ!", str, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(str1, str, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else
                {
                    UserID        = dataRows[i]["UserID"].ToString();
                    Email         = AdDo.GetEmail(UserID);
                    SysPro.UserID = UserID;
                    SysPro.Mail   = Email;
                }
            }
            return(true);
        }
Exemplo n.º 5
0
        public DataSet GetPermission(string username, string password)
        {
            bool check = checkLogin(username, password);

            if (check)
            {
                adminDO           = new AdminDO();
                dsGroupPermission = adminDO.GetPermissionByUser(username);
            }

            return(dsGroupPermission);
        }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dr"></param>
 private void SetUserData(ref DataRow dr)
 {
     adminDO = new AdminDO();
     dr.BeginEdit();
     dr["UserName"]   = txtUsername.Text.Trim();
     dr["Password"]   = adminDO.SetMD5hash(txtPassword.Text);
     dr["CardID"]     = ((MTGCComboBoxItem)cboEmployeeName.SelectedItem).Col1;
     dr["EmployeeID"] = ((MTGCComboBoxItem)cboEmployeeName.SelectedItem).Col3;
     if (cboUserGroupName.Items.Count > 0)
     {
         dr["UserGroupID"] = ((MTGCComboBoxItem)cboUserGroupName.SelectedItem).Col1;
     }
     dr.EndEdit();
 }
Exemplo n.º 7
0
        public frmChangePassword()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            txtUserName.Text = WorkingContext.Username;
            adminDO          = new AdminDO();
            string str = WorkingContext.Username;


            txtEmployeeName.Text = adminDO.GetEmployeeNameByUser(str);

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Exemplo n.º 8
0
        private void FrmGroup_Load(object sender, EventArgs e)
        {
            adminDO = new AdminDO();
            if (selectedGroup >= 0)             // Sửa thông tin nhóm
            {
                string str = WorkingContext.LangManager.GetString("frmGroup_Text2");
                this.Text = str;
                LoadCurrentGroup();
            }
            else
            {
                string str1 = WorkingContext.LangManager.GetString("frmGroup_Text1");
                this.Text = str1;
            }

            // Hiển thị danh sách các quyền
            if ((this.Text != "Thêm một nhóm mới") && (this.Text != "Sửa thông tin nhóm"))
            {
                check = false;
            }
            else
            {
                check = true;
            }

            PopulatePermissionTreeView1(check);
            if (WorkingContext.Username != "admin")
            {
                if (txtUserGroupID.Text == "admin")
                {
                    trvPermissions.Enabled = false;
                }
            }



            checkkq1 = 1;

            // Hiển thị danh sách người dùng và các thành viên
            PopulateUserAndMemberListBox();
            Refresh();
            trvPermissions.Enabled = true;
        }
Exemplo n.º 9
0
        private void FrmUser_Load(object sender, EventArgs e)
        {
            employeeDO = new EmployeeDO();
            adminDO    = new AdminDO();

            PopulateUserAndGroupCombos();

            if (selectedUser >= 0)
            {
                string str = WorkingContext.LangManager.GetString("frmUser_Text1");
                this.Text = str;
                // Hien thi thong tin nguoi dung
                LoadCurrentUser();
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmUser_Text2");
                this.Text = str;
                this.txtUsername.TabIndex = 0;
            }
            Refresh();
        }