コード例 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add"))
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false);
                return;
            }
            if (ValidData())
            {

            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                CommonBAL combal = new CommonBAL();
                UserBE addUserBE = new UserBE();
                UserDAL addUserdAL = new UserDAL();
                UserBAL addUserBal = new UserBAL();
                int ReturnOutput = 0;
                addUserBE.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId;

                addUserBE.UserName = txtUserName.Text;
                addUserBE.FirstName = txtFName.Text;
                addUserBE.MiddleName = txtMName.Text;
                addUserBE.LastName = txtLName.Text;
                addUserBE.PrimaryEmailId = txtPREmailId.Text;
                addUserBE.SecondaryEmailId = txtSCEmailId.Text;
                addUserBE.MobileNo = txtMobileNo.Text;
                addUserBE.Address1 = txtAddress1.Text;
                addUserBE.Address2 = txtAddress2.Text;
                addUserBE.Street = txtStreet.Text;
                addUserBE.City = txtCity.Text;
                addUserBE.State1 = txtState.Text;
                addUserBE.Country = txtCountry.Text;
                addUserBE.SecretQuest = ddSecretQuest.SelectedValue;
                addUserBE.SecretAns = txtSecretAns.Text;
                addUserBE.EncPass = combal.Encrypt(txtPass.Text, false);

                if (addUserBal.AddUser(addUserBE, ref ReturnOutput))
                {
                  
                    if(ReturnOutput==1)
                    {
                        master.ShowMessage("User of this User Name Already exist. ", false);
                    }
                    else if (ReturnOutput == 2)
                    {
                        clearFields();  
                        master.ShowMessage("Record Inserted Successfully.", true);
                    }
                }
                else
                {
                    
                    master.ShowMessage("Unsuccessful", false);
                }
            }

        }
コード例 #2
0
        protected void btnSavePassword_Click(object sender, EventArgs e)
        {
            try
            {

                if (string.IsNullOrWhiteSpace(txtPassword.Text) || string.IsNullOrWhiteSpace(txtConfirmPassword.Text))
                    ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Please enter Password');", true);
                else if (!txtPassword.Text.Trim().Equals(txtConfirmPassword.Text.Trim()))
                    ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Password does not matched.');", true);
                else
                {
                    UserBE userInfo = new UserBE();
                    UserBAL userBAL = new UserBAL();
                    CommonBAL combal = new CommonBAL();

                    string pwd = combal.Encrypt(txtPassword.Text.Trim(), false);
                    int i = userBAL.SaveConfirmation(Request.QueryString["userid"].ToString(), Request.QueryString["key"].ToString(), pwd);
                    if (i > 0)
                        ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Password saved, Please relogin'); location.href ='login.aspx';", true);
                    else
                        ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('try again later');", true);
                }
            }
            catch (Exception ex)
            {
            }

        }
コード例 #3
0
        protected void btnReset_Click(object sender, EventArgs e)
        {
            UserBAL userBAL = new UserBAL();
            UserBE user = new UserBE();
            LoggedIn master = (LoggedIn)this.Master;

            if (txtOldPass.Text == commonBAL.Decrypt(((UserBE)Session["LoggedInUser"]).EncPass.ToString(), false))
            {
                user.UserId = Convert.ToInt32(((UserBE)Session["LoggedInUser"]).UserId);
                user.EncPass = commonBAL.Encrypt(txtNewPass.Text, false);
                if (txtNewPass.Text == txtconfirmPass.Text)
                {
                    if (userBAL.ResetPassword(user))
                    {
                        master.ShowMessage("Password Changed Successfully", true);
                    }
                    else
                    {
                        master.ShowMessage("Unsuccessful", false);
                    }

                }
                else
                {
                    master.ShowMessage("Password Mismatched", false);
                }
            }
            else
            {
                master.ShowMessage("Incorrect Old Password", false);
            }

        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                if (string.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["userid"].ToString())) ||
                   string.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["Key"].ToString())))
                {
                    divConfirm.Visible = false;
                    ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Network Problem Please Try Again later');", true);
                    return;
                }
                UserBE userInfo = new UserBE();
                UserBAL userBAL = new UserBAL();


                DataSet ds = userBAL.CheckConfirmationRequest(Request.QueryString["userid"].ToString(), Request.QueryString["Key"].ToString());
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0][0].ToString().Equals("No"))
                        {
                            divConfirm.Visible = false;
                            ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('You are already verified');", true);
                        }
                    }
                }
            }
        }
