Пример #1
0
        public JsonResult LoadProvincesByCountry(string strCountryName)
        {
            string strErrText;
            DDSystem dd = new DDSystem();
            List<Province> listProvince = dd.LoadProvincesByCountry(strCountryName, LoginAccountId, LoginStaffName, out strErrText);
            if (listProvince == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from p in listProvince
                      select p.Name;

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult OutWarehouse(string id)
        {
            string strErrText;

            //创建Model
            OutWarehouseBillViewModel model = new OutWarehouseBillViewModel();

            if (id != null && id != string.Empty)
            {
                //读取出库单数据
                StockSystem stock = new StockSystem();
                OutWarehouseBill data = stock.LoadOutWarehouseBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
                if (data == null)
                {
                    throw new Exception(strErrText);
                }

                model.Id = data.Id;
                model.BillNo = data.BillNo;
                model.PlanId = data.PlanId;
                model.CustomerId = data.CustomerId;
                model.CustomerName = data.CustomerName;
                model.DeliveryNo = data.DeliveryNo;
                model.OutType = data.OutType;
                model.ReceiverName = data.ReceiverName;
                model.ReceiverCountry = data.ReceiverCountry;
                model.ReceiverProvince = data.ReceiverProvince;
                model.ReceiverCity = data.ReceiverCity;
                model.ReceiverAddress = data.ReceiverAddress;
                model.ReceiverContact = data.ReceiverContact;
                model.ReceiverContactTel = data.ReceiverContactTel;
                model.ReceiveType = data.ReceiveType;
                model.CarNo = data.CarNo;
                model.TrailerNo = data.TrailerNo;
                model.CarrierId = data.CarrierId;
                model.CarrierName = data.CarrierName;
                model.PayerId = data.PayerId;
                model.PayerName = data.PayerName;
                model.IsConsigning = data.IsConsigning;
                model.ConsignedDeliveryNo = data.ConsignedDeliveryNo;
                model.Warehouse = data.Warehouse;
                model.LoadingForceFeePrice = data.LoadingForceFeePrice;
                model.ForceFee = data.ForceFee;
                model.Remark = data.Remark;
                model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd");
            }
            else
            {
                model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");
            }

            model.Goods = new List<OutWarehouseBillGoodsViewModel>();
            model.Goods.Add(new OutWarehouseBillGoodsViewModel());

            //生成国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countrys"] = new SelectList(selectListCountry, "Value", "Text", model.ReceiverCountry);

            //生成省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.ReceiverCountry))
            {
                listState = dd.LoadProvincesByCountry(model.ReceiverCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listState = new List<Province>();
            }
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from p in listState
                                     select new SelectListItem
                                     {
                                         Text = p.Name,
                                         Value = p.Name
                                     });
            ViewData["Provinces"] = new SelectList(selectListState, "Value", "Text", model.ReceiverProvince);

            //生成城市下拉列表项
            List<City> listCity = null;
            if (!string.IsNullOrEmpty(model.ReceiverProvince))
            {
                listCity = dd.LoadCitysByProvince(model.ReceiverCountry, model.ReceiverProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listCity = new List<City>();
            }
            List<SelectListItem> selectListCity = new List<SelectListItem>();
            selectListCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCity.AddRange(from ci in listCity
                                    select new SelectListItem
                                    {
                                        Text = ci.Name,
                                        Value = ci.Name
                                    });
            ViewData["Citys"] = new SelectList(selectListCity, "Value", "Text", model.ReceiverCity);

            //生成仓库下拉列表项
            List<Warehouse> listWarehouse = dd.LoadWarehouses(LoginAccountId, LoginStaffName, out strErrText);
            if (listWarehouse == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListWarehouse = new List<SelectListItem>();
            selectListWarehouse.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListWarehouse.AddRange(from w in listWarehouse
                                         select new SelectListItem
                                         {
                                             Text = w.Name,
                                             Value = w.Name
                                         });
            ViewData["Warehouses"] = new SelectList(selectListWarehouse, "Value", "Text", model.Warehouse);

            return View(model);
        }
Пример #3
0
        public ActionResult ModifyCity(string id)
        {
            string strErrText;

            //生成Model数据
            DDSystem city = new DDSystem();
            City data = city.LoadCity(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            CityViewModel model = new CityViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.CountryName = data.CountryName;
            model.ProvinceName = data.ProvinceName;
            model.Remark = data.Remark;

            //生成国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countries"] = new SelectList(selectListCountry, "Value", "Text", model.CountryName);

            //生成空的省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.CountryName))
            {
                listState = dd.LoadProvincesByCountry(model.CountryName, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listState = new List<Province>();
            }
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from s in listState
                                     select new SelectListItem
                                     {
                                         Text = s.Name,
                                         Value = s.Name
                                     });
            ViewData["States"] = new SelectList(selectListState, "Value", "Text", model.ProvinceName);

            return View(model);
        }
Пример #4
0
        public JsonResult LoadProvinces(string term, string countryName)
        {
            //读取指定国家的省份数据
            string strErrText = string.Empty;
            DDSystem dd = new DDSystem();
            List<Province> listProvince = dd.LoadProvincesByCountry(countryName, LoginAccountId, LoginStaffName, out strErrText);
            if (listProvince == null)
            {
                listProvince = new List<Province>();
            }

            //提取省份名称中包含关键字的记录
            var ret = from c in listProvince
                      where c.Name.Contains(term)
                      select c.Name;

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Пример #5
0
        public ActionResult OutStockEndDifferences()
        {
            string strErrText;

            //创建Model
            OutWarehouseBillViewModel model = new OutWarehouseBillViewModel();
            model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

            model.Goods = new List<OutWarehouseBillGoodsViewModel>();
            model.Goods.Add(new OutWarehouseBillGoodsViewModel());

            //生成国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countrys"] = new SelectList(selectListCountry, "Value", "Text", model.ReceiverCountry);

            //生成省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.ReceiverCountry))
            {
                listState = dd.LoadProvincesByCountry(model.ReceiverCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listState = new List<Province>();
            }
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from p in listState
                                     select new SelectListItem
                                     {
                                         Text = p.Name,
                                         Value = p.Name
                                     });
            ViewData["Provinces"] = new SelectList(selectListState, "Value", "Text", model.ReceiverProvince);

            //生成城市下拉列表项
            List<City> listCity = null;
            if (!string.IsNullOrEmpty(model.ReceiverProvince))
            {
                listCity = dd.LoadCitysByProvince(model.ReceiverCountry, model.ReceiverProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listCity = new List<City>();
            }
            List<SelectListItem> selectListCity = new List<SelectListItem>();
            selectListCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCity.AddRange(from ci in listCity
                                    select new SelectListItem
                                    {
                                        Text = ci.Name,
                                        Value = ci.Name
                                    });
            ViewData["Citys"] = new SelectList(selectListCity, "Value", "Text", model.ReceiverCity);

            //生成仓库下拉列表项
            List<Warehouse> listWarehouse = dd.LoadWarehouses(LoginAccountId, LoginStaffName, out strErrText);
            if (listWarehouse == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListWarehouse = new List<SelectListItem>();
            selectListWarehouse.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListWarehouse.AddRange(from w in listWarehouse
                                         select new SelectListItem
                                         {
                                             Text = w.Name,
                                             Value = w.Name
                                         });
            ViewData["Warehouses"] = new SelectList(selectListWarehouse, "Value", "Text", model.Warehouse);

            return View(model);
        }
Пример #6
0
        public ActionResult ModifyTransportLimitedPrice(string id)
        {
            string strErrText;

            //生成Model数据
            DDSystem dd = new DDSystem();
            TransportLimitedPrice data = dd.LoadTransportLimitedPrice(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            TransportLimitedPriceViewModel model = new TransportLimitedPriceViewModel();
            model.Id = data.Id;
            model.PlanType = data.PlanType;
            model.StartCountry = data.StartCountry;
            model.StartProvince = data.StartProvince;
            model.StartCity = data.StartCity;
            model.DestCountry = data.DestCountry;
            model.DestProvince = data.DestProvince;
            model.DestCity = data.DestCity;
            model.CarType = data.CarType;
            model.MinTunnagesOrPiles = data.MinTunnagesOrPiles;
            model.MaxTunnagesOrPiles = data.MaxTunnagesOrPiles;
            model.StartTime = data.StartTime.ToString("yyyy-MM-dd");
            model.EndTime = data.EndTime.ToString("yyyy-MM-dd");
            model.TransportPrice = data.TransportPrice;
            model.TransportCharges = data.TransportCharges;

            //生成起点国家下拉列表项
            List<Country> listStartCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listStartCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStartCountry = new List<SelectListItem>();
            selectListStartCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCountry.AddRange(from c in listStartCountry
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Name
                                            });
            ViewData["StartCountrys"] = new SelectList(selectListStartCountry, "Value", "Text", model.StartCountry);

            //生成起点省份下拉列表项
            List<Province> listStartProvince = null;
            if (!string.IsNullOrEmpty(model.StartCountry))
            {
                listStartProvince = dd.LoadProvincesByCountry(model.StartCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartProvince = new List<Province>();
            }
            List<SelectListItem> selectListStartProvince = new List<SelectListItem>();
            selectListStartProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartProvince.AddRange(from s in listStartProvince
                                             select new SelectListItem
                                             {
                                                 Text = s.Name,
                                                 Value = s.Name
                                             });
            ViewData["StartProvinces"] = new SelectList(selectListStartProvince, "Value", "Text", model.StartProvince);

            //生成起点城市下拉列表项
            List<City> listStartCity = null;
            if (!string.IsNullOrEmpty(model.StartProvince))
            {
                listStartCity = dd.LoadCitysByProvince(model.StartCountry, model.StartProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartCity = new List<City>();
            }
            List<SelectListItem> selectListStartCity = new List<SelectListItem>();
            selectListStartCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCity.AddRange(from ci in listStartCity
                                         select new SelectListItem
                                         {
                                             Text = ci.Name,
                                             Value = ci.Name
                                         });
            ViewData["StartCitys"] = new SelectList(selectListStartCity, "Value", "Text", model.StartCity);

            //生成讫点国家下拉列表项
            List<Country> listDestCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listDestCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListDestCountry = new List<SelectListItem>();
            selectListDestCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCountry.AddRange(from c in listDestCountry
                                           select new SelectListItem
                                           {
                                               Text = c.Name,
                                               Value = c.Name
                                           });
            ViewData["DestCountrys"] = new SelectList(selectListDestCountry, "Value", "Text", model.DestCountry);

            //生成讫点省份下拉列表项
            List<Province> listDestProvince = null;
            if (!string.IsNullOrEmpty(model.DestCountry))
            {
                listDestProvince = dd.LoadProvincesByCountry(model.DestCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestProvince = new List<Province>();
            }
            List<SelectListItem> selectListDestProvince = new List<SelectListItem>();
            selectListDestProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestProvince.AddRange(from s in listDestProvince
                                            select new SelectListItem
                                            {
                                                Text = s.Name,
                                                Value = s.Name
                                            });
            ViewData["DestProvinces"] = new SelectList(selectListDestProvince, "Value", "Text", model.DestProvince);

            //生成讫点城市下拉列表项
            List<City> listDestCity = null;
            if (!string.IsNullOrEmpty(model.DestProvince))
            {
                listDestCity = dd.LoadCitysByProvince(model.DestCountry, model.DestProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestCity = new List<City>();
            }
            List<SelectListItem> selectListDestCity = new List<SelectListItem>();
            selectListDestCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCity.AddRange(from ci in listDestCity
                                        select new SelectListItem
                                        {
                                            Text = ci.Name,
                                            Value = ci.Name
                                        });
            ViewData["DestCitys"] = new SelectList(selectListDestCity, "Value", "Text", model.DestCity);

            return View(model);
        }
Пример #7
0
        public ActionResult ModifyReceiver(string id)
        {
            string strErrText;

            //生成Model数据
            DDSystem dd = new DDSystem();
            Receiver data = dd.LoadReceiver(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            ReceiverViewModel model = new ReceiverViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.Country = data.Country;
            model.Province = data.Province;
            model.City = data.City;
            model.Address = data.Address;
            model.Contact = data.Contact;
            model.ContactTel = data.ContactTel;

            model.Distances = new List<ReceiverDistanceViewModel>();
            model.Distances.Add(new ReceiverDistanceViewModel());

            //生成国家下拉列表项
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countrys"] = new SelectList(selectListCountry, "Value", "Text", model.Country);

            //生成空的省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.Country))
            {
                listState = dd.LoadProvincesByCountry(model.Country, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listState = new List<Province>();
            }
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from s in listState
                                     select new SelectListItem
                                     {
                                         Text = s.Name,
                                         Value = s.Name
                                     });
            ViewData["Provinces"] = new SelectList(selectListState, "Value", "Text", model.Province);

            //生成空的城市下拉列表项
            List<City> listCity = null;
            if (!string.IsNullOrEmpty(model.Province))
            {
                listCity = dd.LoadCitysByProvince(model.Country, model.Province, LoginAccountId, LoginStaffName, out strErrText);
                if (listCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listCity = new List<City>();
            }
            List<SelectListItem> selectListCity = new List<SelectListItem>();
            selectListCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCity.AddRange(from ci in listCity
                                    select new SelectListItem
                                    {
                                        Text = ci.Name,
                                        Value = ci.Name
                                    });
            ViewData["Citys"] = new SelectList(selectListCity, "Value", "Text", model.City);

            return View(model);
        }
Пример #8
0
        public ActionResult ModifyOrganization(string id)
        {
            string strErrText;

            //生成Model数据
            OrganizationSystem organ = new OrganizationSystem();
            Organization data = organ.LoadOrganization(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            OrganizationViewModel model = new OrganizationViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.ParentId = data.ParentId;
            model.CountryName = data.CountryName;
            model.StateName = data.ProvinceName;
            model.CityName = data.CityName;
            model.Address = data.Address;
            model.PostalCode = data.PostalCode;
            model.Remark = data.Remark;

            //生成上级组织部门下拉列表项
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListOrganization.AddRange(from o in listOrganization
                                            where !o.FullPath.StartsWith(data.FullPath)
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text", model.ParentId);

            //生成国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countries"] = new SelectList(selectListCountry, "Value", "Text", model.CountryName);

            //生成空的省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.CountryName))
            {
                listState = dd.LoadProvincesByCountry(model.CountryName, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listState = new List<Province>();
            }
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from s in listState
                                     select new SelectListItem
                                     {
                                         Text = s.Name,
                                         Value = s.Name
                                     });
            ViewData["States"] = new SelectList(selectListState, "Value", "Text", model.StateName);

            //生成空的城市下拉列表项
            List<City> listCity = null;
            if (!string.IsNullOrEmpty(model.StateName))
            {
                listCity = dd.LoadCitysByProvince(model.CountryName, model.StateName, LoginAccountId, LoginStaffName, out strErrText);
                if (listCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listCity = new List<City>();
            }
            List<SelectListItem> selectListCity = new List<SelectListItem>();
            selectListCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCity.AddRange(from ci in listCity
                                    select new SelectListItem
                                    {
                                        Text = ci.Name,
                                        Value = ci.Name
                                    });
            ViewData["Cities"] = new SelectList(selectListCity, "Value", "Text", model.CityName);

            return View(model);
        }
Пример #9
0
        public ActionResult CustomerNewPaperPlan()
        {
            string strErrText;

            //创建空的Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

            model.Goods = new List<PaperPlanGoodsViewModel>();
            model.Goods.Add(new PaperPlanGoodsViewModel());

            //设置客户信息和付款单位信息
            if (LoginAccountType == InnoSoft.LS.Resources.Options.Customer)
            {
                model.CustomerId = LoginOrganId;
                model.CustomerName = LoginOrganName;
                model.PayerId = model.CustomerId;
                model.PayerName = model.CustomerName;

                //读取客户所属办事处数据
                CustomerSystem customer = new CustomerSystem();
                Customer dataCustomer = customer.LoadCustomer(model.CustomerId, LoginAccountId, LoginStaffName, out strErrText);
                if (dataCustomer == null)
                {
                    throw new Exception(strErrText);
                }
                OrganizationSystem organ = new OrganizationSystem();
                Organization dataOrgan = organ.LoadOrganization(dataCustomer.OwnOrganId, LoginAccountId, LoginStaffName, out strErrText);
                if (dataOrgan == null)
                {
                    throw new Exception(strErrText);
                }
                model.StartCountry = dataOrgan.CountryName;
                model.StartProvince = dataOrgan.ProvinceName;
                model.StartCity = dataOrgan.CityName;
            }

            //生成讫点国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listDestCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listDestCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListDestCountry = new List<SelectListItem>();
            selectListDestCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCountry.AddRange(from c in listDestCountry
                                           select new SelectListItem
                                           {
                                               Text = c.Name,
                                               Value = c.Name
                                           });
            ViewData["DestCountrys"] = new SelectList(selectListDestCountry, "Value", "Text");

            //生成空的讫点省份下拉列表项
            List<Province> listDestProvince = new List<Province>();
            List<SelectListItem> selectListDestProvince = new List<SelectListItem>();
            selectListDestProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestProvince.AddRange(from s in listDestProvince
                                            select new SelectListItem
                                            {
                                                Text = s.Name,
                                                Value = s.Name
                                            });
            ViewData["DestProvinces"] = new SelectList(selectListDestProvince, "Value", "Text");

            //生成空的讫点城市下拉列表项
            List<City> listDestCity = new List<City>();
            List<SelectListItem> selectListDestCity = new List<SelectListItem>();
            selectListDestCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCity.AddRange(from ci in listDestCity
                                        select new SelectListItem
                                        {
                                            Text = ci.Name,
                                            Value = ci.Name
                                        });
            ViewData["DestCitys"] = new SelectList(selectListDestCity, "Value", "Text");

            //生成起点国家下拉列表项
            List<Country> listStartCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listStartCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStartCountry = new List<SelectListItem>();
            selectListStartCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCountry.AddRange(from c in listStartCountry
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Name
                                            });
            ViewData["StartCountrys"] = new SelectList(selectListStartCountry, "Value", "Text", model.StartCountry);

            //生成起点省份下拉列表项
            List<Province> listStartProvince = null;
            if (!string.IsNullOrEmpty(model.StartCountry))
            {
                listStartProvince = dd.LoadProvincesByCountry(model.StartCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartProvince = new List<Province>();
            }
            List<SelectListItem> selectListStartProvince = new List<SelectListItem>();
            selectListStartProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartProvince.AddRange(from p in listStartProvince
                                             select new SelectListItem
                                             {
                                                 Text = p.Name,
                                                 Value = p.Name
                                             });
            ViewData["StartProvinces"] = new SelectList(selectListStartProvince, "Value", "Text", model.StartProvince);

            //生成起点城市下拉列表项
            List<City> listStartCity = null;
            if (!string.IsNullOrEmpty(model.StartProvince))
            {
                listStartCity = dd.LoadCitysByProvince(model.StartCountry, model.StartProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartCity = new List<City>();
            }
            List<SelectListItem> selectListStartCity = new List<SelectListItem>();
            selectListStartCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCity.AddRange(from ci in listStartCity
                                         select new SelectListItem
                                         {
                                             Text = ci.Name,
                                             Value = ci.Name
                                         });
            ViewData["StartCitys"] = new SelectList(selectListStartCity, "Value", "Text", model.StartCity);

            return View(model);
        }
Пример #10
0
        public ActionResult ModifyPaperPlan(string id)
        {
            string strErrText;

            //读取计划数据
            PlanSystem plan = new PlanSystem();
            DeliverPlan data = plan.LoadDeliverPlan(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.Id = data.Id;
            model.CustomerId = data.CustomerId;
            model.CustomerName = data.CustomerName;
            model.ShipmentNo = data.ShipmentNo;
            model.DeliveryNo = data.DeliveryNo;
            model.DeliverType = data.DeliverType;
            model.ReceiverName = data.ReceiverName;
            model.ReceiverCountry = data.ReceiverCountry;
            model.ReceiverProvince = data.ReceiverProvince;
            model.ReceiverCity = data.ReceiverCity;
            model.ReceiverAddress = data.ReceiverAddress;
            model.ReceiverContact = data.ReceiverContact;
            model.ReceiverContactTel = data.ReceiverContactTel;
            model.OrderNo = data.OrderNo;
            model.ReceiveType = data.ReceiveType;
            model.CarNo = data.CarNo;
            model.TrailerNo = data.TrailerNo;
            model.DriverName = data.DriverName;
            model.DriverLicenseNo = data.DriverLicenseNo;
            model.DriverMobileTel = data.DriverMobileTel;
            model.DriverHomeTel = data.DriverHomeTel;
            model.ArrivalTime = data.ArrivalTime;
            model.PayerId = data.PayerId;
            model.PayerName = data.PayerName;
            model.IsConsigning = data.IsConsigning;
            model.ConsignedDeliveryNo = data.ConsignedDeliveryNo;
            model.IsInstalment = data.IsInstalment;
            model.StartCountry = data.StartCountry;
            model.StartProvince = data.StartProvince;
            model.StartCity = data.StartCity;
            model.Remark = data.Remark;
            model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd");

            model.Goods = new List<PaperPlanGoodsViewModel>();
            model.Goods.Add(new PaperPlanGoodsViewModel());

            //生成讫点国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listDestCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listDestCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListDestCountry = new List<SelectListItem>();
            selectListDestCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCountry.AddRange(from c in listDestCountry
                                           select new SelectListItem
                                           {
                                               Text = c.Name,
                                               Value = c.Name
                                           });
            ViewData["DestCountrys"] = new SelectList(selectListDestCountry, "Value", "Text", model.ReceiverCountry);

            //生成讫点省份下拉列表项
            List<Province> listDestProvince = null;
            if (!string.IsNullOrEmpty(model.ReceiverCountry))
            {
                listDestProvince = dd.LoadProvincesByCountry(model.ReceiverCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestProvince = new List<Province>();
            }
            List<SelectListItem> selectListDestProvince = new List<SelectListItem>();
            selectListDestProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestProvince.AddRange(from p in listDestProvince
                                            select new SelectListItem
                                            {
                                                Text = p.Name,
                                                Value = p.Name
                                            });
            ViewData["DestProvinces"] = new SelectList(selectListDestProvince, "Value", "Text", model.ReceiverProvince);

            //生成讫点城市下拉列表项
            List<City> listDestCity = null;
            if (!string.IsNullOrEmpty(model.ReceiverProvince))
            {
                listDestCity = dd.LoadCitysByProvince(model.ReceiverCountry, model.ReceiverProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestCity = new List<City>();
            }
            List<SelectListItem> selectListDestCity = new List<SelectListItem>();
            selectListDestCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCity.AddRange(from ci in listDestCity
                                        select new SelectListItem
                                        {
                                            Text = ci.Name,
                                            Value = ci.Name
                                        });
            ViewData["DestCitys"] = new SelectList(selectListDestCity, "Value", "Text", model.ReceiverCity);

            //生成起点国家下拉列表项
            List<Country> listStartCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listStartCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStartCountry = new List<SelectListItem>();
            selectListStartCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCountry.AddRange(from c in listStartCountry
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Name
                                            });
            ViewData["StartCountrys"] = new SelectList(selectListStartCountry, "Value", "Text", model.StartCountry);

            //生成起点省份下拉列表项
            List<Province> listStartProvince = null;
            if (!string.IsNullOrEmpty(model.StartCountry))
            {
                listStartProvince = dd.LoadProvincesByCountry(model.StartCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartProvince = new List<Province>();
            }
            List<SelectListItem> selectListStartProvince = new List<SelectListItem>();
            selectListStartProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartProvince.AddRange(from p in listStartProvince
                                             select new SelectListItem
                                             {
                                                 Text = p.Name,
                                                 Value = p.Name
                                             });
            ViewData["StartProvinces"] = new SelectList(selectListStartProvince, "Value", "Text", model.StartProvince);

            //生成起点城市下拉列表项
            List<City> listStartCity = null;
            if (!string.IsNullOrEmpty(model.StartProvince))
            {
                listStartCity = dd.LoadCitysByProvince(model.StartCountry, model.StartProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartCity = new List<City>();
            }
            List<SelectListItem> selectListStartCity = new List<SelectListItem>();
            selectListStartCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCity.AddRange(from ci in listStartCity
                                         select new SelectListItem
                                         {
                                             Text = ci.Name,
                                             Value = ci.Name
                                         });
            ViewData["StartCitys"] = new SelectList(selectListStartCity, "Value", "Text", model.StartCity);

            return View(model);
        }