public ActionResult ListHopDongDaDuyet()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.CVLeTanHopDong))
            {
                return(AccessDeniedView());
            }
            var model = new HopDongListModel();

            //them danh sách sale
            model.NguoiTaos.Add(new SelectListItem {
                Text = GetLabel("ChonSale"), Value = "0"
            });
            //Lấy thông tin người tạo
            var nguoitaoids = _chonveService.GetNguoiTaoIds();

            foreach (var id in nguoitaoids)
            {
                var nguoitao = _customerService.GetCustomerById(id);
                if (nguoitao != null)
                {
                    model.NguoiTaos.Add(new SelectListItem {
                        Text = nguoitao.GetFullName(), Value = nguoitao.Id.ToString()
                    });
                }
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ListHopDong(DataSourceRequest command, HopDongListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.QLHopDong))
            {
                return(AccessDeniedView());
            }
            int nguoitaoid = _workContext.CurrentCustomer.Id;
            ENTrangThaiHopDong trangthaiid = ENTrangThaiHopDong.TatCa;

            if (_permissionService.Authorize(StandardPermissionProvider.CVSaleManager))
            {
                nguoitaoid  = model.NguoiTaoId;
                trangthaiid = (ENTrangThaiHopDong)model.TrangThaiID;
            }


            var hopdongs = _chonveService.GetAllHopDong(model.TimMaHopDong, model.TimTenHopDong,
                                                        command.Page - 1, command.PageSize, false, nguoitaoid, trangthaiid);

            var gridModel = new DataSourceResult
            {
                Data = hopdongs.Select(x =>
                {
                    var m           = x.ToModel();
                    m.TrangThaiText = x.TrangThai.GetLocalizedEnum(_localizationService, _workContext);
                    return(m);
                }),
                Total = hopdongs.TotalCount
            };

            return(Json(gridModel));
        }
Ejemplo n.º 3
0
        public ActionResult ListHopDong()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.QLHopDong))
            {
                return(AccessDeniedView());
            }

            var model = new HopDongListModel();

            //neu la giam doc
            if (_permissionService.Authorize(StandardPermissionProvider.CVSaleManager))
            {
                //add them nguoi tao la cac nhan vien sale
                model.isManager = true;
                model.NguoiTaos.Add(new SelectListItem {
                    Text = GetLabel("ChonSale"), Value = "0"
                });
                //lay thong tin nguoi tao
                var nguoitaoids = _chonveService.GetNguoiTaoIds();
                foreach (var id in nguoitaoids)
                {
                    var nguoitao = _customerService.GetCustomerById(id);
                    if (nguoitao != null)
                    {
                        model.NguoiTaos.Add(new SelectListItem {
                            Text = nguoitao.GetFullName(), Value = nguoitao.Id.ToString()
                        });
                    }
                }
                PrepareListTrangThai(model);
            }
            else
            {
                //khong hien
                model.isManager = false;
                model.NguoiTaos.Add(new SelectListItem {
                    Text = _workContext.CurrentCustomer.GetFullName(), Value = _workContext.CurrentCustomer.Id.ToString()
                });
            }
            return(View(model));
        }
        public ActionResult ListHopDongDaDuyet(DataSourceRequest command, HopDongListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.CVLeTanHopDong))
            {
                return(AccessDeniedView());
            }
            var hopdongs = _chonveService.GetAllHopDong(model.TimMaHopDong, model.TimTenHopDong,
                                                        command.Page - 1, command.PageSize, false, model.NguoiTaoId, ENTrangThaiHopDong.DaDuyet);
            var gridModel = new DataSourceResult
            {
                Data = hopdongs.Select(x =>
                {
                    var m           = x.ToModel();
                    m.TrangThaiText = x.TrangThai.GetLocalizedEnum(_localizationService, _workContext);
                    return(m);
                }),
                Total = hopdongs.TotalCount
            };

            return(Json(gridModel));
        }
Ejemplo n.º 5
0
 protected virtual void PrepareListTrangThai(HopDongListModel model)
 {
     model.ListTrangThai = GetEnumSelectList <ENTrangThaiHopDong>(model.TrangThaiID);
 }