コード例 #5
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string RealPass = txtPass.Text;
            if (ValidData())
            {
                return;
            }
          
                UserBE LoggedInUser = new UserBE();
                CommonBAL combal = new CommonBAL();
                UserBAL userBAL = new UserBAL();
                DataTable dt = new DataTable();

                // Using screen inputs create UserBE;
                LoggedInUser.UserName = txtName.Text;
                LoggedInUser.EncPass = combal.Encrypt(txtPass.Text, false);
                if (userBAL.Validate(ref LoggedInUser))
                {
                    Session["LoggedInUser"] = LoggedInUser;
                    if (Session["LoggedInUser"] != null)
                    {
                        LoggedInUser.UserId = ((UserBE)Session["LoggedInUser"]).UserId;
                        if(userBAL.UserAccessRight(LoggedInUser,ref dt))
                        {
                            Session["UserAccessRights"] = dt;
                            Response.Redirect(@"~\UserMaint\LoggedInHome.aspx");
                        }
                        //General master = (General)this.Master;
                        //master.ShowMessage("You are not authorised to access this page. Please contact system administrator.", false); //?? Message through Query String
                        ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('You are not authorised to access this page. Please contact system administrator.');", true);
                        return;
                    }

                }
                else
                {
                    //General master = (General)this.Master;
                    //master.ShowMessage("Incorrect Email or Password.", false);
                    ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Incorrect Email or Password.');", true);
                    return;
                }

        }
