Exemple #1
0
        public ActionResult UpdatePresentence()
        {
            //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;
                }
            }
            //initialise model repositry
            PCMCaseModel Model = new PCMCaseModel();

            //initialise view model
            PCMPresentenceDetailsViewModel VM = new PCMPresentenceDetailsViewModel();

            return(PartialView("GetPCMPresentense", VM));
        }
        public ActionResult GetSelectedProgrammesFromDB()
        {
            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;
                }
            }
            PCMCaseModel assModel = new PCMCaseModel();

            PCMCaseDetailsViewModel assVM = new PCMCaseDetailsViewModel();

            if (intassid != 0)
            {
                List <PCMCaseDetailsViewModel> OurList = assModel.GetSelectedDivesionFromDB(intassid);
                return(PartialView(OurList));
            }
            return(PartialView());
        }
Exemple #3
0
        // GET: PCMPresentence_Sentence
        #region Child Details
        public ActionResult IndexPresentence(int id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            //instanciate model repositry
            PCMPresentenceModel caseModel = new PCMPresentenceModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM   = new PCMPersonViewModel();
            PCMCaseModel       caseModelC = new PCMCaseModel();
            //get person id by assessment id
            int personId = caseModel.GetPCMPersonIdByintAssId(id);

            //get person record
            personVM = caseModel.GetPCMPerson(personId);

            int ClientRefid = caseModelC.GetClientRefIdssId(id);
            //Get Module Reference number ....................
            string ClientRef = caseModelC.GetClientRef(ClientRefid);

            Session["ClientRef"] = ClientRef;
            ViewBag.ModuleRef    = ClientRef;
            return(PartialView(personVM));
        }
        public ActionResult Index(int id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = id;


            int ClientRefid = caseModel.GetClientRefIdssId(id);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            Session["IntakeassId"] = id;
            ViewBag.ModuleRef      = ClientRef;


            return(PartialView(personVM));
        }
Exemple #5
0
        // GET: HBS
        public ActionResult Home(int id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            //instanciate model repositry
            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = id;

            bool IntakeAssessmentIdExisit = db.PCM_HB_Supervision.Any(x => x.Intake_Assessment_Id == id);


            int ClientRefid = caseModel.GetClientRefIdssId(id);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            Session["IntakeassId"] = id;
            ViewBag.ModuleRef      = ClientRef;

            int?Placementid = preModel.GetPlacementId(id);

            ViewBag.MessagePlacement = Placementid;
            Session["Placement"]     = Placementid;

            if (IntakeAssessmentIdExisit)
            {
                Session["Idc1"]        = id;
                Session["IntakeassId"] = id;


                return(View(personVM));
            }
            else
            {
                Session["Idc1"]        = id;
                Session["IntakeassId"] = id;


                //Response.Write("does not Exist");
                return(View(personVM));
            }
        }
