Exemple #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                RoleMaster r = new RoleMaster();
                r.RoleId = Convert.ToInt32(textBox1.Text);
                //r.Role = textBox2.Text;
                //if (comboBox1.SelectedItem == "Active")
                //{
                //    r.RoleActive = "Active";
                //}

                //else
                //{
                //    r.RoleActive = "InActive";
                //}

                RoleMasterBL bl = new RoleMasterBL();
                int          n  = bl.DeleteRoldata(r);
                MessageBox.Show("Record is Deleted...");
            }

            catch (Exception ex)
            {
                MessageBox.Show("Records are not Saved...Please Try Again");
            }

            finally
            {
                DisableControls(this);
            }
        }
Exemple #2
0
        public ActionResult DeleteRoleMaster(int RoleId /*, ref string recordCount*/)
        {
            RoleMasterBL bL             = new RoleMasterBL();
            int          recordaffected = bL.DeleteRoleMaster(RoleId /*, ref recordCount*/);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SaveRoleGroup(RoleGroup pOCO)
        {
            RoleMasterBL bL = new RoleMasterBL();
            RoleGroup    pC = new RoleGroup();

            pC.RoleId  = pOCO.RoleId;
            pC.GroupId = pOCO.GroupId;

            return(Json(bL.SaveRoleGroup(pC /*, int.Parse(Session["VesselID"].ToString())*/), JsonRequestBehavior.AllowGet));
        }
        protected void delete(object sender, GridViewDeleteEventArgs e)
        {
            CPT_RoleMaster Roledetails = new CPT_RoleMaster();
            int            id          = int.Parse(gvRole.DataKeys[e.RowIndex].Value.ToString());

            Roledetails.RoleMasterID = id;

            RoleMasterBL deleteRole = new RoleMasterBL();

            deleteRole.Delete(Roledetails);
            BindGrid();
        }
Exemple #5
0
        public JsonResult SaveUpdateRoleMaster(RoleMasterPOCO pOCO)
        {
            RoleMasterBL   bL = new RoleMasterBL();
            RoleMasterPOCO pC = new RoleMasterPOCO();

            pC.RoleId = pOCO.RoleId;

            pC.RoleName   = pOCO.RoleName;
            pC.CreatedBy  = pOCO.CreatedBy;
            pC.ModifiedBy = pOCO.ModifiedBy;

            return(Json(bL.SaveUpdateRoleMaster(pC /*, int.Parse(Session["VesselID"].ToString())*/), JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public JsonResult LoadData()
        {
            int draw, start, length;
            int pageIndex = 0;

            if (null != Request.Form.GetValues("draw"))
            {
                draw   = int.Parse(Request.Form.GetValues("draw").FirstOrDefault().ToString());
                start  = int.Parse(Request.Form.GetValues("start").FirstOrDefault().ToString());
                length = int.Parse(Request.Form.GetValues("length").FirstOrDefault().ToString());
            }
            else
            {
                draw   = 1;
                start  = 0;
                length = 500;
            }

            if (start == 0)
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = (start / length) + 1;
            }

            RoleMasterBL bL           = new RoleMasterBL();
            int          totalrecords = 0;

            List <RoleMasterPOCO> pocoList = new List <RoleMasterPOCO>();

            pocoList = bL.GetAllRoleMasterPageWise(pageIndex, ref totalrecords, length /*, int.Parse(Session["VesselID"].ToString())*/);
            List <RoleMasterPOCO> pList = new List <RoleMasterPOCO>();

            foreach (RoleMasterPOCO pC in pocoList)
            {
                RoleMasterPOCO pOCO = new RoleMasterPOCO();
                pOCO.RoleId   = pC.RoleId;
                pOCO.RoleName = pC.RoleName;
                //pOCO.CreatedBy = pC.CreatedBy;
                //pOCO.ModifiedBy = pC.ModifiedBy;

                pList.Add(pOCO);
            }

            var data = pList;

            return(Json(new { draw = draw, recordsFiltered = totalrecords, recordsTotal = totalrecords, data = data }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetRoleByGroupId(int GroupId)
        {
            RoleMasterBL   bL       = new RoleMasterBL();
            RoleMasterPOCO pOCOList = new RoleMasterPOCO();

            pOCOList = bL.GetRoleByGroupId(GroupId);

            RoleMasterPOCO dept = new RoleMasterPOCO();

            dept.RoleId   = pOCOList.RoleId;
            dept.RoleName = pOCOList.RoleName;

            var data = dept;

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
        public JsonResult GetRoleMasterByRoleId(int RoleId)
        {
            RoleMasterBL   bL       = new RoleMasterBL();
            RoleMasterPOCO pOCOList = new RoleMasterPOCO();

            pOCOList = bL.GetRoleMasterByRoleId(RoleId);

            RoleMasterPOCO dept = new RoleMasterPOCO();

            dept.RoleId   = pOCOList.RoleId;
            dept.RoleName = pOCOList.RoleName;
            //dept.CreatedBy = pOCOList.CreatedBy;
            //dept.ModifiedBy = pOCOList.ModifiedBy;

            var data = dept;

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        protected void RoleAddButton_Click(object sender, EventArgs e)
        {
            try
            {
                CPT_RoleMaster Roledetails = new CPT_RoleMaster();
                Roledetails.RoleName         = RoleNameTextBox.Text;
                Roledetails.Show_in_Dropdown = true;
                Roledetails.IsActive         = true;

                RoleMasterBL insertRole = new RoleMasterBL();
                insertRole.Insert(Roledetails);
                BindGrid();
                CleartextBoxes(this);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 protected void update(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         CPT_RoleMaster Roledetails = new CPT_RoleMaster();
         int            id          = int.Parse(gvRole.DataKeys[e.RowIndex].Value.ToString());
         Roledetails.RoleMasterID = id;
         string       RoleName = ((TextBox)gvRole.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
         DropDownList ddl      = (DropDownList)gvRole.Rows[e.RowIndex].FindControl("ddlShow");
         Roledetails.RoleName         = RoleName;
         Roledetails.Show_in_Dropdown = ddl.SelectedValue == "0"? false : true;
         RoleMasterBL updateRole = new RoleMasterBL();
         updateRole.Update(Roledetails);
         gvRole.EditIndex = -1;
         BindGrid();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public void GetAllRoles()
        {
            RoleMasterBL     bL       = new RoleMasterBL();
            List <RoleGroup> pocoList = new List <RoleGroup>();

            pocoList = bL.GetAllRoles(/*int.Parse(Session["VesselID"].ToString())*/);
            List <RoleGroup> itmasterList = new List <RoleGroup>();

            foreach (RoleGroup up in pocoList)
            {
                RoleGroup unt = new RoleGroup();
                unt.RoleId   = up.RoleId;
                unt.RoleName = up.RoleName;

                itmasterList.Add(unt);
            }

            ViewBag.Roles = itmasterList.Select(x =>
                                                new SelectListItem()
            {
                Text  = x.RoleName,
                Value = x.RoleId.ToString()
            });
        }
 protected void BindGrid()
 {
     RoleMasterBL.getRole(gvRole);
 }