コード例 #6
0
        //protected void lvUserList_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        //{
        //    if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "AddRec"))
        //    {
        //        LoggedIn master = (LoggedIn)this.Master;
        //        master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false);
        //        return;
        //    }
            
        //    UserBE user = new UserBE();
        //    UserBAL userBAL = new UserBAL();
        //    CommonBAL CommonBAL = new CommonBAL();
        //    user.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId;
            
        //    string UserId = lvUserList.DataKeys[e.ItemIndex].Value.ToString();//
        //    Label userName = lvUserList.Items[e.ItemIndex].FindControl("lbUserName") as Label;//
        //    TextBox firstName = lvUserList.Items[e.ItemIndex].FindControl("txtFName") as TextBox;
        //    TextBox middleName = lvUserList.Items[e.ItemIndex].FindControl("txtMName") as TextBox;
        //    TextBox lastName = lvUserList.Items[e.ItemIndex].FindControl("txtLName") as TextBox;
        //    TextBox primaryEmailId = lvUserList.Items[e.ItemIndex].FindControl("txtPREmailId") as TextBox;
        //    TextBox secondaryEmailId = lvUserList.Items[e.ItemIndex].FindControl("txtSCEmailId") as TextBox;
        //    TextBox mobileNo = lvUserList.Items[e.ItemIndex].FindControl("txtMobileNo") as TextBox;
        //    TextBox address1 = lvUserList.Items[e.ItemIndex].FindControl("txtAddress1") as TextBox;
        //    TextBox address2 = lvUserList.Items[e.ItemIndex].FindControl("txtAddress2") as TextBox;
        //    TextBox street = lvUserList.Items[e.ItemIndex].FindControl("txtStreet") as TextBox;
        //    TextBox city = lvUserList.Items[e.ItemIndex].FindControl("txtCity") as TextBox;
        //    TextBox state1 = lvUserList.Items[e.ItemIndex].FindControl("txtState1") as TextBox;
        //    TextBox country = lvUserList.Items[e.ItemIndex].FindControl("txtCountry") as TextBox;
        //    TextBox secretQuest = lvUserList.Items[e.ItemIndex].FindControl("txtSecretQuest") as TextBox;//?
        //    TextBox secretAns = lvUserList.Items[e.ItemIndex].FindControl("txtSecretAns") as TextBox;
        //    TextBox Pass = lvUserList.Items[e.ItemIndex].FindControl("txtPass") as TextBox;//?
            
           
            
        //    user.UserId = Convert.ToInt32(UserId);
        //    user.UserName = userName.Text;
        //    user.FirstName = firstName.Text;
        //    user.MiddleName = middleName.Text;
        //    user.LastName = lastName.Text;
        //    user.PrimaryEmailId = primaryEmailId.Text;
        //    user.SecondaryEmailId = secondaryEmailId.Text;
        //    user.MobileNo = mobileNo.Text;
        //    user.Address1 = address1.Text;
        //    user.Address2 = address2.Text;
        //    user.Street = street.Text;
        //    user.City = city.Text;
        //    user.State1 = state1.Text;
        //    user.Country = country.Text;
        //    user.SecretQuest = secretQuest.Text;
        //    user.SecretAns = secretAns.Text;
        //    user.EncPass = CommonBAL.Encrypt( Pass.Text,false);
            
        //    if (userBAL.Modify(user))
        //    {
        //        lvUserList.EditIndex = -1;
        //        bindLVUser();
        //        LoggedIn master = (LoggedIn)this.Master;
        //        master.ShowMessage("Record Successfully Updated.", true);
        //    }
        //    else
        //    {
        //        LoggedIn master = (LoggedIn)this.Master;
        //        master.ShowMessage("Unsuccessful",false);
        //    }
        //    recalcNoOfPages();
        //}

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "edit"))
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false);
                return;
            }

            UserBE user = new UserBE();
            UserBAL userBAL = new UserBAL();
            CommonBAL CommonBAL = new CommonBAL();
            user.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId;


            user.UserId = Convert.ToInt32(hdnUserUpdateId.Value);
            user.UserName = txtUserName.Text;
            user.FirstName = txtFirstName.Text;
            user.MiddleName = txtMiddleName.Text;
            user.LastName = txtLName.Text;
            user.PrimaryEmailId = txtPREmailId.Text;
            user.SecondaryEmailId = txtSCEmailID.Text;
            user.MobileNo = txtMobileNo.Text;
            user.Address1 = txtAddress1.Text;
            user.Address2 = txtAddress2.Text;
            user.Street = txtStreet.Text;
            user.City = txtCity.Text;
            user.State1 = txtState.Text;
            user.Country = txtCountry.Text;
            user.SecretQuest = txtSecretQuest.Text;
            user.SecretAns = txtSecretAns.Text;
            user.EncPass = CommonBAL.Encrypt(txtPass.Text, false);

            if (userBAL.Modify(user))
            {
                lvUserList.EditIndex = -1;
                bindLVUser();
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Record Successfully Updated.", true);
            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Unsuccessful", false);
            }
            recalcNoOfPages();

        }
コード例 #7
0
        private void bindLVUser()
        {

            UserBE user = new UserBE();
            UserBAL userBAL = new UserBAL();
            DataTable dt = new DataTable();
            if (userBAL.GetAllUserDetails(ref dt))
            {
                this.lvUserList.DataSource = dt;
                lvUserList.DataBind();

            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Unsuccessful",false);
            }

        }
コード例 #8
0
        protected void btnDeleteYes_Click(object sender, EventArgs e)
        {
            if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "delete"))
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false);
                return;
            }
            UserBE user = new UserBE();
            UserBAL userBAL = new UserBAL();
            user.UserId = Convert.ToInt32(hdnUserId.Value);
           
            if (userBAL.Delete(user))
            {
                if (lvUserList.Items.Count == 1)
                {

                    UserDataPager.SetPageProperties(UserDataPager.TotalRowCount - UserDataPager.PageSize - 1,
                UserDataPager.PageSize, true);
                    bindLVUser();
                    recalcNoOfPages();
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("User successfully deleted.", true);

                }
                else
                {
                    lvUserList.EditIndex = -1;
                    bindLVUser();
                    recalcNoOfPages();
                    LoggedIn master = (LoggedIn)this.Master;
                    master.ShowMessage("User successfully deleted.", true);
                }
            }
            else
            {
                LoggedIn master = (LoggedIn)this.Master;
                master.ShowMessage("Sorry You cannot delete this User because it is already in use", false);
            }
            // Hide the ModalPopup.
            //this.mpe_DeleteUser.Hide();
            
        }