public async Task <bool> UpdateData(string id, Roletbl obj) { try { if (id != obj.RoleName) { return(false); } using (var context = new smlpobDB()) { context.Roletbl.Attach(obj); context.Entry(obj).Property(x => x.Description).IsModified = true; context.Entry(obj).Property(x => x.ModBy).IsModified = true; context.Entry(obj).Property(x => x.ModDate).IsModified = true; await context.SaveChangesAsync(); return(true); } } catch (Exception ex) { LogHelpers.source = this.GetType().Name; LogHelpers.message = ex.Message; LogHelpers.user = ""; LogHelpers.WriteLog(); } return(false); }
protected void GetRole() { Roletbl ls = new Roletbl(); List <Roletbl> lst = new List <Roletbl>(); lst = objRoleBL.GetAllRole(ls).ToList(); gdvRole.DataSource = lst; gdvRole.DataBind(); btnSave.Visible = true; btnUpdate.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { Roletbl rt = new Roletbl(); lstRole = objStateBL.GetAllRole(rt).ToList(); //btnUpdate.Visible = false; if (!IsPostBack) { GetRole(); GetUser(); } }
protected void GetRole() { List <Roletbl> lstRole = new List <Roletbl>(); Roletbl rlt = new Roletbl(); RoleBL objRoleBL = new RoleBL(); rlt.IsActive = 1; lstRole = objRoleBL.GetRoleByStatus(rlt).ToList(); foreach (var cnt in lstRole) { ListItem li = new ListItem(); li.Text = cnt.RoleName; li.Value = cnt.RoleId.ToString(); DDLRole.Items.Add(li); } }
protected void btnSave_Click(object sender, EventArgs e) { Roletbl ls = new Roletbl(); ls.RoleName = txtRole.Text; ls.IsActive = 1; ls.CreatedBy = 1; ls.CreatedDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); List <Roletbl> lst = new List <Roletbl>(); lst = objRoleBL.SaveRole(ls).ToList(); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage('Role Saved Successfully');", true); Clear(); GetRole(); btnUpdate.Visible = false; btnSave.Visible = true; }
protected void getRoleByRoleName(int id) { Roletbl ls = new Roletbl(); ls.RoleId = id; List <Roletbl> lst = new List <Roletbl>(); lst = objRoleBL.GetRoleById(ls).ToList(); foreach (var el in lst) { txtRole.Text = el.RoleName; hdnRoleId.Value = el.RoleId.ToString(); } btnSave.Visible = false; btnUpdate.Visible = true; }
protected void lbtnCMarkAsActive_Click(object sender, EventArgs e) { LinkButton lbtn = (LinkButton)sender; GridViewRow gvr = (GridViewRow)lbtn.NamingContainer; var val = gvr.DataItemIndex; var id = gvr.Cells[2].Text; Roletbl cnt = new Roletbl(); cnt.RoleId = Convert.ToInt32(gvr.Cells[0].Text); if (id == "Active") { cnt.IsActive = 0; } else if (id == "InActive") { cnt.IsActive = 1; } objRoleBL.UpdateRoleIsActive(cnt); GetRole(); }
public async Task <bool> AddData(Roletbl obj) { try { using (var context = new smlpobDB()) { context.Roletbl.Add(obj); await context.SaveChangesAsync(); //Roles.CreateRole(obj.roleName); return(true); } } catch (Exception ex) { LogHelpers.source = this.GetType().Name; LogHelpers.message = ex.Message; LogHelpers.user = ""; LogHelpers.WriteLog(); } return(false); }
public IEnumerable <Roletbl> GetRoleByStatus(Roletbl ls) { return(objRoleDA.RoleAll(8, ls)); }
public IEnumerable <Roletbl> UpdateRoleIsActive(Roletbl ls) { return(objRoleDA.RoleAll(6, ls)); }
public IEnumerable <Roletbl> DeleteRole(Roletbl ls) { return(objRoleDA.RoleAll(5, ls)); }
public IEnumerable <Roletbl> UpdateRole(Roletbl ls) { return(objRoleDA.RoleAll(4, ls)); }
public IEnumerable <Roletbl> SaveRole(Roletbl ls) { return(objRoleDA.RoleAll(3, ls)); }
public IEnumerable <Roletbl> GetRoleById(Roletbl ls) { return(objRoleDA.RoleAll(2, ls)); }
public IEnumerable <Roletbl> GetAllRole(Roletbl ls) { return(objRoleDA.RoleAll(1, ls)); }