protected void RoleGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRole") { int roleId = Convert.ToInt32(e.CommandArgument); RoleEntity entity = new RoleEntity() { Id = roleId, ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"])}; new FormMapper().DeleteFormsFromRole(entity); new UserMapper().DeleteUsersFromRole(entity); new RoleMapper().Delete(entity); RoleGridView.DataBind(); } }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; List<string> list = strings.Split(',').ToList(); RoleEntity entity = new RoleEntity() { ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"]), Id = Convert.ToInt32(Request.QueryString["RoleId"]), }; new RoleMapper().Get(entity); entity.Title = RoleNameTextBox.Text; entity.Description = ""; new RoleMapper().Update(entity); new FormMapper().DeleteFormsFromRole(entity); foreach (string s in list) { string id = ""; if (s.StartsWith("0")) { id = s.Substring(1, s.Length - 1); } else { id = s; } if (id != "") { int i = Convert.ToInt32(id); new FormMapper().InsertFormForRole(new FormEntity() { Id = i }, new RoleEntity() { Id = entity.Id }, Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"])); } } Response.Redirect("List.aspx"); }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; List<string> list = strings.Split(',').ToList(); RoleEntity entity = new RoleEntity() { ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"]), Title = RoleNameTextBox.Text, Status = StatusEnum.Active, Description = "" }; new RoleMapper().Insert(entity); foreach (string s in list) { string id = ""; if (s.StartsWith("0")) { id = s.Substring(1, s.Length - 1); } else { id = s; } int i = Convert.ToInt32(id); new FormMapper().InsertFormForRole(new FormEntity() { Id = i }, new RoleEntity() { Id = entity.Id }, Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"])); } Response.Redirect("List.aspx"); }