Пример #1
0
        public ActionResult ModifyGoodsType(GoodsTypeViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                GoodsType data = new GoodsType();
                data.Id       = model.Id;
                data.Name     = model.Name;
                data.ParentId = model.ParentId;
                data.Remark   = model.Remark ?? string.Empty;

                //保存数据
                string   strErrText;
                DDSystem dd = new DDSystem();
                if (dd.UpdateGoodsType(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return(Json(string.Empty));
                }
                else
                {
                    return(Json(strErrText));
                }
            }
            return(View(model));
        }
Пример #2
0
        public ActionResult ModifyCity(CityViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                City data = new City();
                data.Id           = model.Id;
                data.Name         = model.Name;
                data.CountryName  = model.CountryName;
                data.ProvinceName = model.ProvinceName;
                data.Remark       = model.Remark ?? string.Empty;

                //保存数据
                string   strErrText;
                DDSystem city = new DDSystem();
                if (city.UpdateCity(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return(Json(string.Empty));
                }
                else
                {
                    return(Json(strErrText));
                }
            }
            return(View(model));
        }
Пример #3
0
        public JsonResult LoadGoodsByGoodsNo(string strGoodsNo)
        {
            string   strErrText;
            DDSystem dd   = new DDSystem();
            Goods    data = dd.LoadGoodsByGoodsNo(strGoodsNo, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    Id          = data.Id,
                    Name        = data.Name,
                    Brand       = data.Brand,
                    SpecModel   = data.SpecModel,
                    GWeight     = data.GWeight,
                    Grade       = data.Grade,
                    Packing     = data.Packing,
                    PieceWeight = data.PieceWeight
                };

                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
Пример #4
0
        public JsonResult LoadReceiverByName(string strName)
        {
            string   strErrText;
            DDSystem dd   = new DDSystem();
            Receiver data = dd.LoadReceiverByName(strName, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    Country    = data.Country,
                    Province   = data.Province,
                    City       = data.City,
                    Address    = data.Address,
                    Contact    = data.Contact,
                    ContactTel = data.ContactTel
                };

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

            //生成国家下拉列表项
            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
            ProvinceViewModel model = new ProvinceViewModel();

            return(View(model));
        }
Пример #6
0
        public ActionResult ModifyProvince(ProvinceViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Province data = new Province();
                data.Id          = model.Id;
                data.Name        = model.Name;
                data.CountryName = model.CountryName;
                data.Remark      = model.Remark ?? string.Empty;

                //保存数据
                string   strErrText;
                DDSystem province = new DDSystem();
                if (province.UpdateProvince(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return(Json(string.Empty));
                }
                else
                {
                    return(Json(strErrText));
                }
            }
            return(View(model));
        }
Пример #7
0
        public ActionResult NewGoodsType()
        {
            string strErrText;

            //生成上级货物类别下拉列表项
            DDSystem         dd            = new DDSystem();
            List <GoodsType> listGoodsType = dd.LoadGoodsTypes(LoginAccountId, LoginStaffName, out strErrText);

            if (listGoodsType == null)
            {
                throw new Exception(strErrText);
            }
            List <SelectListItem> selectListGoodsType = new List <SelectListItem>();

            selectListGoodsType.Add(new SelectListItem {
                Text = string.Empty, Value = "0"
            });
            selectListGoodsType.AddRange(from o in listGoodsType
                                         orderby o.FullName
                                         select new SelectListItem
            {
                Text  = o.FullName,
                Value = o.Id.ToString()
            });
            ViewData["GoodsTypes"] = new SelectList(selectListGoodsType, "Value", "Text");

            //创建空的Model
            GoodsTypeViewModel model = new GoodsTypeViewModel();

            return(View(model));
        }
Пример #8
0
        public ActionResult DeleteCity(string id)
        {
            //删除数据
            string   strErrText;
            DDSystem city = new DDSystem();

            if (city.DeleteCity(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText))
            {
                return(Json(string.Empty));
            }
            else
            {
                return(Json(strErrText));
            }
        }
Пример #9
0
        public JsonResult LoadCarrierTransportPrice(string carrierId, string startCountry, string startProvince, string startCity, string destCountry, string destProvince, string destCity, string planType, string createTime)
        {
            string   strErrText;
            DDSystem dd = new DDSystem();
            CarrierTransportPrice data = dd.LoadCarrierTransportPrice(long.Parse(carrierId), startCountry, startProvince, startCity, destCountry, destProvince, destCity, planType, DateTime.Parse(createTime), LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(data.TransportPrice, JsonRequestBehavior.AllowGet));
            }
        }
