Exemplo n.º 1
0
 public string AddSubObjectAccessChanges(ManageSubObjectAccessViewModel manageSubObjectAccessViewModelObj)
 {
     try
     {
         AppUA _appUA = Session["AppUA"] as AppUA;
         //if (ModelState.IsValid)
         // {
         manageSubObjectAccessViewModelObj.commonObj             = new PSASysCommonViewModel();
         manageSubObjectAccessViewModelObj.commonObj.CreatedBy   = _appUA.UserName;
         manageSubObjectAccessViewModelObj.commonObj.CreatedDate = _appUA.LoginDateTime;
         foreach (ManageSubObjectAccessViewModel ManageSubObjectAccessObj in manageSubObjectAccessViewModelObj.ManageSubObjectAccessList)
         {
             ManageSubObjectAccessObj.commonObj = new PSASysCommonViewModel();
             ManageSubObjectAccessObj.commonObj = manageSubObjectAccessViewModelObj.commonObj;
         }
         ManageSubObjectAccessViewModel r = Mapper.Map <ManageSubObjectAccess, ManageSubObjectAccessViewModel>(_manageAccessBusiness.AddSubObjectAccessChanges(Mapper.Map <List <ManageSubObjectAccessViewModel>, List <ManageSubObjectAccess> >(manageSubObjectAccessViewModelObj.ManageSubObjectAccessList)));
         return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = r }));
         //}
     }
     catch (Exception ex)
     {
         ConstMessage cm = c.GetMessage(ex.Message);
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message }));
     }
 }
Exemplo n.º 2
0
        public ActionResult SubobjectIndex(string id)
        {
            ViewBag.objectID = id;
            string Appid = Request.QueryString["appId"].ToString();

            ViewBag.AppID = Appid;
            ManageSubObjectAccessViewModel _manageSubObjectAccessViewModelObj = new ManageSubObjectAccessViewModel();
            List <SelectListItem>          selectListItem = new List <SelectListItem>();

            selectListItem = new List <SelectListItem>();
            List <AppObjectViewModel> List = Mapper.Map <List <AppObject>, List <AppObjectViewModel> >(__appObjectBusiness.GetAllAppObjects(Guid.Parse(Appid)));

            foreach (AppObjectViewModel Appl in List)
            {
                if (Appl.ID == Guid.Parse(id))
                {
                    selectListItem.Add(new SelectListItem
                    {
                        Text     = Appl.ObjectName,
                        Value    = Appl.ID.ToString(),
                        Selected = true
                    });
                }
                else
                {
                    selectListItem.Add(new SelectListItem
                    {
                        Text     = Appl.ObjectName,
                        Value    = Appl.ID.ToString(),
                        Selected = false
                    });
                }
            }
            _manageSubObjectAccessViewModelObj.ObjectList = selectListItem;
            selectListItem = new List <SelectListItem>();
            List <RolesViewModel> RoleList = Mapper.Map <List <Roles>, List <RolesViewModel> >(_rolesBusiness.GetAllAppRoles(Guid.Parse(Appid)));

            foreach (RolesViewModel Appl in RoleList)
            {
                selectListItem.Add(new SelectListItem
                {
                    Text     = Appl.RoleName,
                    Value    = Appl.ID.ToString(),
                    Selected = false
                });
            }
            _manageSubObjectAccessViewModelObj.RoleList        = selectListItem;
            _manageSubObjectAccessViewModelObj.AppObjectObj    = new AppObjectViewModel();
            _manageSubObjectAccessViewModelObj.AppObjectObj.ID = Guid.Parse(ViewBag.objectID != null ? ViewBag.objectID : Guid.Empty);
            return(View(_manageSubObjectAccessViewModelObj));
        }