Exemple #1
0
        public static string UpdateRoles(string parameter, string roleName, string groupOption, string roleType, string roleLink)
        {
            RoleUtilities roleUtilities    = new RoleUtilities();
            string        roleInformations = string.Empty;

            if (!string.IsNullOrEmpty(roleName) || !string.IsNullOrEmpty(groupOption) || !string.IsNullOrEmpty(roleType))
            {
                string id     = Classes.encryption.Decrypt(parameter);
                string result = roleUtilities.UpdateRole(id, roleName, groupOption, roleType, roleLink);
                if (result == "Success")
                {
                    roleInformations = ShowRolesTable(roleUtilities.GetRoles());
                }
            }
            return(roleInformations);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserUtility userUtility = new UserUtility();

            if (Request.HttpMethod == "POST")
            {
                string strRoles    = Request.Form["Roles"];
                string strUsername = Request.Form["username"];
                string strPassword = Request.Form["password"];
                string strEmail    = Request.Form["email"];

                UserModel userModel = new UserModel
                {
                    Username = strUsername,
                    Password = strPassword,
                    Email    = strEmail,
                    Roles    = strRoles
                };

                if (!string.IsNullOrEmpty(userModel.Username) || !string.IsNullOrEmpty(userModel.Password) || !string.IsNullOrEmpty(userModel.Email))
                {
                    if (userUtility.InsertUser(userModel) == "Success")
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"{strUsername.ToUpper()} Successfully Added."));
                    }
                    else
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"An Error Occured Please Contact System Administrator."));
                    }
                }
                else
                {
                    toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Please fill up all Fields!"));
                }
            }
            rolesModels         = roleUtilities.GetRoles();
            roleGroup           = rolesModels.GroupBy(x => x.GroupId).Select(y => y.First()).ToList();
            usersBody.InnerHtml = ShowUsers(userUtility.GetUsers()).ToString();
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RoleUtilities   roleUtilities   = new RoleUtilities();
            OptionUtilities optionUtilities = new OptionUtilities();

            if (Request.HttpMethod == "POST")
            {
                string roleName    = rolename.Value;
                string groupOption = groupoptions.Value;
                string roleType    = Request.Form["type"];
                string roleLink    = rolelink.Value;
                if (!string.IsNullOrEmpty(roleName) || !string.IsNullOrEmpty(groupOption) || !string.IsNullOrEmpty(roleType))
                {
                    string result = roleUtilities.InsertRole(roleName, groupOption, roleType, roleLink);
                    if (result == "Success")
                    {
                        ClearFields();
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"{roleName} Successfully Added."));
                    }
                    else
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"An Error Occured Please Contact System Administrator."));
                    }
                }
                else
                {
                    toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Please fill up all Fields."));
                }
            }
            ListItem[] gOptions = optionUtilities.GetGroupOptions();
            groupoptions.Items.Clear();
            groupoptions.Items.AddRange(gOptions);
            sgroupoptions.Items.Clear();
            sgroupoptions.Items.AddRange(gOptions);
            editgroupoptions.Items.Clear();
            editgroupoptions.Items.AddRange(gOptions);
            ShowRoles(roleUtilities.GetRoles());
        }