Пример #10
0
        public JsonResult LoadDistance(string strReceiverName, string startCountry, string startProvince, string startCity)
        {
            string           strErrText;
            DDSystem         dd   = new DDSystem();
            ReceiverDistance data = dd.LoadReceiverDistance(strReceiverName, startCountry, startProvince, startCity, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(data.KM, JsonRequestBehavior.AllowGet));
            }
        }
Пример #11
0
        public JsonResult LoadCountrysGrid(string sidx, string sord, int page, int rows)
        {
            //读取全部数据
            string         strErrText;
            DDSystem       country     = new DDSystem();
            List <Country> listCountry = country.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);

            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows  = listCountry.Count;
            int nPageIndex  = page;
            int nPageSize   = rows;
            int nTotalPages = nTotalRows / nPageSize;

            if (nTotalRows % nPageSize > 0)
            {
                nTotalPages++;
            }

            string sortExpression = (sidx ?? "Id") + " " + (sord ?? "ASC");
            var    data           = listCountry.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total   = nTotalPages,
                page    = nPageIndex,
                records = nTotalRows,
                rows    = (
                    from c in data
                    select new
                {
                    id = c.Id,
                    cell = new string[]
                    {
                        c.Id.ToString(),
                        c.Name,
                        c.Remark,
                    }
                }).ToArray()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public JsonResult LoadProvincesGrid(string sidx, string sord, int page, int rows)
        {
            //读取全部数据
            string          strErrText;
            DDSystem        province     = new DDSystem();
            List <Province> listProvince = province.LoadProvinces(LoginAccountId, LoginStaffName, out strErrText);

            if (listProvince == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows  = listProvince.Count;
            int nPageIndex  = page;
            int nPageSize   = rows;
            int nTotalPages = nTotalRows / nPageSize;

            if (nTotalRows % nPageSize > 0)
            {
                nTotalPages++;
            }

            var data = listProvince.OrderBy(p => p.Name).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total   = nTotalPages,
                page    = nPageIndex,
                records = nTotalRows,
                rows    = (
                    from p in data
                    select new
                {
                    id = p.Id,
                    cell = new string[]
                    {
                        p.Id.ToString(),
                        p.Name,
                        p.CountryName,
                        p.Remark,
                    }
                }).ToArray()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #13
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));
        }
