Esempio n. 1
0
        protected void PortalAcct_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    String AddedBy       = Page.User.IsInRole("HR Administrator").ToString();
                    Int32  AccountStatus = 1;
                    if (Tab1_RadioButton1.Checked == true)
                    {
                        AccountStatus = 1;
                    }
                    else
                    {
                        AccountStatus = 0;
                    }

                    string result = DBAccessManager.AccountSignUp(Tab1_EmployeeID.Text.ToString(), Tab1_UserName.Text.ToString().Trim(), EncodePasswordToBase64(Tab1_password.Text.ToString().Trim()), Int32.Parse(Tab1_RoleTypeList.SelectedValue), 1, 1, AccountStatus, AddedBy);

                    if (result == "")
                    {
                        ResetFields();
                        String Emp_FullName = "";
                        String UserName     = Tab1_UserName.Text.ToString();
                        String Password     = DecodeFrom64(Tab1_password.Text.ToString());
                        if (CheckEmail(UserName))  // Notify via Email if Email was used as a user Name
                        {
                            NotifyEmployee_PortaLoginViaEmail(Emp_FullName, UserName, Password);
                        }
                        this.Hmessage.Visible  = true;
                        this.Hmessage.Text     = "Account has been created successfully";
                        this.Hmessage.CssClass = "errorMessage";
                    }
                    else
                    {
                        this.Hmessage.Visible  = true;
                        this.Hmessage.Text     = result;
                        this.Hmessage.CssClass = "errorMessage";
                    }
                }
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
            ViewState["myDataSet"] = null;
            LoadPortalUserAccounts();
        }
Esempio n. 2
0
        protected void PortalEdit_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    String AddedBy       = Page.User.Identity.Name.ToString();// Page.User.IsInRole("HR Administrator").ToString();
                    Int32  AccountStatus = 1;
                    if (Tab2_RadioButton1.Checked == true)
                    {
                        AccountStatus = 1;
                    }
                    else
                    {
                        AccountStatus = 0;
                    }
                    String Password = "******"; // do not update password while editing-handled in SP.

                    string result = DBAccessManager.AccountSignUp(Tab2_EmployeeID.Text.ToString(), Tab2_UserName.Text.ToString().Trim(), Password, Int32.Parse(Tab2_RoleTypeList.SelectedValue), 1, 1, AccountStatus, AddedBy);

                    if (result == "")
                    {
                        ResetFields();
                        this.EditAccount.Visible = false;
                        this.AddAccount.Visible  = true;
                    }
                    else
                    {
                        this.Editmessage.Visible  = true;
                        this.Editmessage.Text     = result;
                        this.Editmessage.CssClass = "errorMessage";
                    }
                }
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
            ViewState["myDataSet"] = null;
            LoadPortalUserAccounts();
        }
Esempio n. 3
0
        private void SignMeUp_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    String AddedBy       = "Employee"; // Used to determine the RoleTypeID
                    Int32  RoleTypeID    = 0;
                    Int32  DivisionID    = 0;
                    Int32  LocationID    = 0;
                    Int32  AccountStatus = 1; // Enabled by Default
                    string result        = DBAccessManager.AccountSignUp(this.Signup_EmployeeID.Text.ToString().Trim(), Signup_UserName.Text.ToString().Trim(), SchoolNetBase.EncodePasswordToBase64(Signup_Password.Text.ToString().Trim()), RoleTypeID, DivisionID, LocationID, AccountStatus, AddedBy);

                    if (result == "")
                    {
                        this.errorMessage.Visible   = true;
                        this.Signup_EmployeeID.Text = "";
                        this.Signup_UserName.Text   = "";
                        this.Signup_Password.Text   = "";
                        this.errorMessage.Text      = "Thank you for sign up.Your account has been created. Please click the login link below to sign in.";
                        this.errorMessage.CssClass  = "errorMessage";
                    }

                    else
                    {
                        this.errorMessage.Visible  = true;
                        this.EmailAddress.Text     = "";
                        this.Login_Password.Text   = "";
                        this.errorMessage.Text     = result;
                        this.errorMessage.CssClass = "errorMessage";
                    }
                }
            }
            catch (Exception exception)
            {
                this.errorMessage.Visible  = true;
                this.EmailAddress.Text     = "";
                this.Login_Password.Text   = "";
                this.errorMessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.errorMessage.CssClass = "errorMessage";
            }
        }