//查詢頁面
        public ActionResult Index()
        {
            EmployeeService       employeeService         = new EmployeeService();
            List <Employees>      employeesList           = employeeService.getAllData();
            List <SelectListItem> employeesSelectItemList = employeesList.Select(
                m => new SelectListItem()
            {
                Text  = m.FirstName + m.LastName,
                Value = m.FirstName + m.LastName
            }).ToList();

            ViewBag.employeesSelectItemList = employeesSelectItemList;

            ShipperService        shipperService         = new ShipperService();
            List <Shippers>       shippersList           = shipperService.getAllData();
            List <SelectListItem> shippersSelectItemList = shippersList.Select(
                m => new SelectListItem()
            {
                Text  = m.CompanyName,
                Value = m.CompanyName
            }).ToList();

            ViewBag.shippersSelectItemList = shippersSelectItemList;
            return(View());
        }
Example #2
0
        public ActionResult Edit(long id)
        {
            var response = new ShipperService().GetShipperByID(new ShipperByIDRequest()
            {
                ID = id
            });

            if (response.IsSuccess)
            {
                ShipperVM model = new ShipperVM(response.Result);
                model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
                model.SelectedShipperIdentifies  = model.AvailableShipperIdentifies.Where(t => response.Result.Str1.Split(',').Contains(t.ID.ToString()));
                model.IsEdit = true;
                return(View("Create", model));
            }
            else
            {
                ShipperVM model = new ShipperVM();
                model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
                model.SelectedShipperIdentifies  = Enumerable.Empty <Config>();
                model.IsEdit    = false;
                ViewBag.Message = "获取数据失败!";
                return(View("Create", model));
            }
        }
Example #3
0
        public ActionResult Update(int orderid)
        {
            ///獲得訂單資料
            OrderService orderService = new OrderService();
            Order        orderdata    = orderService.GetOrders(orderid);
            ///取得產品資料
            List <SelectListItem> productitems = orderService.GetOrderDetailList();

            ViewBag.productitems = productitems;
            ///準備員工下拉式選單
            EmployeeService       employeeservice = new EmployeeService();
            List <SelectListItem> employeeitems   = employeeservice.GetEnameList();

            ViewBag.employeelist = employeeitems;

            ///準備物流下拉式選單
            ShipperService        shipperservice = new ShipperService();
            List <SelectListItem> shippersitems  = shipperservice.GetSnameList();

            ViewBag.shipperslist = shippersitems;

            ///準備員工下拉式選單
            CustomerService       customerservice = new CustomerService();
            List <SelectListItem> customeritems   = customerservice.GetCustomerList();

            ViewBag.customerlist = shippersitems;
            return(View(orderdata));
        }
Example #4
0
        /// <summary>
        /// 取得[出貨公司]下拉選單
        /// </summary>
        /// <returns></returns>
        private IEnumerable <SelectListItem> GetShipperList()
        {
            ShipperService shipperService = new ShipperService();
            SelectList     shipperList    = new SelectList(shipperService.GetShippers(), "ShipperID", "CompanyName");

            return(shipperList);
        }
Example #5
0
        public ActionResult Index()
        {   ///員工、物流公司下拉是選單
            EmployeeService employeeService = new EmployeeService();

            ViewBag.employeelist = employeeService.GetEnameList();
            ShipperService shipperService = new ShipperService();

            ViewBag.shipperlist = shipperService.GetSnameList();
            return(View());
        }
Example #6
0
        public ActionResult Index()
        {
            //test
            EmployeeService employeeservice = new EmployeeService();

            ViewBag.namelist = employeeservice.GetName();
            ShipperService shipperservice = new ShipperService();

            ViewBag.shipperlist = shipperservice.GetShipper();
            return(View());
        }
        // GET: Order
        public ActionResult Index()
        {
            EmployeeService employeeService = new EmployeeService();

            ViewBag.employeeService = employeeService.GetEmployeeName();

            ShipperService shipperService = new ShipperService();

            ViewBag.shipperService = shipperService.GetShipperName();

            return(View());
        }
Example #8
0
        /// <summary>
        /// Loads all orders from the endpoint
        /// </summary>
        public override async Task LoadAllAsync()
        {
            OrderService  orderService = new OrderService();
            List <Orders> orders       = await orderService.GetAllOrdersAsync();

            Orders.ReplaceWith(orders);

            ShipperService  shipperService = new ShipperService();
            List <Shippers> shippers       = await shipperService.GetAllShippersAsync();

            Shippers.ReplaceWith(shippers);
        }