Exemple #6
0
        public ActionResult IndexVO()
        {
            //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"]);
            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = assID;


            int ClientRefid = caseModel.GetClientRefIdssId(assID);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            Session["IntakeassId"] = assID;
            ViewBag.ModuleRef      = ClientRef;
            var Compliance_Type = m.GetComplianceType();

            vm.Compliance_Type      = m.GetComplianceType();
            ViewBag.Compliance_List = new SelectList(db.apl_PCM_Compliance.ToList(), "Compliance_Id", "Description");

            return(PartialView(vm));
        }
        public ActionResult CreateDivesionDiv(PCMCaseDetailsViewModel 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;
                }
            }
            PCMCaseModel assModel = new PCMCaseModel();

            PCMCaseDetailsViewModel assVM = new PCMCaseDetailsViewModel();

            // get recomendation Id for insert..................
            int RecId = assModel.GetPCMRecomendationByassId(intassid);

            if (vm.Div_Program_Id != null)
            {
                var selectedItems = db.apl_Diversion_Programmes.Where(p => vm.Div_Program_Id.Contains((p.Div_Program_Id))).ToList();



                if (selectedItems != null)
                {
                    foreach (var selectedItem in selectedItems)
                    {
                        int Div_Program_Id = selectedItem.Div_Program_Id;
                        assModel.CreatePCMDivesionsDeatils(vm, RecId, Div_Program_Id, userId);
                    }
                }
            }

            return(RedirectToAction("Index", "Assessment", new { Id = intassid }));
        }
        public ActionResult IndexPre(int id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = id;
            return(View(personVM));
        }
        public ActionResult Home(int 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;
                }
            }

            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = id;


            int ClientRefid = caseModel.GetClientRefIdssId(id);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            ViewBag.ModuleRef      = ClientRef;
            Session["IntakeassId"] = id;



            return(View(personVM));
        }
        public ActionResult OffencedeatailsListPre()
        {
            //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;
                }
            }

            string ClientRef = Convert.ToString(Session["ClientRef"]);

            ViewBag.ModuleRef = ClientRef;

            SDIIS_DatabaseEntities db = new SDIIS_DatabaseEntities();

            PCMCaseModel Model = new PCMCaseModel();

            //initialise view model
            PCMCaseDetailsViewModel VM = new PCMCaseDetailsViewModel();

            VM.Offence_List          = Model.GetOffenceCategory();
            VM.OffenseSchedules_List = Model.GetOffenceSchedules();
            VM.OffenceType_List      = Model.GetOffenceType();
            ViewBag.OffenceCategory  = new SelectList(db.Offence_Categories.ToList(), "Offence_Category_Id", "Description");
            ViewBag.OffenceType      = new SelectList(db.apl_Offence_Type.ToList(), "Offence_Type_Id", "Description");
            ViewBag.OffenceSchedule  = new SelectList(db.apl_Offense_Schedules.ToList(), "Offence_Schedule_Id", "Description");

            return(PartialView(VM));
        }
Exemple #11
0
        public ActionResult GetServiceProviderForDivesionDiv()
        {
            int intassid = Convert.ToInt32(Session["IntakeassId"]);

            int orgidSession = Convert.ToInt32(Session["orgid"]);
            // 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;
                }
            }
            PCMCaseModel assModel = new PCMCaseModel();

            PCMCaseDetailsViewModel assVM = new PCMCaseDetailsViewModel();

            assVM.OrganisationType_List  = assModel.GetAllOrganisationType();
            assVM.PCMOrganisation_List   = assModel.GetAllPCMOrganisation();
            assVM.LocalMunicipality_List = assModel.GetAllLocalMunicipality();

            assVM.DiversionProgrammes_List  = assModel.GetAllDiversion_Programmes();
            ViewBag.Province_List           = new SelectList(db.Provinces.ToList(), "Province_Id", "Description");
            ViewBag.District_List           = new SelectList(db.Districts.ToList(), "District_Id", "Description");
            ViewBag.Local_Municipality_List = new SelectList(db.Local_Municipalities.ToList(), "Local_Municipality_Id", "Description");


            return(PartialView(assVM));
        }
        public ActionResult AssessmentRecomendation()
        {
            //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"]);

            PCMCaseModel assModel = new PCMCaseModel();

            PCMCaseDetailsViewModel assVM = new PCMCaseDetailsViewModel();

            int recAssid = assModel.GetPCMRecommendationByassId(assID);

            if (recAssid != 0)
            {
                assVM = assModel.GetRecomendationDetailsList(recAssid);
                assVM.RecommendationTyp_List = assModel.GetRecommendationType();
                assVM.PlacementType_List     = assModel.GetPlacementType();
                Session["recupdate"]         = recAssid;
            }

            return(PartialView(assVM));
        }
        public ActionResult Home(int id)
        {
            //get current username
            string loginName = User.Identity.Name;

            Session["LoginName"] = loginName;

            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = id;


            int ClientRefid = caseModel.GetClientRefIdssId(id);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            Session["IntakeassId"] = id;
            ViewBag.ModuleRef      = ClientRef;



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


            int?Placementid = preModel.GetPlacementId(id);

            ViewBag.MessagePlacement = Placementid;
            Session["Placement"]     = Placementid;


            return(View(personVM));
        }
        public JsonResult ListOffence()
        {
            int          caseid = Convert.ToInt32(Session["IntakeassId"]);
            PCMCaseModel Model  = new PCMCaseModel();

            //initialise view model
            PCMCaseDetailsViewModel VM = new PCMCaseDetailsViewModel();

            List <PCMCaseDetailsViewModel> List = Model.GetOffenceList(caseid).Select(x => new PCMCaseDetailsViewModel
            {
                Intake_Assessment_Id   = x.Intake_Assessment_Id,
                PCM_Offence_Id         = x.PCM_Offence_Id,
                selectOffenceCategory  = x.selectOffenceCategory,
                selectOffeceType       = x.selectOffeceType,
                Offence_Circumstance   = x.Offence_Circumstance,
                Value_Of_Goods         = x.Value_Of_Goods,
                Value_Recovered        = x.Value_Recovered,
                IsChild_Responsible    = x.IsChild_Responsible,
                Responsibility_Details = x.Responsibility_Details
            }).ToList();

            return(Json(List, JsonRequestBehavior.AllowGet));
        }
