Esempio n. 1
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));
            }
        }