Example #9
0
        public ActionResult VehicleManagement(long id)
        {
            var response = new ShipperService().GetShipperVehicle(new ShipperByIDRequest()
            {
                ID = id
            });
            VehicleManagementViewModel vm = new VehicleManagementViewModel();

            vm.ShipperID = id;
            vm.IsEdit    = false;
            vm.Vehicles  = response.Result;
            return(View(vm));
        }
Example #10
0
        public ActionResult InserOrder()
        {
            EmployeeService employeeservice = new EmployeeService();

            ViewBag.namelist = employeeservice.GetName();
            ShipperService shipperservice = new ShipperService();

            ViewBag.shipperlist = shipperservice.GetShipper();
            CustomerService customerservice = new CustomerService();

            ViewBag.Customerlist = customerservice.GetCustomer();
            return(View());
        }
Example #11
0
        public async Task GetAllShippersAsyncTest()
        {
            // Arrange
            ShipperService  service;
            List <Shippers> shippersList;

            // Act
            service      = new ShipperService();
            shippersList = await service.GetAllShippersAsync();

            // Assert
            Assert.IsTrue(shippersList.Count > 0);
        }
Example #12
0
        public ActionResult InsertOrder()
        {
            ///準備員工、物流、顧客的下拉式選單
            EmployeeService employeeService = new EmployeeService();

            ViewBag.employeelist = employeeService.GetEnameList();
            ShipperService shipperService = new ShipperService();

            ViewBag.shipperlist = shipperService.GetSnameList();
            CustomerService customerservice = new CustomerService();

            ViewBag.customerlist = customerservice.GetCustomerList();
            return(View());
        }
Example #13
0
        public ShippersViewModel()
        {
            //Field section
            _dialogCoordinator  = DialogCoordinator.Instance;
            _unmodifiedShippers = ShipperService.GetShippers();
            _Shippers           = new ObservableCollection <Shipper>(_unmodifiedShippers);


            //Command section
            SearchCommand = new RelayCommand(Search);

            //Messenger section
            MessengerInstance.Register <NotificationMessage <MessengerTypes> >(this, NotifyMe);
        }
Example #14
0
        public ActionResult DeleteVehicle(long id)
        {
            var response = new ShipperService().DeleteVehicle(new DeleteVehicleRequest()
            {
                ID = id
            });

            if (response.IsSuccess)
            {
                return(Json(new { IsSuccess = true }));
            }

            throw new Exception("删除车辆失败");
        }
Example #15
0
        /// <summary>
        /// Loads all orders from the web API
        /// </summary>
        protected override async Task LoadAllAsync()
        {
            // Declare service object
            OrderService orderService = new OrderService();
            // Get all orders from the API
            List <Orders> orders = await orderService.GetAllOrdersAsync();

            // Replace collection without destroying it
            Orders.ReplaceWith(orders);

            // Declare service object
            ShipperService shipperService = new ShipperService();
            // Get all shippers from the API
            List <Shippers> shippers = await shipperService.GetAllShippersAsync();

            // Replace collection without destroying it
            Shippers.ReplaceWith(shippers);
        }
Example #16
0
        public ActionResult DeleteShipperRegionCovered(long ProjectID, long RelatedCustomerID, long ShipperID, long StartCityID, long EndCityID)
        {
            var response = new ShipperService().DeleteShipperRegionCovered(
                new DeleteShipperRegionCoveredRequest()
            {
                ProjectID         = ProjectID,
                RelatedCustomerID = RelatedCustomerID,
                ShipperID         = ShipperID,
                StartCityID       = StartCityID,
                EndCityID         = EndCityID
            });

            if (response.IsSuccess)
            {
                return(Json(new { IsSuccess = true }));
            }

            return(Json(new { IsSuccess = false }));
        }
        public ActionResult Query()
        {
            // 準備 [員工] 下拉選單資料
            ViewBag.EmployeeList = new EmployeeService().GetEmployees();

            // 準備 [出貨公司] 下拉選單資料
            IList <Shipper> shippers = new ShipperService().GetShippers();



            foreach (Shipper item in shippers)
            {
                item.Phone = "";
            }

            ViewBag.ShipperList = shippers;

            return(View());
        }