Пример #14
0
        public JsonResult LoadCustomerReceivers(string customerName)
        {
            string          strErrText;
            DDSystem        dd           = new DDSystem();
            List <Receiver> listReceiver = dd.LoadCustomerReceivers(customerName, LoginAccountId, LoginStaffName, out strErrText);

            if (listReceiver == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from r in listReceiver
                      select r.Name;

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        public JsonResult LoadCitysByProvince(string strCountryName, string strProvinceName)
        {
            string      strErrText;
            DDSystem    dd       = new DDSystem();
            List <City> listCity = dd.LoadCitysByProvince(strCountryName, strProvinceName, LoginAccountId, LoginStaffName, out strErrText);

            if (listCity == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from c in listCity
                      select c.Name;

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #16
0
        public JsonResult LoadGenerateBusinessCarriersByTimespan(string startTime, string endTime)
        {
            string         strErrText;
            DDSystem       dd          = new DDSystem();
            List <Carrier> listCarrier = dd.LoadGenerateBusinessCarriersByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);

            if (listCarrier == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from c in listCarrier
                      select c.Name;

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

            //生成Model数据
            DDSystem province = new DDSystem();
            Province data     = province.LoadProvince(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                throw new Exception(strErrText);
            }

            ProvinceViewModel model = new ProvinceViewModel();

            model.Id          = data.Id;
            model.Name        = data.Name;
            model.CountryName = data.CountryName;
            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);

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

            //生成Model数据
            DDSystem  dd   = new DDSystem();
            GoodsType data = dd.LoadGoodsType(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                throw new Exception(strErrText);
            }

            GoodsTypeViewModel model = new GoodsTypeViewModel();

            model.Id       = data.Id;
            model.Name     = data.Name;
            model.ParentId = data.ParentId;
            model.Remark   = data.Remark;

            List <GoodsType> listGoodsType = dd.LoadGoodsTypes(LoginAccountId, LoginStaffName, out strErrText);

            if (listGoodsType == null)
            {
                throw new Exception(strErrText);
            }
            List <SelectListItem> selectlistGoodsType = new List <SelectListItem>();

            selectlistGoodsType.Add(new SelectListItem {
                Text = string.Empty, Value = "0"
            });
            selectlistGoodsType.AddRange(from t in listGoodsType
                                         where !t.FullPath.StartsWith(data.FullPath)
                                         orderby t.FullName
                                         select new SelectListItem
            {
                Text  = t.FullName,
                Value = t.Id.ToString()
            });
            ViewData["GoodsTypes"] = new SelectList(selectlistGoodsType, "Value", "Text", model.ParentId);

            return(View(model));
        }
Пример #19
0
        public JsonResult LoadGoodsTypes()
        {
            string           strErrText    = string.Empty;
            DDSystem         dd            = new DDSystem();
            List <GoodsType> listGoodsType = dd.LoadGoodsTypes(LoginAccountId, LoginStaffName, out strErrText);

            if (listGoodsType == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from t in listGoodsType
                      select new
            {
                t.Id,
                t.FullName
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #20
0
        public JsonResult LoadDriversByCarNo(string strCarNo)
        {
            string               strErrText;
            DDSystem             dd         = new DDSystem();
            List <CarrierDriver> listDriver = dd.LoadDriversByCarNo(strCarNo, LoginAccountId, LoginStaffName, out strErrText);

            if (listDriver == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from d in listDriver
                      select new
            {
                d.Id,
                d.Name
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #21
0
        public JsonResult LoadDriver(long nId)
        {
            string        strErrText;
            DDSystem      dd   = new DDSystem();
            CarrierDriver data = dd.LoadDriver(nId, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                throw new Exception(strErrText);
            }

            var ret = new
            {
                LicenseNo = data.LicenseNo,
                MobileTel = data.MobileTel,
                HomeTel   = data.HomeTel,
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #22
0
        public JsonResult LoadCarrierSettlementExpression(string carrierId, string planType)
        {
            string   strErrText;
            DDSystem dd = new DDSystem();
            CarrierSettlementExpression data = dd.LoadCarrierSettlementExpression(long.Parse(carrierId), planType, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    TransportChargeExpression = data.TransportChargeExpression,
                    TransportPriceExpression  = data.TransportPriceExpression
                };
                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
Пример #23
0
        public ActionResult ModifyCountry(string id)
        {
            string strErrText;

            //生成Model数据
            DDSystem country = new DDSystem();
            Country  data    = country.LoadCountry(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                throw new Exception(strErrText);
            }

            CountryViewModel model = new CountryViewModel();

            model.Id     = data.Id;
            model.Name   = data.Name;
            model.Remark = data.Remark;

            return(View(model));
        }
Пример #24
0
        public JsonResult LoadCarrierCars(string carrierName)
        {
            string            strErrText;
            DDSystem          dd      = new DDSystem();
            List <CarrierCar> listCar = dd.LoadCarrierCars(carrierName, LoginAccountId, LoginStaffName, out strErrText);

            if (listCar == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from c in listCar
                      select new
            {
                c.CarNo,
                c.TrailerNo,
                c.CarryingCapacity
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #25
0
        public JsonResult LoadCarByCarNo(string strCarNo)
        {
            string     strErrText;
            DDSystem   dd   = new DDSystem();
            CarrierCar data = dd.LoadCarByCarNo(strCarNo, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    TrailerNo        = data.TrailerNo,
                    CarryingCapacity = data.CarryingCapacity
                };

                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
Пример #26
0
        public JsonResult LoadGoodsTypesGrid(long?nodeid, int?n_level)
        {
            //读取全部数据
            string           strErrText;
            DDSystem         dd            = new DDSystem();
            List <GoodsType> listGoodsType = dd.LoadGoodsTypes(LoginAccountId, LoginStaffName, out strErrText);

            if (listGoodsType == null)
            {
                throw new Exception(strErrText);
            }

            //根据父子关系生成类别树
            List <GoodsType> data = new List <GoodsType>();

            RecursiveMakeGoodsTypeTree(listGoodsType, 0, ref data);

            //返回数据
            var ret = new
            {
                page    = 1,
                total   = 1,
                records = data.Count,
                rows    = (from t in data
                           select new
                {
                    cell = new[] {
                        t.Name,
                        t.Id.ToString(),
                        t.Remark,
                        (t.FullPath.Where(c => c == '\\').Count() - 1).ToString(),
                        t.ParentId.ToString(),
                        data.Where(GoodsType => (GoodsType.FullPath.StartsWith(t.FullPath) && GoodsType.Id != t.Id)).Count() == 0 ? "true" : "false",
                        "true"
                    }
                }).ToArray()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Пример #27
0
        public ActionResult NewCountry(CountryViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Country data = new Country();
                data.Name   = model.Name;
                data.Remark = model.Remark ?? string.Empty;

                //保存数据
                string   strErrText;
                DDSystem country = new DDSystem();
                if (country.InsertCountry(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return(Json(string.Empty));
                }
                else
                {
                    return(Json(strErrText));
                }
            }
            return(View(model));
        }
Пример #28
0
        public JsonResult LoadCarrierByCarNo(string strCarNo)
        {
            string   strErrText;
            DDSystem dd   = new DDSystem();
            Carrier  data = dd.LoadCarrierByCarNo(strCarNo, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    Id           = data.Id,
                    Name         = data.Name,
                    BusinessType = data.BusinessType,
                    PaymentType  = data.PaymentType
                };

                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
Пример #29
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));
        }
Пример #30
0
        public JsonResult LoadCitysGrid(string country, string province, string sidx, string sord, int page, int rows)
        {
            //读取全部数据
            string      strErrText;
            DDSystem    city     = new DDSystem();
            List <City> listCity = null;

            if (country == null || country == InnoSoft.LS.Resources.Options.SelectCountry)
            {
                listCity = city.LoadCitys(LoginAccountId, LoginStaffName, out strErrText);
            }
            else
            {
                if (province == null || province == InnoSoft.LS.Resources.Options.SelectProvince)
                {
                    listCity = city.LoadCitysByCountry(country, LoginAccountId, LoginStaffName, out strErrText);
                }
                else
                {
                    listCity = city.LoadCitysByProvince(country, province, LoginAccountId, LoginStaffName, out strErrText);
                }
            }
            if (listCity == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows  = listCity.Count;
            int nPageIndex  = page;
            int nPageSize   = rows;
            int nTotalPages = nTotalRows / nPageSize;

            if (nTotalRows % nPageSize > 0)
            {
                nTotalPages++;
            }

            var data = listCity.OrderBy(c => c.ProvinceName).ThenBy(c => c.Name).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total   = nTotalPages,
                page    = nPageIndex,
                records = nTotalRows,
                rows    = (
                    from c in data
                    select new
                {
                    id = c.Id,
                    cell = new string[]
                    {
                        c.Id.ToString(),
                        c.Name,
                        c.CountryName,
                        c.ProvinceName,
                        c.Remark,
                    }
                }).ToArray()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }