예제 #1
0
        public ActionResult Create()
        {
            _srPageFacade = new SrPageFacade();

            var mappingProductTypeVM = new MappingProductTypeViewModel();

            var srPageList = _srPageFacade.GetSrPageList();

            mappingProductTypeVM.SrPageList = srPageList.Select(item => new SelectListItem()
            {
                Text = item.SrPageName,
                //Value = item.SrPageId.ToString(CultureInfo.InvariantCulture)
                Value = item.SrPageId.ToString()
            }).ToList();

            mappingProductTypeVM.QuestionGroupSearchFilter = new QuestionSelectSearchFilter()
            {
                QuestionName   = string.Empty,
                QuestionIdList = string.Empty,
                ProductId      = null,
                PageSize       = 15,
                PageNo         = 1,
                SortField      = "test",
                SortOrder      = "ASC"
            };

            ViewBag.CreateUsername = UserInfo.FullName;
            ViewBag.UpdateUsername = UserInfo.FullName;
            ViewBag.CreateDate     = DateTime.Now;
            ViewBag.UpdateDate     = DateTime.Now;

            ViewBag.VerifyOTPList = new SelectList(new SelectListItem[]
            {
                new SelectListItem()
                {
                    Value = "true", Text = "Yes"
                },
                new SelectListItem()
                {
                    Value = "false", Text = "No"
                },
            },
                                                   "Value", "Text", string.Empty);

            using (MappingProductTypeFacade _mapFacade = new MappingProductTypeFacade())
            {
                List <SelectListItem> otpTemplate = new List <SelectListItem>();
                _mapFacade.GetOTPTemplate().ForEach(o => otpTemplate.Add(new SelectListItem()
                {
                    Value = o.OTPTemplateId.ToString(), Text = o.OTPTemplateName
                }));
                ViewBag.OTPTemplateList = new SelectList(otpTemplate, "Value", "Text", string.Empty);
            }

            using (HpFacade _hpFacade = new HpFacade())
            {
                List <SelectListItem> hpStatus = new List <SelectListItem>();
                _hpFacade.GetHpStatus().ForEach(o => hpStatus.Add(new SelectListItem()
                {
                    Value = o.HpStatusId.ToString(), Text = $"{o.HpLangIndeCode}-{o.HpSubject}"
                }));
                ViewBag.HpStatusList = new SelectList(hpStatus, "Value", "Text", string.Empty);
            }

            return(View(mappingProductTypeVM));
        }
