コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    int iuserId = ((UserDetails)Session[clsConstant.TOKEN]).UserID;
                    userDetail = new UserDetailEdit();
                    userObj    = new clsUserDetails();
                    userDetail = userObj.GetUserDetails(Convert.ToInt32(iuserId));
                    BindDropDown();
                    AutoFill();
                    btnUpdate.Visible = true;
                    //DisableControls();
                }

                else
                {
                }
            }

            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
コード例 #2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                ut      = new Utility();
                userObj = new clsUserDetails();
                int userID = int.Parse(Request.QueryString["userID"]);
                //string clientValue = SimpleHash.HMACSha1(txtPassword.Text, clsConstant.INITVECTOR);
                string clientValue = txtPassword.Text;
                userObj.EditUserDetails(userID, int.Parse(drpAgencyName.SelectedValue), txtFirstName.Text, txtLastName.Text,
                                        txtUserName.Text, clientValue.ToUpper(),
                                        txtTelephone.Text, txtCellPhone.Text, txtEmail.Text, int.Parse(drpParentUser.SelectedValue),
                                        txtSkypeID.Text, int.Parse(drpDesignation.SelectedValue), chkUserActive.Checked ? 1 : 0,
                                        int.Parse(drpSuperUser.SelectedValue),
                                        ddlsts.SelectedValue.ToString(), chkTTL.Checked ? "true" : "false"

                                        );
                lblUserExist.Text = "Information updated successfully";
                ut.ResetFormControl(reSetDiv);
                //btnUpdate.Visible = false;
                //btnSubmit.Visible = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
コード例 #3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         userObj = new clsUserDetails();
         ut      = new Utility();
         //Encryption.Encrypt(txtPassword.Text.Trim(), clsConstant.INITVECTOR);
         //string encryptedValue = SimpleHash.HMACSha1(txtPassword.Text, clsConstant.INITVECTOR);
         //string encryptedValue = md5.CalculateMD5Hash(txtPassword.Text);
         string encryptedValue = txtPassword.Text;
         if (!userObj.UserNameExist(txtUserName.Text))
         {
             userObj.AddUserDetails(Convert.ToInt32(drpAgencyName.SelectedValue), txtFirstName.Text, txtLastName.Text,
                                    txtUserName.Text, encryptedValue.ToUpper(), txtTelephone.Text, txtCellPhone.Text, txtEmail.Text,
                                    Convert.ToInt32(drpParentUser.SelectedValue), txtSkypeID.Text, Convert.ToInt32(drpDesignation.SelectedValue),
                                    chkUserActive.Checked ? 1 : 0, Convert.ToInt32(drpSuperUser.SelectedValue),
                                    ddlsts.SelectedValue.ToString(), chkTTL.Checked ? "true" : "false"
                                    );
             lblUserExist.Text      = "Information Successfully saved";
             lblUserExist.ForeColor = Color.Black;
             ut.ResetFormControl(reSetDiv);
         }
         else
         {
             lblUserExist.Text      = "User name already exist";
             lblUserExist.ForeColor = Color.Red;
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex);
     }
 }
