Beispiel #1
0
        public ActionResult Search()
        {
            _srChannelFacade = new SrChannelFacade();
            _srStatusFacade  = new SrStatusFacade();

            var viewSlaVM     = new SlaViewModel();
            var srChannelList = _srChannelFacade.GetSrChannelList();

            viewSlaVM.SrChannelList = srChannelList.Select(item => new SelectListItem()
            {
                Text  = item.ChannelName,
                Value = item.ChannelId.ToString(CultureInfo.InvariantCulture)
            }).ToList();
            viewSlaVM.SrChannelList.Insert(0, new SelectListItem()
            {
                Text = "ทั้งหมด", Value = "-1"
            });

            var srStatusList = _srStatusFacade.GetSrStatusList();

            viewSlaVM.SrStatusList = srStatusList.Select(item => new SelectListItem()
            {
                Text  = item.SRStatusName,
                Value = item.SRStatusId.ToString()
            }).ToList();
            viewSlaVM.SrStatusList.Insert(0, new SelectListItem()
            {
                Text = "ทั้งหมด", Value = "-1"
            });

            viewSlaVM.SearchFilter = new SlaSearchFilter()
            {
                ProductGroupId    = null,
                ProductId         = null,
                CampaignServiceId = null,
                AreaId            = null,
                SubAreaId         = null,
                TypeId            = null,
                ChannelId         = null,
                SrStatusId        = null,
                PageNo            = 1,
                PageSize          = 15,
                SortField         = "",
                SortOrder         = "ASC"
            };

            return(View(viewSlaVM));
        }
Beispiel #2
0
        public ActionResult Create()
        {
            _srChannelFacade = new SrChannelFacade();
            _srStatusFacade  = new SrStatusFacade();
            var createSlaVM   = new SlaCreateModel();
            var srChannelList = _srChannelFacade.GetSrChannelList();

            createSlaVM.SrChannelList = srChannelList.Select(item => new SelectListItem()
            {
                Text  = item.ChannelName,
                Value = item.ChannelId.ToString(CultureInfo.InvariantCulture)
            }).ToList();
            createSlaVM.SrChannelList.Insert(0, new SelectListItem()
            {
                Text = "กรุณาเลือก", Value = ""
            });

            var srStatusList = _srStatusFacade.GetSrStatusList();

            createSlaVM.SrStatusList = srStatusList.Select(item => new SelectListItem()
            {
                Text  = item.SRStatusName,
                Value = item.SRStatusId.ToString(CultureInfo.InvariantCulture)
            }).ToList();
            createSlaVM.SrStatusList.Insert(0, new SelectListItem()
            {
                Text = "กรุณาเลือก", Value = ""
            });

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

            return(View(createSlaVM));
        }
Beispiel #3
0
        public ActionResult Edit(int?slaId)
        {
            _srChannelFacade = new SrChannelFacade();
            _srStatusFacade  = new SrStatusFacade();
            _slaFacade       = new SlaFacade();
            var editSlaVM = new SlaEditModel();

            var srChannelList = _srChannelFacade.GetSrChannelList();

            editSlaVM.SrChannelList = srChannelList.Select(item => new SelectListItem()
            {
                Text  = item.ChannelName,
                Value = item.ChannelId.ToString(CultureInfo.InvariantCulture)
            }).ToList();
            editSlaVM.SrChannelList.Insert(0, new SelectListItem()
            {
                Text = "กรุณาเลือก", Value = ""
            });

            var srStatusList = _srStatusFacade.GetSrStatusList();

            editSlaVM.SrStatusList = srStatusList.Select(item => new SelectListItem()
            {
                Text  = item.SRStatusName,
                Value = item.SRStatusId.ToString(CultureInfo.InvariantCulture)
            }).ToList();
            editSlaVM.SrStatusList.Insert(0, new SelectListItem()
            {
                Text = "กรุณาเลือก", Value = ""
            });

            if (slaId.HasValue)
            {
                SlaItemEntity slaItemEntity = _slaFacade.GetSlaById(slaId);
                if (slaItemEntity != null && slaItemEntity.SlaId.HasValue)
                {
                    editSlaVM.SlaId             = slaItemEntity.SlaId;
                    editSlaVM.ProductId         = slaItemEntity.ProductId;
                    editSlaVM.ProductGroupId    = slaItemEntity.ProductGroupId;
                    editSlaVM.CampaignServiceId = slaItemEntity.CampaignServiceId;
                    editSlaVM.AreaId            = slaItemEntity.AreaId;
                    editSlaVM.SubAreaId         = slaItemEntity.SubAreaId;
                    editSlaVM.TypeId            = slaItemEntity.TypeId;

                    editSlaVM.ProductName         = slaItemEntity.ProductName;
                    editSlaVM.ProductGroupName    = slaItemEntity.ProductGroupName;
                    editSlaVM.CampaignServiceName = slaItemEntity.CampaignName;
                    editSlaVM.AreaName            = slaItemEntity.AreaName;
                    editSlaVM.SubAreaName         = slaItemEntity.SubAreaName;
                    editSlaVM.TypeName            = slaItemEntity.TypeName;

                    editSlaVM.ChannelId      = slaItemEntity.ChannelId;
                    editSlaVM.SrChannelId    = slaItemEntity.ChannelId;
                    editSlaVM.SrStatusId     = slaItemEntity.SrStatusId;
                    editSlaVM.SlaMinute      = slaItemEntity.SlaMinute;
                    editSlaVM.SlaTimes       = slaItemEntity.SlaTimes;
                    editSlaVM.SlaDay         = slaItemEntity.SlaDay;
                    editSlaVM.CreateUserName = slaItemEntity.CreateUser != null ? slaItemEntity.CreateUser.FullName : "";
                    editSlaVM.CreateDate     = DateUtil.ToStringAsDateTime(slaItemEntity.CreateDate);
                    editSlaVM.UpdateUserName = slaItemEntity.UpdateUser != null ? slaItemEntity.UpdateUser.FullName : "";
                    editSlaVM.UpdateDate     = DateUtil.ToStringAsDateTime(slaItemEntity.UpdateDate);
                }
            }

            return(View(editSlaVM));
        }