Ejemplo n.º 1
0
        internal string SaveMapping(PLOToPEO PLOToPEO, string name)
        {
            try
            {
                PLOToPEO.PLO = PLOService.FindById(PLOToPEO.PLO.Id, name);

                if (PLOToPEO.MapPEOLists.Count > 0)
                {
                    foreach (var item in PLOToPEO.MapPEOLists)
                    {
                        PLOToPEOMapping PLOToPEOMapping = new PLOToPEOMapping()
                        {
                            PLO    = PLOToPEO.PLO,
                            PEO    = PEOService.FindById(item.PEO.Id, name),
                            Points = item.Points
                        };
                        if (!IsExistMapping(PLOToPEOMapping, name))
                        {
                            Save(PLOToPEOMapping, name);
                        }
                    }
                    return(null);
                }
                else
                {
                    return(Messages.InvalidField);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(ex.Message);
            }
        }
 public ActionResult PLOToPEOEdit(int id)
 {
     if (id > 0)
     {
         PLOToPEO PLOToPEO = PLOToPEOMappingService.FindByPLOId(id, User.Identity.Name);
         return(View(PLOToPEO));
     }
     return(View());
 }
        /// -------------------------------- PLO TO PEO ------------------------------------ ///

        public ActionResult PLOToPEODetails(int id)
        {
            if (id > 0)
            {
                PLOToPEO PLOToPEOMapping = PLOToPEOMappingService.FindByPLOId(id, User.Identity.Name);
                return(PartialView("Partial/PLOToPEODetails", PLOToPEOMapping));
            }
            return(View());
        }
Ejemplo n.º 4
0
 internal string UpdateMapping(PLOToPEO PLOToPEO, string name)
 {
     try
     {
         if (PLOToPEO.MapPEOLists.Count > 0)
         {
             PLOToPEO.PLO = PLOService.FindById(PLOToPEO.PLO.Id, name);
             if (PLOToPEO != null)
             {
                 foreach (var item in PLOToPEO.MapPEOLists)
                 {
                     PLOToPEOMapping PLOToPEOMapping = new PLOToPEOMapping()
                     {
                         PLO    = PLOToPEO.PLO,
                         PEO    = PEOService.FindById(item.PEO.Id, name),
                         Points = item.Points
                     };
                     if (!IsExistMapping(PLOToPEOMapping, name))
                     {
                         Save(PLOToPEOMapping, name);
                     }
                     else
                     {
                         var deleteorUpdate = FindAll(name).Find(mp => mp.PLO.Id == PLOToPEOMapping.PLO.Id && mp.PEO.Id == PLOToPEOMapping.PEO.Id);
                         PLOToPEOMapping.Id = deleteorUpdate.Id;
                         Update(PLOToPEOMapping, name);
                     }
                 }
                 return(null);
             }
             else
             {
                 return(Messages.PLONotFound);
             }
         }
         else
         {
             return(Messages.InvalidField);
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         return(ex.Message);
     }
 }
Ejemplo n.º 5
0
        private PLOToPEO FindPLOToPEOByPLOId(int PLOId, string currentUsername)
        {
            List <PLOToPEOMapping> PLOToPEOMappings = FindAll(currentUsername).FindAll(PLOToPEOMapping => PLOToPEOMapping.PLO.Id == PLOId);
            PLOToPEO PLOToPEO = new PLOToPEO();

            PLOToPEO.PLO         = (PLOToPEOMappings.Count > 0) ? PLOToPEOMappings[0].PLO : null;
            PLOToPEO.MapPEOLists = new List <MapPEO>();

            foreach (var items in PLOToPEOMappings)
            {
                MapPEO mapPEO = new MapPEO()
                {
                    PEO    = items.PEO,
                    Points = items.Points
                };
                PLOToPEO.MapPEOLists.Add(mapPEO);
            }
            return(PLOToPEO);
        }
 public ActionResult PLOToPEOCreate(PLOToPEO PLOToPEO)
 {
     if (ModelState.IsValid)
     {
         string message = PLOToPEOMappingService.SaveMapping(PLOToPEO, User.Identity.Name);
         if (string.IsNullOrEmpty(message))
         {
             TempData["Success"] = Messages.Created;
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewData["Warning"] = message;
         }
     }
     else
     {
         ViewData["Error"] = Messages.InvalidField;
     }
     return(View());
 }
Ejemplo n.º 7
0
        public PLOToPEO FindByPLOId(int id, string CurrentUsername)
        {
            PLOToPEO FoundedPLOToPEO = FindPLOToPEOByPLOId(id, CurrentUsername);

            return(FoundedPLOToPEO);
        }