示例#1
0
        private IncidentLookupListsCacheObject GetIncidentAndLookups()
        {
            UcbServiceClient sc = new UcbServiceClient();

            try
            {
                // Get instance of Language Manager
                LanguageManager language = new LanguageManager();

                // Get users localisation
                string locale = language.GetLocale();

                IncidentVMDC returnObject = sc.GetIncident(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "Ucb", "", null, locale);

                sc.Close();

                IncidentLookupListsCacheObject CachedLists = new IncidentLookupListsCacheObject();

                CachedLists.JobRoleList                 = Mapper.Map <IEnumerable <JobRoleDC>, List <JobRoleModel> >(returnObject.JobRoleList);
                CachedLists.ReferrerList                = Mapper.Map <IEnumerable <ReferrerDC>, List <ReferrerModel> >(returnObject.ReferrerList);
                CachedLists.StaffMemberBusinessList     = Mapper.Map <IEnumerable <OrganisationDC>, List <OrganisationModel> >(returnObject.StaffMemberBusinessList.OrderBy(x => x.Name));
                CachedLists.StaffMemberBusinessAreaList = Mapper.Map <IEnumerable <OrganisationDC>, List <OrganisationModel> >(returnObject.StaffMemberBusinessAreaList.OrderBy(x => x.Name));
                //***Note - have removed sites/home offices from cache***
                //CachedLists.StaffMemberHomeOfficeList = Mapper.Map<IEnumerable<OrganisationDC>, List<OrganisationModel>>(returnObject.StaffMemberHomeOfficeList);
                CachedLists.EventLeadingToIncidentList = Mapper.Map <IEnumerable <EventLeadingToIncidentDC>, List <EventLeadingToIncidentModel> >(returnObject.EventLeadingToIncidentList);
                CachedLists.IncidentLocationList       = Mapper.Map <IEnumerable <IncidentLocationDC>, List <IncidentLocationModel> >(returnObject.IncidentLocationList);
                CachedLists.IncidentCategoryList       = Mapper.Map <IEnumerable <IncidentCategoryDC>, List <IncidentCategoryModel> >(returnObject.IncidentCategoryList);
                CachedLists.IncidentTypeList           = Mapper.Map <IEnumerable <IncidentTypeDC>, List <IncidentTypeModel> >(returnObject.IncidentTypeList);
                CachedLists.IncidentDetailsList        = Mapper.Map <IEnumerable <IncidentDetailDC>, List <IncidentDetailModel> >(returnObject.IncidentDetailsList);
                CachedLists.AbuseTypeList           = Mapper.Map <IEnumerable <AbuseTypeDC>, List <AbuseTypeModel> >(returnObject.AbuseTypeList);
                CachedLists.FastTrackAttachmentList = Mapper.Map <IEnumerable <AttachmentDC>, List <AttachmentModel> >(returnObject.FastTrackAttachmentList);
                CachedLists.RIDDORAttachmentList    = Mapper.Map <IEnumerable <AttachmentDC>, List <AttachmentModel> >(returnObject.RIDDORAttachmentList);

                CachedLists.AdminEmail       = returnObject.AdminEmail;
                CachedLists.DeputyAdminEmail = returnObject.DeputyAdminEmail;

                CachedLists.RelationshipToCustomerList     = Mapper.Map <IEnumerable <RelationshipToCustomerDC>, List <RelationshipToCustomerModel> >(returnObject.RelationshipToCustomerList);
                CachedLists.ContingencyArrangementBaseList = Mapper.Map <IEnumerable <ContingencyArrangementDC>, List <ContingencyArrangementModel> >(returnObject.ContingencyArrangementList);
                CachedLists.ControlMeasureBaseList         = Mapper.Map <IEnumerable <ControlMeasureDC>, List <ControlMeasureModel> >(returnObject.ControlMeasureList);
                CachedLists.SystemMarkedBaseList           = Mapper.Map <IEnumerable <SystemMarkedDC>, List <SystemMarkedModel> >(returnObject.SystemMarkedList);
                CachedLists.InterestedPartyBaseList        = Mapper.Map <IEnumerable <InterestedPartyDC>, List <InterestedPartyModel> >(returnObject.InterestedPartyList);

                //Select Lists
                CachedLists.ContingencyArrangementList = returnObject.ContingencyArrangementList.Select(x => new SelectListItem()
                {
                    Value = x.Code.ToString(), Text = x.Description
                }).ToList();
                CachedLists.ControlMeasureList = returnObject.ControlMeasureList.Select(x => new SelectListItem()
                {
                    Value = x.Code.ToString(), Text = x.ControlMeasureDescription
                }).ToList();
                CachedLists.SystemMarkedList = returnObject.SystemMarkedList.Select(x => new SelectListItem()
                {
                    Value = x.Code.ToString(), Text = x.Description
                }).ToList();
                CachedLists.InterestedPartyList = returnObject.InterestedPartyList.Select(x => new SelectListItem()
                {
                    Value = x.Code.ToString(), Text = x.Description
                }).ToList();



                return(CachedLists);
            }
            catch (Exception e)
            {
                // Handle the exception
                string message = ExceptionManager.HandleException(e, sc);

                return(null);
            }
        }
示例#2
0
        private static void CreateSubMenu(TagBuilder accordion, string menu, string userName)
        {
            TagBuilder h3;

            h3 = new TagBuilder("h3");

            var a1 = new TagBuilder("a");

            a1.Attributes["href"] = "#";
            a1.InnerHtml          = menu;
            h3.InnerHtml         += a1.ToString();

            TagBuilder h4;
            TagBuilder div;

            var accordionSub = new TagBuilder("div");
            var extraDiv     = new TagBuilder("div");

            accordionSub.GenerateId("accordionSub");

            UcbServiceClient sc = new UcbServiceClient();

            try
            {
                var publishedReportsByCategory = sc.GetPublishedReportsByCategory(userName, userName, "Ucb", "");
                foreach (var category in publishedReportsByCategory)
                {
                    h4 = new TagBuilder("h4");

                    var a = new TagBuilder("a");
                    a.Attributes["href"] = "#";
                    a.InnerHtml          = category.Category;

                    div = new TagBuilder("div");
                    var ul = new TagBuilder("ul");
                    ul.GenerateId("nav");

                    foreach (var li in CreateSubMenuItem(category.StandardReports))
                    {
                        ul.InnerHtml += li.ToString();
                    }


                    div.InnerHtml = ul.ToString();

                    h4.InnerHtml += a.ToString();

                    accordionSub.InnerHtml += h4.ToString();
                    accordionSub.InnerHtml += div.ToString();
                }
            }
            catch (Exception e)
            {
                string message = ExceptionManager.HandleException(e, sc);
            }

            finally
            {
                sc.Close();
            }


            accordion.InnerHtml += h3.ToString();
            extraDiv.InnerHtml  += accordionSub.ToString();
            accordion.InnerHtml += extraDiv.ToString();
        }