Exemple #15
0
        public ActionResult Index(int 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;
                }
            }
            var HBSConditionType = m.GetCondition();

            vm.Condition_List = m.GetCondition();

            var HBSsupersorType = m.GetHBSsupervisorType();

            vm.HBSsupervisor_Type = m.GetHBSsupervisorType();

            bool IntakeAssessmentIdExisit = db.PCM_HB_Supervision.Any(x => x.Intake_Assessment_Id == id);



            int assID = Convert.ToInt32(Session["IntakeassId"]);
            //instanciate model repositry
            PCMCaseModel caseModel = new PCMCaseModel();

            //instanciate viewmodel
            PCMPersonViewModel personVM = new PCMPersonViewModel();

            //get person id by assessment id
            personVM.IntakeAssPar = assID;


            int ClientRefid = caseModel.GetClientRefIdssId(assID);
            //Get Module Reference number ....................
            string ClientRef = caseModel.GetClientRef(ClientRefid);

            Session["ClientRef"]   = ClientRef;
            Session["IntakeassId"] = assID;
            ViewBag.ModuleRef      = ClientRef;



            if (IntakeAssessmentIdExisit)
            {
                Session["Idc1"]        = id;
                Session["IntakeassId"] = id;


                return(PartialView(vm));
            }
            else
            {
                Session["Idc1"]        = id;
                Session["IntakeassId"] = id;


                //Response.Write("does not Exist");
                return(PartialView(vm));
            }
        }
