protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            t_Roles role = new t_Roles
            {
                Role        = string.Format("role-{0}", DateTime.Now.ToString("yyyyMMddHHmmss")),
                Description = txtDescription.Text
            };
            roleBL.AddRole(role);

            string urlRedirect = string.Format("/Supervisor/System/Roles.aspx");
            Response.Redirect(urlRedirect);
        }
    }
        public bool Update(t_Roles entity, string roleName)
        {
            try
            {
                t_Roles content = FindSingle(x => x.Role == roleName);
                content.Description = entity.Description;

                context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int index = 0;

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if (index > -1)
            {
                HiddenField roleName = ((HiddenField)gvr.FindControl("Role"));
                TextBox     type_vi1 = ((TextBox)gvr.FindControl("Description"));
                type_vi1.Enabled = false;

                // Update to SQL
                t_Roles updateRole = new t_Roles
                {
                    Description = type_vi1.Text,
                };

                roleBL.Update(updateRole, roleName.Value);
            }
            index++;
        }
    }
Пример #4
0
 public void AddRole(t_Roles entity)
 {
     RoleRepository.Add(entity);
 }
Пример #5
0
 public bool Update(t_Roles entity, string roleName)
 {
     return(RoleRepository.Update(entity, roleName));
 }
 public void Remove(t_Roles entity)
 {
     throw new NotImplementedException();
 }
 public void Add(t_Roles entity)
 {
     context.t_Roles.Add(entity);
     context.SaveChanges();
 }