Exemplo n.º 1
0
        public ActionResult GetConditiondetails()
        {
            int intassid = Convert.ToInt32(Session["IntakeassId"]);
            // get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;
            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            PCMHBSModel assModel = new PCMHBSModel();

            PCMHBSViewModel assVM = new PCMHBSViewModel();

            assVM.Condition_List   = assModel.GetCondition();
            ViewBag.Condition_List = new SelectList(db.apl_PCM_Conditions.ToList(), "Condition_Id", "Description");

            return(PartialView(assVM));
        }
Exemplo n.º 2
0
        public ActionResult CreateConditions(PCMHBSViewModel vm)
        {
            int intassid = Convert.ToInt32(Session["IntakeassId"]);
            // get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;
            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            PCMHBSModel assModel = new PCMHBSModel();

            PCMHBSViewModel assVM = new PCMHBSViewModel();

            // get recomendation Id for insert..................
            int HomebaseId = assModel.GetPCMHBByassId(intassid);

            ViewBag.Error = null;
            if (vm.Condition_Id != null && HomebaseId != 0)
            {
                var selectedItems = db.apl_PCM_Conditions.Where(p => vm.Condition_Id.Contains((p.Condition_Id))).ToList();



                if (selectedItems != null)
                {
                    foreach (var selectedItem in selectedItems)
                    {
                        int Condition_Id = selectedItem.Condition_Id;
                        assModel.CreatePCMConditionsDeatils(vm, HomebaseId, Condition_Id, userId);
                    }
                }
            }

            else

            {
                ViewBag.Error = string.Format("Error you must add Home base under recommendation", DateTime.Now.ToString());
            }

            return(RedirectToAction("Home", "PCMHBS", new { Id = intassid }));
        }
Exemplo n.º 3
0
        public JsonResult CreateHBS(PCMHBSViewModel vm)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }

            PCMHBSModel cm = new PCMHBSModel();


            //int PlacementID = Convert.ToInt32(Session["Placementid"]);


            int assID = Convert.ToInt32(Session["IntakeassId"]);


            var result = false;

            try
            {
                if (vm.HomeBasedSupervision_Id > 0)
                {
                    cm.UpdateHBS(vm, userId, vm.HomeBasedSupervision_Id, assID);
                    result = true;

                    result = true;
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult GetVOById(int HB_Visitaion_Outcome_Id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            int assID = Convert.ToInt32(Session["IntakeassId"]);


            PCM_HB_VistationOutcome model = db.PCM_HB_VistationOutcome.Where(x => x.HB_Visitaion_Outcome_Id == HB_Visitaion_Outcome_Id).SingleOrDefault();

            PCMHBSModel     m  = new PCMHBSModel();
            PCMHBSViewModel vm = new PCMHBSViewModel();
            var             Compliance_Type = m.GetComplianceType();

            vm.Compliance_Type      = m.GetComplianceType();
            ViewBag.Compliance_List = new SelectList(db.apl_PCM_Compliance.ToList(), "Compliance_Id", "Description");
            using (SDIIS_DatabaseEntities db = new SDIIS_DatabaseEntities())
            {
                db.Configuration.LazyLoadingEnabled = false;

                vm = m.GetVisitationOutcometById(HB_Visitaion_Outcome_Id);

                string value = string.Empty;
                value = JsonConvert.SerializeObject(vm, Formatting.Indented, new JsonSerializerSettings
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                });
                return(Json(value, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
        public ActionResult DeleteConditionFromTable(int id)
        {
            int intassid = Convert.ToInt32(Session["IntakeassId"]);
            // get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;
            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            PCMHBSModel assModel = new PCMHBSModel();

            PCMHBSViewModel assVM = new PCMHBSViewModel();

            if (id != 0)
            {
                try
                {
                    assModel.DeleteConditionRecord(id);
                }
                catch (Exception ex)
                {
                    //Log errror
                }
            }

            //return "failed";
            return(RedirectToAction("Index", "PCMHBS", new { Id = intassid }));
        }
Exemplo n.º 6
0
        public ActionResult GetSelectedConditionsFromDB()
        {
            int intassid = Convert.ToInt32(Session["IntakeassId"]);
            // get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;
            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            PCMHBSModel assModel = new PCMHBSModel();

            PCMHBSViewModel assVM = new PCMHBSViewModel();

            int HomebaseId = assModel.GetPCMHBByassId(intassid);

            if (HomebaseId != 0)
            {
                List <PCMHBSViewModel> OurList = assModel.GetSelectedConditionFromDB(HomebaseId);
                return(PartialView(OurList));
            }
            return(PartialView());
        }