Example #1
0
        protected void btnSaveLogin_Click(object sender, EventArgs e)
        {
            if (!validateSaveLogin())
            {
                UpdatePanelStaff.Update();
                return;
            }


            try
            {
                User us = new User();
                txtPass.Text   = "";
                us.Password    = txtPassword.Text;
                us.UserName    = txtUserName.Text;
                us.LastModify  = DateTime.Now;
                us.DateCreated = DateTime.Now;
                us.UserId      = cmbStaffs.Value.ToString();
                us.UserType    = "Parent";

                if (new UserService().AddUser(us, new SessionManager().GetUserId(this.Session)))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Saved Successfully','Message')", true);
                    divLogin.Visible = false;
                }
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Oops! Something is not right','Message')", true);
            }

            loadAllUserStaff();
            UpdatePanelStaff.Update();
        }
Example #2
0
 protected void btnCancelLogin_Click(object sender, EventArgs e)
 {
     divLogin.Visible  = false;
     btnActive.Visible = false;
     btnReset.Visible  = false;
     UpdatePanelStaff.Update();
 }
Example #3
0
        protected void mMain_ItemClick(object source, DevExpress.Web.MenuItemEventArgs e)
        {
            if (e.Item.Name == "mitNew")
            {
                divLogin.Visible = true;
            }

            UpdatePanelStaff.Update();
        }
Example #4
0
        protected void btnActive_Click(object sender, EventArgs e)
        {
            if (cmbStaffs.Value != null)
            {
                if (new UserService().ActivateUser(int.Parse(txtActive.Text), cmbStaffs.Value.ToString(), new SessionManager().GetUserId(this.Session)))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('" + btnActive.Text + " Successfully','Message')", true);
                }
            }

            loadAllUserStaff();
            UpdatePanelStaff.Update();
        }
Example #5
0
        protected void gvStaff_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
        {
            gvStaff.CancelEdit();
            User u = new UserService().GetUserByUserID(e.EditingKeyValue.ToString());

            txtUserName.Text  = u.UserName;
            cmbStaffs.Value   = u.UserId;
            cmbStaffs.Enabled = false;
            btnActive.Text    = u.Active == 0 ? "Activate" : "Deactivate";
            txtActive.Text    = u.Active == 0 ? "1" : "0";
            btnActive.Visible = true;
            btnReset.Visible  = true;
            divLogin.Visible  = true;
            UpdatePanelStaff.Update();
        }
Example #6
0
 protected void btnReset_Click(object sender, EventArgs e)
 {
     if (cmbStaffs.Value != null)
     {
         User u = new User();
         u.UserId     = cmbStaffs.Value.ToString();
         u.Password   = "******";
         u.LastModify = DateTime.Now;
         if (new UserService().ChangePassword(u, new SessionManager().GetUserId(this.Session)))
         {
             ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Password Reset Successfully','Message')", true);
         }
     }
     loadAllUserStaff();
     UpdatePanelStaff.Update();
 }
Example #7
0
        protected void btnActive_Click(object sender, EventArgs e)
        {
            if (cmbStaffs.Value != null)
            {
                if (new UserService().ActivateUser(int.Parse(txtActive.Text), txtUserID.Text, new SessionManager().GetUserId(this.Session)))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('" + btnActive.Text + " Successfully','Message')", true);
                    divLogin.Visible = false;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Oops! Something is not right','Message')", true);
                }
            }

            loadAllUserStaff();
            UpdatePanelStaff.Update();
        }
Example #8
0
 protected void btnReset_Click(object sender, EventArgs e)
 {
     if (cmbStaffs.Value != null)
     {
         User u = new User();
         u.UserId     = txtUserID.Text;
         u.Password   = "******";
         u.LastModify = DateTime.Now;
         if (new UserService().ChangePassword(u, new SessionManager().GetUserId(this.Session)))
         {
             ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Password Reset Successfully','Message')", true);
             divLogin.Visible = false;
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Oops! Something is not right','Message')", true);
         }
     }
     loadAllUserStaff();
     UpdatePanelStaff.Update();
 }