예제 #2
0
        public ActionResult Edit(int?mapProductId)
        {
            if (mapProductId.HasValue)
            {
                var model = new MappingProductTypeEditModel();

                _srPageFacade = new SrPageFacade();

                var srPageList = _srPageFacade.GetSrPageList();
                model.SrPageList = srPageList.Select(item => new SelectListItem()
                {
                    Text = item.SrPageName,
                    //Value = item.SrPageId.ToString(CultureInfo.InvariantCulture)
                    Value = item.SrPageId.ToString()
                }).ToList();

                _mappingProductTypeFacade = new MappingProductTypeFacade();
                MappingProductTypeItemEntity mapItemEntity = _mappingProductTypeFacade.GetMappingById(mapProductId.Value);
                model.MapProductId        = mapItemEntity.MapProductId;
                model.ProductGroupId      = mapItemEntity.ProductGroupId;
                model.ProductGroupName    = mapItemEntity.ProductGroupName;
                model.ProductId           = mapItemEntity.ProductId;
                model.ProductName         = mapItemEntity.ProductName;
                model.CampaignServiceId   = mapItemEntity.CampaignServiceId;
                model.CampaignServiceName = mapItemEntity.CampaignName;
                model.AreaId          = mapItemEntity.AreaId;
                model.AreaName        = mapItemEntity.AreaName;
                model.SubAreaId       = mapItemEntity.SubAreaId;
                model.SubAreaName     = mapItemEntity.SubAreaName;
                model.TypeId          = mapItemEntity.TypeId;
                model.TypeName        = mapItemEntity.TypeName;
                model.OwnerBranchId   = mapItemEntity.OwnerBranchId;
                model.OwnerBranchName = mapItemEntity.OwnerBranchName;
                model.OwnerSrId       = mapItemEntity.OwnerUserId;
                model.OwnerSrName     = mapItemEntity.OwnerSrName;
                model.CreateUser      = mapItemEntity.CreateUser != null ? mapItemEntity.CreateUser.FullName : "";
                model.UpdateUser      = mapItemEntity.UpdateUser != null ? mapItemEntity.UpdateUser.FullName : "";
                model.CreateDate      = DateUtil.ToStringAsDateTime(mapItemEntity.CreateDate);
                model.UpdateDate      = DateUtil.ToStringAsDateTime(mapItemEntity.UpdateDate);
                model.SrPageId        = mapItemEntity.SrPageId;

                model.VerifyList = new List <SelectListItem>();
                if (mapItemEntity.IsVerify)
                {
                    //verify
                    model.VerifyList.Add(new SelectListItem {
                        Text = "Yes", Value = "true", Selected = true
                    });
                    model.VerifyList.Add(new SelectListItem {
                        Text = "No", Value = "false"
                    });
                }
                else
                {
                    model.VerifyList.Add(new SelectListItem {
                        Text = "Yes", Value = "true"
                    });
                    model.VerifyList.Add(new SelectListItem {
                        Text = "No", Value = "false", Selected = true
                    });
                }

                model.ActiveList = new List <SelectListItem>();
                if (mapItemEntity.IsActive)
                {
                    //active
                    model.ActiveList.Add(new SelectListItem {
                        Text = "Active", Value = "true", Selected = true
                    });
                    model.ActiveList.Add(new SelectListItem {
                        Text = "Inactive", Value = "false"
                    });
                }
                else
                {
                    model.ActiveList.Add(new SelectListItem {
                        Text = "Active", Value = "true"
                    });
                    model.ActiveList.Add(new SelectListItem {
                        Text = "Inactive", Value = "false", Selected = true
                    });
                }

                model.SearchFilter = new QuestionGroupEditSearchFilter

                {
                    MapProductId = null,
                    PageNo       = 1,
                    PageSize     = 15,
                    SortField    = "",
                    SortOrder    = "ASC"
                };

                model.QuestionGroupSearchFilter = new QuestionSelectSearchFilter
                {
                    QuestionName   = string.Empty,
                    QuestionIdList = string.Empty,
                    ProductId      = null,
                    PageNo         = 1,
                    PageSize       = 15,
                    SortField      = "",
                    SortOrder      = "ASC"
                };

                model.IsActive = mapItemEntity.IsActive;
                model.IsVerify = mapItemEntity.IsVerify;

                ViewBag.VerifyOTPList = new SelectList(new SelectListItem[]
                {
                    new SelectListItem()
                    {
                        Value = "true", Text = "Yes"
                    },
                    new SelectListItem()
                    {
                        Value = "false", Text = "No"
                    },
                },
                                                       "Value", "Text", string.Empty);

                using (MappingProductTypeFacade _mapFacade = new MappingProductTypeFacade())
                {
                    List <SelectListItem> otpTemplate = new List <SelectListItem>();
                    _mapFacade.GetOTPTemplate().ForEach(o => otpTemplate.Add(new SelectListItem()
                    {
                        Value = o.OTPTemplateId.ToString(), Text = o.OTPTemplateName
                    }));
                    ViewBag.OTPTemplateList = new SelectList(otpTemplate, "Value", "Text", string.Empty);
                }

                using (HpFacade _hpFacade = new HpFacade())
                {
                    List <SelectListItem> hpStatus = new List <SelectListItem>();
                    _hpFacade.GetHpStatus().ForEach(o => hpStatus.Add(new SelectListItem()
                    {
                        Value = o.HpStatusId.ToString(), Text = $"{o.HpLangIndeCode}-{o.HpSubject}"
                    }));
                    ViewBag.HpStatusList = new SelectList(hpStatus, "Value", "Text", string.Empty);
                }

                model.IsVerifyOTP = mapItemEntity.IsVerifyOTP;
                model.IsSRSecret  = mapItemEntity.IsSRSecret;
                model.OTPTemplate = mapItemEntity.OTPTemplate ?? model.OTPTemplate;
                model.HpStatus    = mapItemEntity.HpStatus ?? model.HpStatus;

                return(View(model));
            }

            return(View("Search"));
        }