Exemplo n.º 1
0
 public JsonResult DeletePage(int id)
 {
     try
     {
         Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
         int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));
         if (userGroupId != 0)
         {
             ISecurityFactory _securityLogInFactory = new SecurityFactorys();
             PagePermissionVM tblUserActionMapping  = _securityLogInFactory.GetCrudPermission(userGroupId, "Page");
             if (tblUserActionMapping.Delete)
             {
                 securityFactory = new SecurityFactorys();
                 result          = securityFactory.DeleteUiPage(id);
                 if (result.isSucess)
                 {
                     return(Json(result, JsonRequestBehavior.AllowGet));
                 }
                 return(Json(new { isSucess = false, message = "You cant delete this another one use this User Group" }, JsonRequestBehavior.AllowGet));
             }
             return(Json(new { isSucess = false, message = "You are not permitted for this action" }, JsonRequestBehavior.AllowGet));
         }
         return(Json(new { isSucess = false, message = "LogOut" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { isSucess = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 2
0
 public JsonResult Delete(int id)
 {
     try
     {
         Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
         int companyId = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id));
         if (companyId != 0)
         {
             int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));
             ISecurityFactory _securityLogInFactory = new SecurityFactorys();
             PagePermissionVM tblUserActionMapping  = _securityLogInFactory.GetCrudPermission(userGroupId, "User");
             if (tblUserActionMapping.Delete)
             {
                 _userFactory = new UserFactory();
                 _userFactory.Delete(x => x.ID == id);
                 _userFactory.Save();
                 return(Json(new { success = true, message = "Deleted Successfuly" }, JsonRequestBehavior.AllowGet));
             }
             return(Json(new { success = false, message = "You has no delete permission" }, JsonRequestBehavior.AllowGet));
         }
         return(Json(new { success = false, message = "LogOut" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = "Another page use this User data" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 3
0
        public JsonResult GetSiteMenu()
        {
            Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
            int _userGroupID = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));
            ISecurityFactory _securityLogInFactory = new SecurityFactorys();
            var _menu = _securityLogInFactory.PagePermissedList(_userGroupID);

            return(Json(new { menu = _menu, userGroupID = _userGroupID }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult CreateCompanyBranch()
        {
            Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
            int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));

            if (userGroupId != 0)
            {
                ISecurityFactory securityLogInFactory = new SecurityFactorys();
                PagePermissionVM tblUserActionMapping = securityLogInFactory.GetCrudPermission(userGroupId, "CompanyBranch");
                if (tblUserActionMapping.Create)
                {
                    DefaultLoad();
                    return(View());
                }
            }
            Session["logInSession"] = null;
            return(Redirect("/#!/"));
        }
Exemplo n.º 5
0
 public JsonResult ActiveDeActiveUser(int id, bool status)
 {
     try
     {
         Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
         int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));
         if (userGroupId != 0)
         {
             ISecurityFactory _securityLogInFactory = new SecurityFactorys();
             PagePermissionVM tblUserActionMapping  = _securityLogInFactory.GetCrudPermission(userGroupId, "User");
             if (tblUserActionMapping.Edit)
             {
                 _userGroupFactory = new UserGroupFactory();
                 _userFactory      = new UserFactory();
                 int userId = Convert.ToInt32(dictionary[3].Id);
                 SEC_UserInformation user      = _userFactory.FindBy(x => x.ID == userId).FirstOrDefault();
                 SEC_UserGroup       userGroup = _userGroupFactory.FindBy(x => x.ID == user.UserGroupID).FirstOrDefault();
                 if (userGroup != null && userGroup.IsAdmin)
                 {
                     _userFactory = new UserFactory();
                     SEC_UserInformation tblUserInformation = _userFactory.FindBy(x => x.ID == id).FirstOrDefault();
                     if (tblUserInformation != null)
                     {
                         tblUserInformation.IsActive = status;
                         _userFactory.Edit(tblUserInformation);
                     }
                     _userFactory.Save();
                     if (status)
                     {
                         return(Json(new { success = true, message = "Sucessifuly activeted the User" }, JsonRequestBehavior.AllowGet));
                     }
                     return(Json(new { success = true, message = "Sucessifuly de-activeted the User" }, JsonRequestBehavior.AllowGet));
                 }
                 return(Json(new { success = false, message = "You are not Admin User" }, JsonRequestBehavior.AllowGet));
             }
             return(Json(new { success = false, message = "You has no permission for edit" }, JsonRequestBehavior.AllowGet));
         }
         return(Json(new { success = false, message = "LogOut" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 6
0
        public ActionResult VisitorINOut()
        {
            int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));

            if (userGroupId != 0)
            {
                ISecurityFactory securityLogInFactory = new SecurityFactorys();
                PagePermissionVM tblUserActionMapping = securityLogInFactory.GetCrudPermission(userGroupId, "VisitorINOut");
                if (tblUserActionMapping.Select == true)
                {
                    ViewBag.CallingForm     = "Security";
                    ViewBag.CallingForm1    = "Visitor In Out";
                    ViewBag.CallingViewPage = "#";
                    return(View());
                }
            }
            Session["logInSession"] = null;
            return(Redirect("/#!/"));
        }
        public ActionResult PasswordChangeByAdmin()
        {
            Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
            int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));

            if (userGroupId != 0)
            {
                ISecurityFactory _securityLogInFactory = new SecurityFactorys();
                PagePermissionVM tblUserActionMapping  = _securityLogInFactory.GetCrudPermission(userGroupId, "ChangePasswordByAdmin");
                if (tblUserActionMapping.Select)
                {
                    ViewBag.CallingForm     = "Security";
                    ViewBag.CallingForm1    = "Reset Password";
                    ViewBag.CallingViewPage = "#";
                    return(View());
                }
            }
            return(Redirect("/Login"));
        }
        public ActionResult UnScheduleAppointmentList()
        {
            int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));

            if (userGroupId != 0)
            {
                ISecurityFactory securityLogInFactory = new SecurityFactorys();
                PagePermissionVM tblUserActionMapping = securityLogInFactory.GetCrudPermission(userGroupId, "UnSchedule");
                if (tblUserActionMapping.Select)
                {
                    ViewBag.CallingForm     = "Appointment";
                    ViewBag.CallingForm1    = "UnSchedule Appointment";
                    ViewBag.CallingViewPage = "#";
                    return(View());
                }
            }
            Session["logInSession"] = null;
            return(Redirect("/#!/"));
        }
Exemplo n.º 9
0
        public ActionResult CompanyBranchList()
        {
            Dictionary <int, CheckSessionData> dictionary = CheckSessionData.GetSessionValues();
            int userGroupId = Convert.ToInt32(dictionary[6].Id == "" ? 0 : Convert.ToInt32(dictionary[6].Id));

            if (userGroupId != 0)
            {
                ISecurityFactory securityLogInFactory = new SecurityFactorys();
                PagePermissionVM tblUserActionMapping = securityLogInFactory.GetCrudPermission(userGroupId, "CompanyBranch");
                if (tblUserActionMapping.Select)
                {
                    ViewBag.CallingForm     = "VMS";
                    ViewBag.CallingForm1    = "Branch";
                    ViewBag.CallingViewPage = "#";
                    return(View());
                }
            }
            Session["logInSession"] = null;
            return(Redirect("/#!/"));
        }