Example #18
0
        public ActionResult List(ShipperListVM vm, int?PageIndex)
        {
            var response = new ShipperService().GetShippersByConditon(new GetShippersByConditionRequest()
            {
                ProjectId = base.UserInfo.ProjectID, Code = string.IsNullOrEmpty(vm.Code) ? "" : vm.Code, Name = string.IsNullOrEmpty(vm.Name) ? "" : vm.Name, EnglishName = string.IsNullOrEmpty(vm.EnglishName) ? "" : vm.EnglishName, State = vm.State, PageSize = UtilConstants.PAGESIZE, PageIndex = PageIndex ?? 0
            });

            if (response.IsSuccess)
            {
                vm.Shippers  = response.Result.Shippers;
                vm.PageIndex = response.Result.PageIndex;
                vm.PageCount = response.Result.PageCount;
            }
            else
            {
                ViewBag.Message = "查询失败.";
            }

            return(View(vm));
        }
Example #19
0
        public ActionResult ManageShipperEmailInfo(int Type, long ProjectID, long RelatedCustomerID, long ShipperID, string ShipperName, string EmailAddress, string EmailContent)
        {
            var response = new ShipperService().ManageShipperEmailInfo(
                new ManageShipperEmailInfoRequest()
            {
                ProjectID         = ProjectID,
                RelatedCustomerID = RelatedCustomerID,
                ShipperID         = ShipperID,
                ShipperName       = ShipperName,
                EmailAddress      = EmailAddress,
                EmailContent      = EmailContent,
                Type = Type
            });

            if (response.IsSuccess)
            {
                return(Json(new { IsSuccess = true }));
            }

            return(Json(new { IsSuccess = false }));
        }
        /// <summary>
        /// 修改訂單
        /// </summary>
        /// <param name="oederID"></param>
        /// <returns></returns>
        public ActionResult Update(int orderID)
        {
            ///連結orderService
            OrderService orderService = new OrderService();
            ///員工下拉式選單
            EmployeeService       employeeService = new EmployeeService();
            List <SelectListItem> employeeitems   = employeeService.GetEmployeeName();

            ViewBag.employeeService = employeeitems;
            ///出貨公司下拉式選單
            ShipperService        shipperService = new ShipperService();
            List <SelectListItem> shipperitems   = shipperService.GetShipperName();

            ViewBag.shipperService = shipperitems;
            ///顧客下拉式選單
            CustomerService       customerService = new CustomerService();
            List <SelectListItem> selectListItems = customerService.GetCustomerList();

            ViewBag.customerService = selectListItems;
            return(View(orderService.GetOrder(orderID)));
        }
        public ActionResult OrderUpdate(int OrderID)
        {
            CustomerService       customerService         = new CustomerService();
            List <Customers>      customersList           = customerService.getAllData();
            List <SelectListItem> customersSelectItemList = customersList.Select(
                m => new SelectListItem()
            {
                Text  = m.CompanyName,
                Value = "" + m.CustomerID
            }).ToList();

            ViewBag.customersSelectItemList = customersSelectItemList;

            EmployeeService       employeeService         = new EmployeeService();
            List <Employees>      employeesList           = employeeService.getAllData();
            List <SelectListItem> employeesSelectItemList = employeesList.Select(
                m => new SelectListItem()
            {
                Text  = m.FirstName + m.LastName,
                Value = "" + m.EmployeeID
            }).ToList();

            ViewBag.employeesSelectItemList = employeesSelectItemList;

            ShipperService        shipperService         = new ShipperService();
            List <Shippers>       shippersList           = shipperService.getAllData();
            List <SelectListItem> shippersSelectItemList = shippersList.Select(
                m => new SelectListItem()
            {
                Text  = m.CompanyName,
                Value = "" + m.ShipperID
            }).ToList();

            ViewBag.shippersSelectItemList = shippersSelectItemList;
            OrderService orderService = new OrderService();
            Orders       orderData    = orderService.getOrderById(OrderID);

            return(View(orderData));
        }
Example #22
0
        public ActionResult List()
        {
            ShipperListVM vm       = new ShipperListVM();
            var           response = new ShipperService().GetShippersByConditon(new GetShippersByConditionRequest()
            {
                ProjectId = base.UserInfo.ProjectID, Code = "", Name = "", EnglishName = "", State = true, PageSize = UtilConstants.PAGESIZE, PageIndex = 0
            });

            if (response.IsSuccess)
            {
                vm.Shippers  = response.Result.Shippers;
                vm.State     = true;
                vm.PageIndex = response.Result.PageIndex;
                vm.PageCount = response.Result.PageCount;
            }
            else
            {
                ViewBag.Message = "查询失败.";
            }

            return(View(vm));
        }
