示例#1
0
        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);
        }
示例#2
0
        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;
        }
示例#3
0
        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);
            }
        }
示例#5
0
        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;
        }
示例#6
0
        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;
        }
示例#7
0
        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();
        }
示例#8
0
        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);
        }
示例#9
0
 public IEnumerable <Roletbl> GetRoleByStatus(Roletbl ls)
 {
     return(objRoleDA.RoleAll(8, ls));
 }
示例#10
0
 public IEnumerable <Roletbl> UpdateRoleIsActive(Roletbl ls)
 {
     return(objRoleDA.RoleAll(6, ls));
 }
示例#11
0
 public IEnumerable <Roletbl> DeleteRole(Roletbl ls)
 {
     return(objRoleDA.RoleAll(5, ls));
 }
示例#12
0
 public IEnumerable <Roletbl> UpdateRole(Roletbl ls)
 {
     return(objRoleDA.RoleAll(4, ls));
 }
示例#13
0
 public IEnumerable <Roletbl> SaveRole(Roletbl ls)
 {
     return(objRoleDA.RoleAll(3, ls));
 }
示例#14
0
 public IEnumerable <Roletbl> GetRoleById(Roletbl ls)
 {
     return(objRoleDA.RoleAll(2, ls));
 }
示例#15
0
 public IEnumerable <Roletbl> GetAllRole(Roletbl ls)
 {
     return(objRoleDA.RoleAll(1, ls));
 }