protected void Page_Load(object sender, EventArgs e)
        {
            CurrentLoggedUserID.Value = Membership.GetUser().ProviderUserKey.ToString();
            string UserID = string.Empty;

            if (Request.QueryString.AllKeys.Contains("UserID"))
            {
                UserID = Request.QueryString["UserID"].ToString();
            }

            if (!string.IsNullOrEmpty(UserID) && UserProfileEdit1.PrimaryKeyIndex == 0)
            {
                CurrentUserID.Value    = UserID;
                divSearchPanel.Visible = false;
                btnAddNewUser.Visible  = false;
                gvwAccounts.Visible    = false;
                pnlGrids.Visible       = false;
                divEdit.Visible        = true;

                Guid           aspNetId = Guid.Parse(UserID);
                hccUserProfile prof     = hccUserProfile.GetParentProfileBy(aspNetId);

                if (prof != null)
                {
                    UserProfileEdit1.PrimaryKeyIndex = prof.UserProfileID;
                }

                UserProfileEdit1.CurrentAspNetId = aspNetId;
                UserProfileEdit1.Bind();
                UserProfileEdit1.Visible = true;
            }

            else if (!IsPostBack)
            {
                //BindddlDeliveryDates();
                //BindgvwAccounts();
            }

            MembershipUser user = HealthyChef.Common.Helpers.LoggedUser;

            IsAdmin              = Roles.IsUserInRole(user.UserName, "Administrators");
            IsEmployeeManager    = Roles.IsUserInRole(user.UserName, "EmployeeManager");
            IsEmployeeProduction = Roles.IsUserInRole(user.UserName, "EmployeeProduction");
            IsEmployeeService    = Roles.IsUserInRole(user.UserName, "EmployeeService");

            divany.Visible                = IsAdmin;
            divAdministrator.Visible      = IsAdmin;
            divCustomer.Visible           = IsEmployeeManager || IsAdmin || IsEmployeeService;
            divEmployeeManager.Visible    = IsAdmin;
            divEmployeeProduction.Visible = IsEmployeeManager || IsAdmin;
            divEmployeeService.Visible    = IsEmployeeManager || IsAdmin;
        }
        protected void UserProfileEdit1_ControlCancelled(object sender)
        {
            BindgvwAccounts();
            UserProfileEdit1.Clear();

            divSearchPanel.Visible   = true;
            btnAddNewUser.Visible    = true;
            UserProfileEdit1.Visible = false;

            btnAddNewUser.Visible = true;
            gvwAccounts.Visible   = true;
            divEdit.Visible       = false;
        }
        protected void btnAddNewUser_Click(object sender, EventArgs e)
        {
            divSearchPanel.Visible = false;
            btnAddNewUser.Visible  = false;
            gvwAccounts.Visible    = false;
            divEdit.Visible        = true;

            pnlGrids.Visible = false;

            UserProfileEdit1.Clear();
            UserProfileEdit1.Bind();
            UserProfileEdit1.Visible = true;
        }
        protected void gvwAccounts_SelectedIndexChanged(object sender, EventArgs e)
        {
            divSearchPanel.Visible = false;
            btnAddNewUser.Visible  = false;
            gvwAccounts.Visible    = false;
            divEdit.Visible        = true;

            Guid           aspNetId = Guid.Parse(gvwAccounts.SelectedDataKey.Value.ToString());
            hccUserProfile prof     = hccUserProfile.GetParentProfileBy(aspNetId);

            if (prof != null)
            {
                UserProfileEdit1.PrimaryKeyIndex = prof.UserProfileID;
            }

            UserProfileEdit1.CurrentAspNetId = aspNetId;
            UserProfileEdit1.Bind();
            UserProfileEdit1.Visible = true;
        }