Example #23
0
        public ActionResult ShipperRelatedInfo(ShipperRelatedInfoViewModel vm)
        {
            var response = new ShipperService().GetShipperAllInfo(new GetShipperAllInfoRequest()
            {
                ShipperID = vm.ShipperID, ProjectID = vm.ProjectID, RelatedCustomerID = vm.RelatedCustomerID
            });

            if (response.IsSuccess)
            {
                vm.ShipperRelatedInfo             = response.Result.ShipperRelatedInfo;
                vm.ShipperRegionCoveredCollection = response.Result.ShipperRegionCoveredCollection;
            }

            vm.Customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID)
                           .Select(c => new SelectListItem()
            {
                Value = c.CustomerID.ToString(), Text = c.CustomerName
            });

            ModelState.Clear();
            return(View(vm));
        }
Example #24
0
        public ActionResult AddOrUpdateVehicle(bool isEdit, long id, long shipperID, string plateNumber, string pilot, string jobNumber, string contract, string str1, string str2, string str3, string str4, string str7)
        {
            Vehicle vehicle = new Vehicle()
            {
                ID          = id,
                ShipperID   = shipperID,
                PlateNumber = plateNumber,
                Pilot       = pilot,
                JobNumber   = jobNumber,
                Contract    = contract,
                Str1        = str1,
                Str2        = str2,
                Str3        = str3,
                Str4        = str4,
                Str5        = string.Empty,
                Str6        = string.Empty,
                Str7        = str7,
                Str8        = string.Empty,
                DateTime1   = null,
                DateTime2   = null,
                Decimal1    = null,
                Creator     = base.UserInfo.Name,
                CreateTime  = DateTime.Now,
                State       = true
            };

            var response = new ShipperService().AddOrUpdateVehicle(new AddOrUpdateVehicleRequest()
            {
                Vehicle = vehicle
            });

            if (response.IsSuccess)
            {
                return(Json(new { IsSuccess = true, IsEdit = isEdit, Vehicle = response.Result }));
            }

            throw new Exception("更新或者新增车辆失败");
        }
Example #25
0
        public ActionResult ManageShipperRegionCovered(long ProjectID, long RelatedCustomerID, long ShipperID, string ShipperName, long StartCityID, string StartCityName, long EndCityID, string EndCityName)
        {
            var response = new ShipperService().ManageShipperRegionCovered(
                new ManageShipperRegionCoveredRequest()
            {
                ShipperRegionCovered = new ShipperRegionCovered()
                {
                    ProjectID         = ProjectID,
                    RelatedCustomerID = RelatedCustomerID,
                    ShipperID         = ShipperID,
                    ShipperName       = ShipperName,
                    StartCityID       = StartCityID,
                    StartCityName     = StartCityName,
                    EndCityID         = EndCityID,
                    EndCityName       = EndCityName
                }
            });

            if (response.IsSuccess)
            {
                return(Json(new
                {
                    IsSuccess = true,
                    ProjectID = ProjectID,
                    RelatedCustomerID = RelatedCustomerID,
                    ShipperID = ShipperID,
                    ShipperName = ShipperName,
                    StartCityID = StartCityID,
                    StartCityName = StartCityName,
                    EndCityID = EndCityID,
                    EndCityName = EndCityName
                }));
            }

            return(Json(new { IsSuccess = false }));
        }
        public JsonResult OrderSearch(OrderSearchArgs orderSearchArgs)
        {
            OrderService  orderService = new OrderService();
            List <Orders> orderList    = orderService.getAllData();
            /**/
            IEnumerable <Orders> orderResult = orderList;

            // 訂單編號
            if (orderSearchArgs.OrderID.HasValue)
            {
                orderResult = orderResult.Where(m => m.OrderID == orderSearchArgs.OrderID.Value);
            }
            // 負責員工
            if (!string.IsNullOrWhiteSpace(orderSearchArgs.EmployeeName))
            {
                EmployeeService employeeService = new EmployeeService();
                orderResult =
                    orderResult.Where(
                        m => employeeService.GetEmployeeName(m.EmployeeID).Contains(orderSearchArgs.EmployeeName)
                        );
            }
            // 訂購日期
            if (orderSearchArgs.OrderDate.HasValue)
            {
                orderResult = orderResult.Where(m => m.OrderDate == orderSearchArgs.OrderDate.Value);
            }
            // 需要日期
            if (orderSearchArgs.RequiredDate.HasValue)
            {
                orderResult = orderResult.Where(m => m.RequiredDate == orderSearchArgs.RequiredDate.Value);
            }
            // 出貨日期
            if (orderSearchArgs.ShippedDate.HasValue)
            {
                orderResult = orderResult.Where(m => m.ShippedDate == orderSearchArgs.ShippedDate.Value);
            }
            // 運輸公司
            if (!string.IsNullOrWhiteSpace(orderSearchArgs.CompanyName))
            {
                ShipperService shipperService = new ShipperService();
                orderResult =
                    orderResult.Where(
                        m => shipperService.GetCompanyName(m.ShipperID).Contains(orderSearchArgs.CompanyName)
                        );
            }
            EmployeeService        employeesService    = new EmployeeService();
            List <Employees>       employeeList        = employeesService.getAllData();
            ShipperService         shippersService     = new ShipperService();
            List <Shippers>        ShipperList         = shippersService.getAllData();
            List <OrderSearchArgs> orderSearchArgsList = orderResult.Select(
                m => new OrderSearchArgs {
                OrderID      = m.OrderID,
                EmployeeName = employeeList.Single(empM => empM.EmployeeID == m.EmployeeID).FirstName + employeeList.Single(empM => empM.EmployeeID == m.EmployeeID).LastName,
                OrderDate    = m.OrderDate,
                RequiredDate = m.RequiredDate,
                ShippedDate  = m.ShippedDate,
                CompanyName  = ShipperList.Single(shipperM => shipperM.ShipperID == m.ShipperID).CompanyName
            }).ToList();

            return(Json(orderSearchArgsList, JsonRequestBehavior.AllowGet));
        }