Exemple #16
0
        public ActionResult GetPCMPresentense()
        {
            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;
                }
            }
            PCMCaseModel caseModelC = new PCMCaseModel();

            string ClientRef = Convert.ToString(Session["ClientRef"]);

            ViewBag.ModuleRef = ClientRef;

            PCMPresentenceModel Model = new PCMPresentenceModel();
            //initialise view model
            PCMPresentenceDetailsViewModel VM = new PCMPresentenceDetailsViewModel();

            using (SDIIS_DatabaseEntities db = new SDIIS_DatabaseEntities())
            {
                int Presentenseid = Model.GetPCMPresentenseByassId(intassid);
                if (Presentenseid != 0)
                {
                    VM = Model.GetPresentenseList(Presentenseid);

                    //populate dropdown lists

                    VM.CommunityBasedOptions_List     = Model.GetCommunityBasedOption();
                    VM.SupendedPostponedSentence_List = Model.GetSupendedPostponedSentence();
                    VM.CaseStatus_List          = Model.GetCaseStatus();//..................?
                    VM.RestorectiveJustice_List = Model.GetRestorectiveJustice();
                    VM.ProgrammeType_List       = Model.GetProgrammeType();
                    VM.Programme_List           = Model.GetProgramme();
                    VM.Imprisoment_List         = Model.GetImprisoment();//..................?
                    VM.Department_List          = Model.GetDepartment();
                    VM.Court_List    = Model.GetAllCourt();
                    VM.Province_List = Model.GetAllProvinces();
                    VM.District_List = Model.GetAllDistrict();


                    if (Convert.ToInt32(Model.GetPresentenseList(Presentenseid).Court_id) != 0)
                    {
                        int Courtid = Convert.ToInt32(Model.GetPresentenseList(Presentenseid).Court_id);
                        ViewBag.Court = db.Courts.Find(Courtid).Description;

                        //Get District using the court..........................................
                        int DistrictId = (from k in db.Districts
                                          join k1 in db.Courts on k.District_Id equals k1.District_Id
                                          where k1.Court_Id == Courtid
                                          select k.District_Id).FirstOrDefault();

                        ViewData["district"] = new SelectList(db.Districts, "District_Id", "Description", DistrictId).ToList();

                        //Get Province using the District..........................................

                        int ProvinceId = (from a in db.Districts
                                          join b in db.Provinces on a.Province_Id equals b.Province_Id
                                          where a.District_Id.Equals(DistrictId)
                                          select b.Province_Id).FirstOrDefault();
                        ViewData["province"] = new SelectList(db.Provinces, "Province_Id", "Description", ProvinceId).ToList();
                    }

                    Session["presentdate"] = Presentenseid;

                    return(PartialView(VM));
                }
                else
                {
                    PCMPresentenceModel            Model1 = new PCMPresentenceModel();
                    PCMPresentenceDetailsViewModel VM1    = new PCMPresentenceDetailsViewModel();
                    //initialise view model

                    VM1.CommunityBasedOptions_List     = Model.GetCommunityBasedOption();
                    VM1.SupendedPostponedSentence_List = Model.GetSupendedPostponedSentence();
                    VM1.CaseStatus_List          = Model.GetCaseStatus();//..................?
                    VM1.RestorectiveJustice_List = Model.GetRestorectiveJustice();
                    VM1.ProgrammeType_List       = Model.GetProgrammeType();
                    VM1.Programme_List           = Model.GetProgramme();
                    VM1.Imprisoment_List         = Model.GetImprisoment();//..................?
                    VM1.Department_List          = Model.GetDepartment();
                    VM1.Court_List    = Model.GetAllCourt();
                    VM1.Province_List = Model.GetAllProvinces();
                    VM1.District_List = Model.GetAllDistrict();

                    //funtion that calls insert Socio Economy
                    Model1.InsertPresentence(VM1, intassid, userId);

                    PCMPresentenceDetailsViewModel VM2 = new PCMPresentenceDetailsViewModel();
                    int Presentenceidadd = Model.GetPCMPresentenseByassId(intassid);
                    VM2 = Model1.GetPresentenseList(Presentenceidadd);

                    VM2.CommunityBasedOptions_List     = Model.GetCommunityBasedOption();
                    VM2.SupendedPostponedSentence_List = Model.GetSupendedPostponedSentence();
                    VM2.CaseStatus_List          = Model.GetCaseStatus();//..................?
                    VM2.RestorectiveJustice_List = Model.GetRestorectiveJustice();
                    VM2.ProgrammeType_List       = Model.GetProgrammeType();
                    VM2.Programme_List           = Model.GetProgramme();
                    VM2.Imprisoment_List         = Model.GetImprisoment();//..................?
                    VM2.Department_List          = Model.GetDepartment();
                    VM2.Court_List        = Model.GetAllCourt();
                    VM2.Province_List     = Model.GetAllProvinces();
                    VM2.District_List     = Model.GetAllDistrict();
                    Session["presentadd"] = Presentenceidadd;
                    return(PartialView("GetPCMPresentense", VM2));
                }
            }
        }
Exemple #17
0
        public ActionResult GetPCMPresentenseSummaryDetails(int 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;
                }
            }


            //initialise model repositry
            PCMPresentenceModel Model = new PCMPresentenceModel();

            //initialise view model
            PCMCaseModel caseModelC = new PCMCaseModel();

            string ClientRef = Convert.ToString(Session["ClientRef"]);

            ViewBag.ModuleRef = ClientRef;

            int PreSummaryID = Model.GetPCMPresentenseSummaryByassId(id);

            if (PreSummaryID != 0)
            {
                PCMPresentenceDetailsViewModel VM1 = new PCMPresentenceDetailsViewModel();
                VM1 = Model.GetPresentenseSummaryList(PreSummaryID);//.............................?

                Session["Idc1"]        = PreSummaryID;
                Session["IntakeassId"] = id;
                return(PartialView(VM1));
            }
            else
            {
                PCMPresentenceModel            Model1 = new PCMPresentenceModel();
                PCMPresentenceDetailsViewModel VM     = new PCMPresentenceDetailsViewModel();
                //initialise view model
                PCMPresentenceDetailsViewModel VMC = new PCMPresentenceDetailsViewModel();

                Model.InsertPresentenceSummaries(VM, id, userId);

                int PreSummaryID1 = Model1.GetPCMPresentenseSummaryByassId(id);

                VMC = Model1.GetPresentenseSummaryList(PreSummaryID1);

                Session["NewId"]       = id;
                Session["IntakeassId"] = id;
                return(PartialView(VMC));
            }
        }