Beispiel #1
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            User       objUser       = new User();
            UserBO     objUserBo     = new UserBO();
            UserDialog objUserDialog = new UserDialog();

            if (objUserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UserBO objUserBO = new UserBO();
                //if (objUserBO.IsUserExist(objUserDialog.UserName))
                //MessageBox.Show("UserName is Already Exist");
                objUserBo.InsertUser(objUserDialog.UserName, objUserDialog.Password, objUserDialog.FirstName, objUserDialog.Lastname, objUserDialog.EmailId, objUserDialog.PhoneNo, objUserDialog.IsActive);
                MessageBox.Show("Registred Sucessfully");
                Helper.Role = "Visitor";
            }
        }
Beispiel #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            UserDialog objUserDialog = new UserDialog();
            string     user          = "";

            if (dgvUser.RowCount != 0)
            {
                try
                {
                    int userId;
                    userId = Convert.ToInt32(dgvUser.SelectedRows[0].Cells[0].Value);
                    UserDialog dlgUser   = new UserDialog();
                    UserBO     objUserBO = new UserBO();
                    User       objUser   = objUserBO.GetUser(userId);
                    dlgUser.UserName  = objUser.UserName;
                    dlgUser.Password  = objUser.Password;
                    dlgUser.FirstName = objUser.FirstName;
                    dlgUser.Lastname  = objUser.LastName;
                    dlgUser.EmailId   = objUser.EmailId;
                    dlgUser.PhoneNo   = objUser.Password;
                    dlgUser.IsActive  = objUser.IsActive;
                    user = objUser.UserName;
                    if (dlgUser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        objUser.UserName  = dlgUser.UserName;
                        objUser.Password  = dlgUser.Password;
                        objUser.FirstName = dlgUser.FirstName;
                        objUser.LastName  = dlgUser.Lastname;
                        objUser.EmailId   = dlgUser.EmailId;
                        objUser.PhoneNo   = dlgUser.PhoneNo;
                        objUser.IsActive  = dlgUser.IsActive;
                        if (user == dlgUser.UserName)
                        {
                            objUserBO.UpdateUser(objUser);
                        }
                        objUserBO.UpdateUser(objUser);
                        BindDataToGrid();
                    }
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    MessageBox.Show("UserName AlreadyExist");
                }
            }
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            UserDialog dlgUser = new UserDialog();

            if (dlgUser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    User   objUser   = new User();
                    UserBO objUserBO = new UserBO();
                    objUserBO.InsertUser(dlgUser.UserName, dlgUser.Password, dlgUser.FirstName, dlgUser.Lastname, dlgUser.EmailId, dlgUser.PhoneNo, dlgUser.IsActive);
                    BindDataToGrid();
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    MessageBox.Show("UserName AlredyExist");
                }
            }
        }