Ejemplo n.º 1
0
        public JsonResult GetallsubModule()
        {
            var objDtl  = new RoleComponent();
            var modules = objDtl.GetallsubModule();

            return(Json(modules, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public string DeleteRole(int RoleID)
        {
            string strResponse = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var Org = new RoleComponent();
                    int r   = Org.DeleteRoleDetail(RoleID);

                    if (r > 0)
                    {
                        strResponse = "Role deleted successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Role does not exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in DeleteRole";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
Ejemplo n.º 3
0
        //private static void ExportPDF<TSource>(IList<TSource> RoleList, string[] columns, string filePath)
        //{
        //    iTextSharp.text.Font headerFont = FontFactory.GetFont("Verdana", 10, iTextSharp.text.Color.WHITE);
        //    iTextSharp.text.Font rowfont = FontFactory.GetFont("Verdana", 10, iTextSharp.text.Color.BLUE);
        //    Document document = new Document(PageSize.A4);

        //    PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePath, FileMode.OpenOrCreate));
        //    document.Open();
        //    PdfPTable table = new PdfPTable(columns.Length);
        //    foreach (var column in columns)
        //    {
        //        PdfPCell cell = new PdfPCell(new Phrase(column, headerFont));
        //        cell.BackgroundColor = iTextSharp.text.Color.BLACK;
        //        table.AddCell(cell);
        //    }

        //    foreach (var item in RoleList)
        //    {
        //        foreach (var column in columns)
        //        {
        //            string value = item.GetType().GetProperty(column).GetValue(item).ToString();
        //            PdfPCell cell5 = new PdfPCell(new Phrase(value, rowfont));
        //            table.AddCell(cell5);
        //        }
        //    }

        //    document.Add(table);
        //    document.Close();
        //}
        #endregion

        public JsonResult CheckModule(int modid)
        {
            var objDtl  = new RoleComponent();
            var modules = objDtl.Getsubmodules(modid);

            return(Json(modules, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public string CreateRole(List <RoleEntity> moduleaccess, RoleEntity RoleDtl)
        {
            var    rolecomponent = new RoleComponent();
            string response      = rolecomponent.AddRole(moduleaccess, RoleDtl);

            return(response);
        }
Ejemplo n.º 5
0
        public string ChangeStatus(string id, string status)
        {
            string strResponse = string.Empty;
            var    objDtl      = new RoleComponent();

            strResponse = objDtl.ChangeStatus(id, status);

            return(strResponse);
        }
Ejemplo n.º 6
0
        public JsonResult Getmodulesselected(int catID)
        {
            List <RoleEntity> RoleDetails = null;

            try
            {
                var objDtl = new RoleComponent();
                RoleDetails = objDtl.Getmodulesselected(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(RoleDetails, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public JsonResult GetRoleByID(int catID)
        {
            RoleEntity RoleDetails = null;

            try
            {
                var objDtl = new RoleComponent();
                RoleDetails = objDtl.GetRoleDetailByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(RoleDetails, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        public JsonResult GetRoleHistoryByID(int ID)
        {
            List <History_RoleEntity> HisRoleDetails = null;

            try
            {
                var objDtl = new RoleComponent();
                HisRoleDetails      = objDtl.GetHistoryRoleDetailsByID(ID);
                ViewBag.RoleDetails = HisRoleDetails;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(HisRoleDetails, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public string UpdateRole(int id, List <RoleEntity> moduleaccess, RoleEntity RoleDtl)
        {
            var    rolecomponent = new RoleComponent();
            var    Response      = rolecomponent.DeleteRolemodules(id);
            string response      = string.Empty;

            if (Response == true)
            {
                response = rolecomponent.UpdateRole(id, moduleaccess, RoleDtl);
                response = "Successfully updated";
            }
            else
            {
                response = "Not  updated";
            }
            return(response);
        }
Ejemplo n.º 10
0
        public void AddComponent(int componentId, string actions)
        {
            RoleComponent _rmi = null;

            if (_RoleComponents == null)
            {
                _RoleComponents = new List <RoleComponent>();
            }
            else
            {
                _rmi = _RoleComponents.FirstOrDefault(rmi => rmi.ComponentId == componentId);
            }

            if (_rmi != null)
            {
                _RoleComponents.Remove(_rmi);
            }

            _RoleComponents.Add(new RoleComponent(this.Id, componentId, actions));
        }
Ejemplo n.º 11
0
        internal void AddComponent(Dictionary <string, object> property_values)
        {
            RoleComponent rc = new RoleComponent(property_values);

            if (_RoleComponents != null)
            {
                int compId = rc.ComponentId;
                var _rc    = _RoleComponents.FirstOrDefault(x => x.ComponentId == compId);
                if (_rc == null)
                {
                    _RoleComponents.Add(rc);
                }
            }
            else
            {
                _RoleComponents = new List <RoleComponent>
                {
                    rc
                };
            }
        }
Ejemplo n.º 12
0
        public JsonResult GetRoleCollection()
        {
            UserSessionInfo info     = new UserSessionInfo();
            var             rolename = info.RoleName;

            int accountid = info.AccountId;
            List <RoleEntity> RoleDetails = null;

            try
            {
                var objDtl = new RoleComponent();
                RoleDetails         = objDtl.GetRoleDetail(accountid, rolename);
                ViewBag.RoleDetails = RoleDetails[0].Rol_Version;
                ViewBag.sessionname = info.RoleName;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(RoleDetails, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 13
0
        //UserSessionInfo objSessioninfo = new UserSessionInfo();

        public ActionResult Index(bool?pdf)
        {
            var RoleComponent = new RoleComponent();

            HomeController hm  = new HomeController();
            var            obj = hm.GetAdminMenu();


            var mk = "read";

            foreach (var item in obj)
            {
                //if (item.ModuleAccessType == "Read")
                //{
                //    var mk = item.ModuleAccessType;


                //    ViewBag.a = mk;

                //}
                if (item.ModuleName == "Add Role")
                {
                    mk = item.ModuleAccessType;


                    ViewBag.a = mk;
                }
            }
            if (!pdf.HasValue)
            {
                #region to return RoleList

                //objSessioninfo.UserId = 501;
                //Session["UserSessionInfo"] = objSessioninfo;
                UserSessionInfo info      = new UserSessionInfo();
                var             rolename  = info.RoleName;
                int             userid    = info.UserId;
                int             accountId = info.AccountId;
                string          RoleId    = info.RoleName;
                ViewBag.accid = accountId;
                var orgcomponent = new OrganizationAccountComponent();
                List <LookupStatusDetail> objStatusList = new List <LookupStatusDetail>();
                objStatusList.Add(new LookupStatusDetail {
                    StatusID = 1, Status = "Active"
                });
                objStatusList.Add(new LookupStatusDetail {
                    StatusID = 0, Status = "InActive"
                });

                var objStList = from cl in objStatusList
                                orderby cl.StatusID
                                select new
                {
                    value = cl.StatusID,
                    text  = cl.Status
                };
                ViewBag.Status = objStList;

                var modules = RoleComponent.Getallmodules();
                ViewBag.modules = modules;
                ViewBag.Roleid  = info.RoleName;
                var access = RoleComponent.Getallaccess();
                ViewBag.access = access;
                var objDtl = new UserComponent();
                LeaveSchemeComponent compobj = new LeaveSchemeComponent();
                var AccountNames             = compobj.GetallAccountnames(accountId, RoleId).Select(a => new SelectListItem()
                {
                    Value = a.Acc_AccountID.ToString(),
                    Text  = a.Acc_AccountName,
                });

                ViewBag.accountnames = AccountNames;
                var rolenames = orgcomponent.Getrolenames(rolename).Select(a => new SelectListItem()
                {
                    Value = a.GenericRoleID.ToString(),
                    Text  = a.Title,
                });
                ViewBag.rolenames = rolenames;
                return(View());

                #endregion
            }
            else
            {
                UserSessionInfo info     = new UserSessionInfo();
                var             rolename = info.RoleName;
                ViewBag.Roleid = info.RoleName;
                int    accountid = info.AccountId;
                string filename  = "Role.pdf";
                string filePath  = Server.MapPath("~/Content/PDFs/" + filename);

                var objDtl = new RoleComponent();
                IList <RoleEntity> RoleList = objDtl.GetRoleDetail(accountid, rolename);

                //ExportPDF(RoleList, new string[] { "Rol_RoleID", "AccountName", "Rol_RoleCode", "Rol_RoleName", "Rol_RoleDescription" }, filePath);

                return(File(filePath, "application/pdf"));
            }
        }