public ActionResult GetListClient()
        {
            List<MPerson> ListPerson = new List<MPerson>();
            ListPerson = PersonController.fnListPerson(null, 1); //1-cliente

            return Json(ListPerson, JsonRequestBehavior.AllowGet); 
        }
        public ActionResult GetListEmployee()
        {
            List <MPerson> ListPerson = new List <MPerson>();

            ListPerson = PersonController.fnListPerson(null, 2); //2-empleado

            return(Json(ListPerson, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult GetListPersonWithoutUser()
        {
            List <MPerson> ListPerson = new List <MPerson>();

            ListPerson = PersonController.fnListPerson(null, 2, null, true);

            List <MUser> ListUser = new List <MUser>();

            ListUser = fnListUser();

            List <MPerson> ListPersonWithoutUser = new List <MPerson>();

            ListPersonWithoutUser = ListPerson.Where(p => ListUser.All(p2 => p2.IdPerson != p.IdPerson)).ToList();

            return(Json(ListPersonWithoutUser, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public ActionResult Index()
        {
            if (Session["Usuario"] == null)
            {
                return(RedirectToAction("Login", "User"));
            }
            else
            {
                MStatistics objStatistics = new MStatistics();

                int intEmployee = PersonController.fnListPerson(null, 2, null, true).Count(); //2-empleado
                objStatistics.NroEmployee = intEmployee;

                int intClient = PersonController.fnListPerson(null, 1, null, true).Count(); //1-Client
                objStatistics.NroClient = intClient;

                objStatistics.ServicesProcess   = 0;
                objStatistics.servicesCompleted = 0;

                MMEnterprisesEntities db = new MMEnterprisesEntities();
                var Service = ServiceRequestController.fnListServiceRequest(null, null, null, null, null); //1-Client
                if (Service != null && Service.Count > 0)
                {
                    var ListTableCatalog = db.VWListCatalog.Where(t => t.IdTable == "SERVICESTATUS").ToList();
                    if (ListTableCatalog.Count > 0)
                    {
                        var objProcesando = ListTableCatalog.Where(p => p.DetailDesc == "Procesando").First();
                        var objFinalizado = ListTableCatalog.Where(p => p.DetailDesc == "Finalizado").First();
                        if (objProcesando != null)
                        {
                            var ServicesProcess = Service.FindAll(p => p.IdServiceStatus == objProcesando.IdCatalogDetail).ToList();
                            objStatistics.ServicesProcess = ServicesProcess.Count();
                        }

                        if (objFinalizado != null)
                        {
                            var servicesCompleted = Service.FindAll(p => p.IdServiceStatus == objFinalizado.IdCatalogDetail).ToList();
                            objStatistics.servicesCompleted = servicesCompleted.Count();
                        }
                    }
                }



                return(View(objStatistics));
            }
        }
        // GET: Employee/EditEmployee/5
        public ActionResult EditEmployee(int?id)
        {
            if (Session["Usuario"] == null)
            {
                return(RedirectToAction("Login", "User"));
            }
            var ObjAccesUser = ((MSerUser)Session["Usuario"]).UserAcces;
            var ObjAcces     = ObjAccesUser.Where(p => p.Action == "ListEmployee").First();

            if (ObjAcces != null)
            {
                if (ObjAcces.Edit == false)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            //Aqui se trae el modelo enviado por POST desde la Lista, para que no se vea en la Url
            if (TempData["DataPersonEmployee"] != null)
            {
                var objTempData = Newtonsoft.Json.JsonConvert.DeserializeObject <MPerson>((string)TempData["DataPersonEmployee"]);
                if (objTempData != null && objTempData.IdPerson > 0)
                {
                    id = objTempData.IdPerson;
                }
                else
                {
                    return(RedirectToAction("ListEmployee", "Employee"));
                }
            }
            if (id == null)
            {
                return(RedirectToAction("ListEmployee", "Employee"));
            }
            //-----------------------------------------------------

            MPerson objPersonEmployee = new MPerson();

            objPersonEmployee = PersonController.fnListPerson(id, 2).First(); //2-empleado

            if (TempData["Success"] != null)
            {
                ViewBag.SuccessSave = TempData["Success"];
            }

            return(View(objPersonEmployee));
        }
        // GET: Client/DetailClient/5
        public ActionResult DetailClient(int? id)
        {
            if (Session["Usuario"] == null)
            {
                return RedirectToAction("Login", "User");
            }

            var ObjAccesUser = ((MSerUser)Session["Usuario"]).UserAcces;
            var ObjAcces = ObjAccesUser.Where(p => p.Action == "ListClient").First();
            if (ObjAcces != null)
            {
                if (ObjAcces.Search == false)
                {
                    return RedirectToAction("Index", "Home");
                }
            }

            //Aqui se trae el modelo enviado por POST desde la Lista, para que no se vea en la Url
            if (TempData["DataPersonClient"] != null)
            {
                var objTempData = Newtonsoft.Json.JsonConvert.DeserializeObject<MPerson>((string)TempData["DataPersonClient"]);
                if (objTempData != null && objTempData.IdPerson > 0)
                {
                    id = objTempData.IdPerson;
                }
                else
                {
                    return RedirectToAction("ListClient", "Client");
                }
            }
            if (id == null) 
            {
                return RedirectToAction("ListClient", "Client");
            }
            //-----------------------------------------------------

            MPerson objPersonClient = new MPerson();
            objPersonClient = PersonController.fnListPerson(id, 1).First(); //1-cliente
            return View(objPersonClient);
        }