/// <summary>
        /// This method is used to get user details by search condition.
        /// </summary>
        /// <param name="objUserInfo"></param>
        /// <returns></returns>
        public static DataTable GetUserDtlsByCondition(UserManagementInfo objUserInfo)
        {
            try
            {
                clsParameterCollection ParameterCollection = new clsParameterCollection();
                ParameterCollection.ProcedureName = "BS_GetUserDetailsByCondition";
                ParameterCollection.Add(new clsParameter("@SearchCondition", objUserInfo.SearchCondition));
                ParameterCollection.Add(new clsParameter("@SearchText", objUserInfo.SearchText));
                return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection);
            }
            catch (Exception Ex)
            {
                if (!Ex.Message.Contains("User Define:"))
                    BL_Exception.WriteLog(Ex);

                throw Ex;
            }
        }
        /// <summary>
        /// This method is used to update user profile details.
        /// </summary>
        /// <param name="objUserInfo"></param>
        /// <returns></returns>
        public static DataTable UpdateUserProfile(UserManagementInfo objUserInfo)
        {
            try
            {
                clsParameterCollection ParameterCollection = new clsParameterCollection();
                ParameterCollection.ProcedureName = "BS_UpdateUserProfile";
                ParameterCollection.Add(new clsParameter("@PropertyValuesString", objUserInfo.PropertyValuesString));
                ParameterCollection.Add(new clsParameter("@UserName", objUserInfo.UserName));
                return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection);
            }
            catch (Exception Ex)
            {
                if (!Ex.Message.Contains("User Define:"))
                    BL_Exception.WriteLog(Ex);

                throw Ex;
            }
        }
        /// <summary>
        /// This method is used to update user details.
        /// </summary>
        private void UpdateUser()
        {
            try
            {
                MembershipUser user = Membership.GetUser(txtDisplayName.Text.Trim());
                if (user != null)
                {
                    user.Email = txtEmailId.Text.Trim();
                    Membership.UpdateUser(user);

                    string newPassword = user.ResetPassword();
                    user.ChangePassword(newPassword, txtPassword.Text.Trim());

                    UserManagementInfo UserInfo = new UserManagementInfo();
                    UserInfo.PropertyValuesString = txtFirstName.Text.Trim() + "," + txtLastName.Text.Trim();
                    UserInfo.UserName = txtDisplayName.Text.Trim();
                    BL_UserManagement.UpdateUserProfile(UserInfo);


                    BL_UserManagement.UpdateUserStoreCode(Session["UserID"].ToString(), user.ProviderUserKey.ToString(), ddlStore.SelectedValue, (chkIsAdmin.Checked == true));
                    Roles.RemoveUserFromRoles(user.UserName, Roles.GetRolesForUser(user.UserName));
                    Roles.AddUserToRole(user.UserName, ddlRollName.SelectedValue);
                    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "checkValide", "alert('User updated successfully!');", true);
                    GetAllUsers();
                    Reset();
                }
                else
                    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "checkValide", "alert('Select valid user!');", true);
            }
            catch (Exception Ex)
            {
                string Message = string.Empty;
                //if (Ex.Message == "The E-mail supplied is invalid.")
                //    Message = "Unable to update User, Email already registered";
                //else
                //    Message = Ex.Message;

                Message = Ex.Message == "The E-mail supplied is invalid." ? "Unable to update User, Email already registered" : Ex.Message;
                AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "checkValide", "alert('" + Message + "');", true);
                Reset();
            }
        }
        /// <summary>
        /// This method is used to search user details.
        /// </summary>
        private void SearchUser()
        {
            UserManagementInfo UserInfo = new UserManagementInfo();
            UserInfo.SearchCondition = ddlSearch.SelectedValue;
            if (ddlSearch.SelectedValue == "PropertyValuesString")
            {
                string searchText = txtSearch.Text.Trim();
                searchText = (searchText.Replace(' ', ','));
                UserInfo.SearchText = searchText;
            }
            else
                UserInfo.SearchText = txtSearch.Text.Trim();

            DataTable DataTable = BL_UserManagement.GetUserDtlsByCondition(UserInfo);
            if (DataTable.Rows.Count > 0)
                grdUserManagement.DataSource = DataTable;
            else
            {

                grdUserManagement.DataSource = new ArrayList();
                grdUserManagement.DataBind();
            }
            grdUserManagement.DataBind();
        }