コード例 #4
0
ファイル: clsUserDetail.cs プロジェクト: hprakashsingh/EAPDEA
    public bool AthunticateUser(string userName, string password)
    {
        //string databasePassword;
        clsUserDetails user = new clsUserDetails();

        try
        {
            //connectionObj = new SqlConnection();
            //connectionObj.Open();
            //commandObj = new SqlCommand("SELECT vsPassword FROM tblUserDetails WHERE vsUserName=" + userName, connectionObj);
            //databasePassword = commandObj.ExecuteScalar().ToString();
            //connectionObj.Close();
            // readableString = user.PasswordEncryption(password);
        }
        catch (Exception ex)
        {
            return(false);
        }

        // If no password found, return false.
        //if (null == databasePasswor)
        //{
        //    // You could write failed login attempts here to event log for additional security.
        //    return false;
        //}

        // Compare lookupPassword and input passWord, using a case-sensitive comparison.
        // return (0 == string.Compare(databasePassword, password, false));
        return(false);
    }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1);

            try
            {
                if (IsPostBack != null)
                {
                    string userID    = Request.QueryString["ui"];
                    string code      = Request.QueryString["sp"];
                    string codePart  = code;
                    string myString  = codePart.ToString();
                    string subString = myString.Substring(0, 32);
                    objReset = new Reset();
                    DisableControls();


                    objEntReset = objReset.checkAunthentication(userID, subString);
                    string clientValue = md5.CalculateMD5Hash(txtAnswerCheck.Text.Trim());


                    if (txtAnswerCheck.Text != "")
                    {
                        if (objEntReset != null && subString == clientValue.ToUpper())
                        {
                            clsUserDetails obj = new clsUserDetails();
                            obj.GetUserDetails(int.Parse(userID));
                            if (subString == objEntReset.userAns && userID == objEntReset.userID)
                            {
                                EnableControls();
                                lblReset.Text              = "Please Reset Your Password.";
                                hplLogin.Enabled           = true;
                                btnUpdate.Enabled          = true;
                                lblPasswordMessage.Enabled = true;
                                lblPasswordMessage.Text    = "Password Must contain atleast 8 characters, including 1 digit, 1 Symbol & 1 UPPERCASE character";
                            }
                            else
                            {
                                lblPasswordMessage.Text = "Unable to reset your password, please check your security answer.";
                                btnUpdate.Enabled       = false;
                            }
                        }
                        else
                        {
                            lblPasswordMessage.Text = "Unable to reset your password, please check your security answer.";
                            lblReset.Text           = "";
                            btnUpdate.Enabled       = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                lblPasswordMessage.Text = "";
            }
        }
コード例 #6
0
        public void saveUserDetails(string Password)
        {
            try
            {
                ObjUtil    = new Utility();
                userObj    = new clsUserDetails();
                userDetail = new UserDetailEdit();

                //string clientValue = md5.CalculateMD5Hash(txtPassword.Text);
                string clientValue = txtPassword.Text;


                int iuserId = ((UserDetails)Session[clsConstant.TOKEN]).UserID;
                userDetail = userObj.GetUserDetails(Convert.ToInt32(iuserId));
                string getOldPassword = userDetail.password;

                if (Password == "")
                {
                    if (userObj.EditUserProfileDetails(iuserId, getOldPassword, txtTelephone.Text,
                                                       txtCellPhone.Text, txtEmail.Text, txtSkypeID.Text, txtUserName.Text,
                                                       int.Parse(drpDesignation.SelectedValue), chkEmailNotification.Checked, txtFirstName.Text, txtLastName.Text))
                    {
                        lblUserExist.ForeColor = System.Drawing.Color.Blue;
                        lblUserExist.Text      = "Information Saved Successfully.";
                        DisableControls();
                    }

                    else
                    {
                        lblUserExist.ForeColor = System.Drawing.Color.Red;
                        lblUserExist.Text      = "Error is there.";
                    }
                }
                else
                {
                    if (userObj.EditUserProfileDetails(iuserId, Password.ToUpper(), txtTelephone.Text,
                                                       txtCellPhone.Text, txtEmail.Text, txtSkypeID.Text, txtUserName.Text,
                                                       int.Parse(drpDesignation.SelectedValue), chkEmailNotification.Checked, txtFirstName.Text, txtLastName.Text))
                    {
                        lblUserExist.ForeColor = System.Drawing.Color.Blue;
                        lblUserExist.Text      = "Information Saved Successfully.";
                        DisableControls();
                    }

                    else
                    {
                        lblUserExist.ForeColor = System.Drawing.Color.Red;
                        lblUserExist.Text      = "Error is there.";
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
コード例 #7
0
 protected void txtUserName_TextChanged(object sender, EventArgs e)
 {
     userObj = new clsUserDetails();
     ut      = new Utility();
     if (userObj.UserNameExist(txtUserName.Text))
     {
         lblUserExist.Text      = "User name already exist";
         lblUserExist.ForeColor = Color.Red;
         txtUserName.Focus();
     }
 }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Utility.CheckAccess("UserDetailAddEdit") == false)
                    {
                        //UrlParameterPasser urlWrapper = new UrlParameterPasser();
                        //urlWrapper["pageaccesserr"] = "1";
                        //urlWrapper.Url = "../DocumentLogSystem/DashBoard.aspx";
                        //urlWrapper.PassParameters();
                        pnlInvalid.Visible = true;
                        MainDiv.Visible    = false;
                    }
                    ddlsts.DataSource     = GetFundingAgency();
                    ddlsts.DataTextField  = "vsFAgencyName";
                    ddlsts.DataValueField = "vsFAgencyCode";
                    ddlsts.DataBind();


                    if (!Convert.ToBoolean(Session[clsConstant.SESS_VIEWTYPE]))
                    {
                        this.MakeReadOnly(this.Controls);
                    }
                    BindDropDown();
                    string userID = Request.QueryString["userID"];
                    if (userID != null)
                    {
                        userDetail = new UserDetailEdit();
                        userObj    = new clsUserDetails();
                        userDetail = userObj.GetUserDetails(Convert.ToInt32(userID));
                        //BindDropDown();
                        BindDesignation(userDetail.AgencyID);
                        AutoFill();
                        btnUpdate.Visible = true;
                        btnSubmit.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
コード例 #9
0
        private bool CheckOldPassword()
        {
            int iuserId = ((UserDetails)Session[clsConstant.TOKEN]).UserID;

            userDetail = new UserDetailEdit();
            userObj    = new clsUserDetails();
            userDetail = userObj.GetUserDetails(Convert.ToInt32(iuserId));
            string passWd = userDetail.password;

            lblUserExist.Text   = "Please enter New Password";
            txtPassword.Visible = true;
            txtOldPassword.Attributes.Add("value", txtOldPassword.Text);
            //string clientValue = SimpleHash.HMACSha1(txtOldPassword.Text.Trim(), clsConstant.INITVECTOR);
            if (passWd.ToUpper() == txtOldPassword.Text.ToUpper())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #10
0
 protected void lockUser(RepeaterCommandEventArgs e)
 {
     HiddenField hdfUserId = (HiddenField)e.Item.FindControl("hdfUserId");
     HiddenField hdfLock = (HiddenField)e.Item.FindControl("hdfLock");
     if (hdfUserId != null)
     {
         MembershipUser user = Membership.GetUser(new Guid(hdfUserId.Value.ToString()));
         if (user != null)
         {
             if (hdfLock != null)
             {
                 if (hdfLock.Value == "Yes")
                 {
                     user.UnlockUser();
                     Membership.UpdateUser(user);
                 }
                 else
                 {
                     clsUserDetails objUDet = new clsUserDetails();
                     int result = objUDet.lockUser(hdfUserId.Value.ToString());
                     if (result > 0)
                     {
                         lblErr.Visible = true;
                         lblErr.Text = "Error Code: " + result.ToString();
                     }
                 }
             }
         }
     }
     loadUserInformation();
 }