Example #27
0
        /// <summary>
        /// 验证承运商名称唯一性
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="IsEdit">是否是编辑</param>
        /// <returns></returns>
        public string CheckName(string Name, int?Id, bool IsEdit)
        {
            ShipperService customer = new ShipperService();

            return(customer.CheckNameIsExist(Name.Trim(), Id, base.UserInfo.ProjectID.ToString(), IsEdit));
        }
Example #28
0
        public ActionResult Edit(ShipperVM model)
        {
            if (ModelState.IsValid)
            {
                ShipperEntity shipper = new ShipperEntity()
                {
                    ID                 = model.ID,
                    Code               = model.Code,
                    Name               = model.Name,
                    EnglishName        = model.EnglishName,
                    IsDangerous        = model.IsDangerous,
                    IsCustoms          = model.IsCustoms,
                    Email              = model.Email,
                    LawPerson          = model.LawPerson,
                    IsSupplier         = model.IsSupplier,
                    IsBalance          = model.IsBalance,
                    PostCode           = model.PostCode,
                    Address1           = model.Address1,
                    Address2           = model.Address2,
                    Bank               = model.Bank,
                    Account            = model.Account,
                    TaxID              = model.TaxID,
                    InvoiceTitle       = model.InvoiceTitle,
                    Contactor1         = model.Contactor1,
                    Title1             = model.Title1,
                    Phone1             = model.Phone1,
                    Fax1               = model.Fax1,
                    Contactor2         = model.Contactor2,
                    Title2             = model.Title2,
                    Phone2             = model.Phone2,
                    Fax2               = model.Fax2,
                    WebSite            = model.WebSite,
                    RegistAdd          = model.RegistAdd,
                    Comment            = model.Comment,
                    Creater            = model.Creater,
                    CreateTime         = model.CreateTime,
                    InsuranceCompany   = model.InsuranceCompany,
                    InsuranceType      = model.InsuranceType,
                    InsuranceOrderNo   = model.InsuranceOrderNo,
                    InsuranceCost      = model.InsuranceCost,
                    InsuranceStartTime = model.InsuranceStartTime,
                    InsuranceEndTime   = model.InsuranceEndTime,
                    Remark             = model.Remark,
                    State              = model.State,
                    Updater            = base.UserInfo.Name,
                    UpdateTime         = DateTime.Now,
                    Str1               = model.PostedShipperIdentifyIDs != null && model.PostedShipperIdentifyIDs.Any() ? string.Join(",", model.PostedShipperIdentifyIDs) : string.Empty,
                    Str2               = model.Str2,
                    Str3               = model.Str3
                };

                Response <long> response = new ShipperService().AddOrUpdateShipper(new AddOrUpdateShipperRequest()
                {
                    Shipper = shipper
                });
                if (response.IsSuccess)
                {
                    ApplicationConfigHelper.RefreshApplicationShippers();
                }
                ViewBag.Message = response.SuccessMessage;
            }

            model.AvailableShipperIdentifies = ApplicationConfigHelper.GetApplicationConfigs(Constants.SHIPPERIDENTIFY);
            model.SelectedShipperIdentifies  = model.AvailableShipperIdentifies.Where(t => model.PostedShipperIdentifyIDs.Contains(t.ID.ToString()));
            model.IsEdit = true;

            return(View("Create", model));
        }