Exemple #1
0
        private void Login()
        {
            int    UserID   = 0;
            string UserName = "";
            int    ShiftID  = 0;
            string Err      = "";

            try
            {
                if (TextUtils.CashierLogin(txtCashierNo.Text, txtPass.Text, ref UserID, ref ShiftID, ref Err) == true)
                {
                    UsersModel mU = ((UsersModel)UsersBO.Instance.FindByPK(UserID));
                    Global.ShiftID     = ShiftID;
                    Global.UserID      = UserID;
                    Global.AppFullName = txtCashierNo.Text;
                    Global.AppFullName = mU.FirstName + " " + mU.MiddleName + " " + mU.LastName;
                    Global.CashierNo   = mU.CashierNo.ToString();
                    DataTable dtRoot = TextUtils.Select("select KeyValue from ConfigSystem where KeyName='_ROOT_USER'");
                    if (dtRoot.Rows.Count == 0)
                    {
                        Global.IsRoot = false;
                    }
                    else
                    {
                        if (dtRoot.Rows[0][0].ToString().Trim().ToUpper() == Global.AppUserName.ToUpper())
                        {
                            Global.IsRoot = true;
                        }
                        else
                        {
                            Global.IsRoot = false;
                        }
                    }
                    IsProcess = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng !", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thống báo");
                //frmGenMessageBox frm = new frmGenMessageBox("KienNT", this.Name, "btnLogin_Click", TextUtils.Caption,
                //                                             MessageLibrary._SystemMessage, ex.Message, MessageBoxIcon.Error);
                //frm.ShowDialog();
                return;
            }
        }