示例#1
0
 /// <summary>
 /// Auteur : Alexandre Pouliot
 /// Description : Allows the creation of a new user.
 /// Date : 2019/10/27
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mnuCreateNewUser_Click(object sender, EventArgs e)
 {
     using (frmCreateUser createUser = new frmCreateUser())
     {
         createUser.ShowDialog();
     }
 }
示例#2
0
        private void menuItem3_Click(object sender, EventArgs e)
        {
            //Create user...
            frmCreateUser f = new frmCreateUser();

            f.ShowDialog();
        }
示例#3
0
        private void frmLogin_Activated(object sender, EventArgs e)
        {
            try
            {
                if (blnBeenHere == true)
                {
                    return;
                }

                blnBeenHere = true;

                if (DB.CoreUsers.Count() <= 0)
                {
                    MessageBox.Show("Currently there is no user created. You need to create a user to login into the application.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    frmCreateUser createUserForm = new frmCreateUser();
                    this.Hide();
                    createUserForm.ShowDialog();
                    blnBeenHere = false;
                    this.Show();
                }
                else
                {
                    txtUsername.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Login Problem", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#4
0
        private void btnCreateUser_Click(object sender, EventArgs e)
        {
            frmCreateUser frm = frmCreateUser.GetRequest();

            frm.Show();
            this.Visible = false;
        }
示例#5
0
 private void toolStripMenuItem3_Click(object sender, EventArgs e)
 {
     try
     {
         frmCreateUser frm  = new frmCreateUser();
         frmCreateUser open = Application.OpenForms[" frmCreateUser "] as frmCreateUser;
         if (open == null)
         {
             frm.MdiParent = this;
             frm.Show();
         }
         else
         {
             open.Activate();
             if (open.WindowState == FormWindowState.Minimized)
             {
                 open.WindowState = FormWindowState.Normal;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#6
0
        private void btnVendorSettings_Click(object sender, EventArgs e)
        {
            if (_frmCreateUser == null || _frmCreateUser.IsDisposed)
            {
                _frmCreateUser           = new frmCreateUser();
                _frmCreateUser.MdiParent = this;
            }

            _frmCreateUser.Show();
            _frmCreateUser.BringToFront();
        }
示例#7
0
        //modify User


        private void addNewUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_frmCreateUser == null || _frmCreateUser.IsDisposed)
            {
                _frmCreateUser           = new frmCreateUser();
                _frmCreateUser.MdiParent = this;
            }

            _frmCreateUser.Show();
            _frmCreateUser.BringToFront();
        }
示例#8
0
 private void createUser_Click(object sender, EventArgs e)
 {
     try
     {
         frmCreateUser frmCrtUsr = new frmCreateUser(dbl); //Create frmCreateUser object and send a datalayer object
         frmCrtUsr.Show();
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#9
0
 private void createUser_Click(object sender, EventArgs e)
 {
     try
     {
         frmCreateUser frmCrtUsr = new frmCreateUser(dbl); //Create frmCreateUser object and send a datalayer object
         frmCrtUsr.Show();
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#10
0
 /// <summary>
 /// Function to call this form from frmUserCreation to view details and for updation
 /// </summary>
 /// <param name="frmUserCreation"></param>
 public void CallfrmCreateUser(frmCreateUser frmUserCreation)
 {
     try
     {
         dgvRole.Enabled         = false;
         this.frmUserCreationobj = frmUserCreation;
         base.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#11
0
 private void button4_Click(object sender, EventArgs e)
 {
     frmCreateUser frmCrtUsr = new frmCreateUser(dbl);
     frmCrtUsr.Show();
 }
示例#12
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                txtUsername.Focus();
                MessageBox.Show("Please enter Username.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                txtPassword.Focus();
                MessageBox.Show("Please enter Password.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["LicenseExpiry"]))
            {
                if (DateTime.Today > DateTime.Parse(ConfigurationManager.AppSettings["LicenseExpiry"].ToString()))
                {
                    MessageBox.Show("Software License Expired, Please contact software administrator.");
                    return;
                }
            }

            this.btnLogin.Enabled  = false;
            this.btnCancel.Enabled = false;
            this.Cursor            = System.Windows.Forms.Cursors.WaitCursor;

            string username = txtUsername.Text.ToUpper();

            CoreUser coreUser = DB.CoreUsers.Where(cu => cu.UserName.ToUpper() == txtUsername.Text.ToUpper() && cu.UserPassword == txtPassword.Text).FirstOrDefault();

            if (coreUser != null)
            {
                GlobalClass.LoggedInUserID = coreUser.CoreUserID;
                GlobalClass.EmployeeName   = coreUser.FirstName + " " + coreUser.LastName;

                NSGEmployee nsgEmp = DB.NSGEmployees.Where(em => em.NSGEmployeeCode == coreUser.EmployeeID).FirstOrDefault();

                if (coreUser.UserName.ToUpper() == "NSGADMIN")
                {
                    if (MessageBox.Show("Do you want to create user?", "Login", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        frmCreateUser createUserForm = new frmCreateUser();
                        this.Hide();
                        createUserForm.ShowDialog();
                        this.txtPassword.Text  = string.Empty;
                        this.txtUsername.Text  = string.Empty;
                        this.btnLogin.Enabled  = true;
                        this.btnCancel.Enabled = true;
                        this.txtUsername.Focus();
                        this.Cursor = System.Windows.Forms.Cursors.Default;
                        this.Show();
                    }
                    else
                    {
                        //GlobalClass.LoggedInUserRank = DB.CoreRanks.Where(cr => cr.RankID == nsgEmp.RankID).FirstOrDefault().RankName;
                        //GlobalClass.LoggedInUserUnit = DB.CoreUnits.Where(cu => cu.UnitID == nsgEmp.UnitID).FirstOrDefault().UnitName;

                        this.btnLogin.Enabled  = true;
                        this.btnCancel.Enabled = true;
                        this.Cursor            = System.Windows.Forms.Cursors.Default;
                        this.Hide();
                        frmMainPage frmMainPage = new frmMainPage();
                        frmMainPage.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    GlobalClass.LoggedInUserRank = DB.CoreRanks.Where(cr => cr.RankID == nsgEmp.RankID).FirstOrDefault().RankName;
                    GlobalClass.LoggedInUserUnit = DB.CoreUnits.Where(cu => cu.UnitID == nsgEmp.UnitID).FirstOrDefault().UnitName;

                    this.btnLogin.Enabled  = true;
                    this.btnCancel.Enabled = true;
                    this.Cursor            = System.Windows.Forms.Cursors.Default;
                    this.Hide();
                    frmMainPage frmMainPage = new frmMainPage();
                    frmMainPage.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Invalid username or password!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Text = string.Empty;
                txtUsername.Text = string.Empty;
                txtUsername.Focus();
                this.btnLogin.Enabled  = true;
                this.btnCancel.Enabled = true;
                this.Cursor            = System.Windows.Forms.Cursors.Default;
                return;
            }
        }
示例#13
0
        private void button4_Click(object sender, EventArgs e)
        {
            frmCreateUser frmCrtUsr = new frmCreateUser(dbl);

            frmCrtUsr.Show();
        }
示例#14
0
 public frmSearchEmployee(string searchvalue, frmCreateUser createUser)
 {
     InitializeComponent();
     CreateUser = createUser;
     FillGrid(searchvalue);
 }
示例#15
0
        private void newUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCreateUser user = new frmCreateUser();

            user.ShowDialog();
        }