コード例 #1
0
ファイル: CommonController.cs プロジェクト: zjchenxk/SYLS
        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);
        }
コード例 #2
0
ファイル: SystemController.cs プロジェクト: zjchenxk/SYLS
        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);
        }
コード例 #3
0
ファイル: SystemController.cs プロジェクト: zjchenxk/SYLS
        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);
        }
コード例 #4
0
ファイル: SystemController.cs プロジェクト: zjchenxk/SYLS
        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);
        }
コード例 #5
0
ファイル: SystemController.cs プロジェクト: zjchenxk/SYLS
        public ActionResult ModifyGoods(string id)
        {
            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 = string.Empty });
            selectListGoodsType.AddRange(from t in listGoodsType
                                         orderby t.FullName
                                         select new SelectListItem
                                         {
                                             Text = t.FullName,
                                             Value = t.Id.ToString()
                                         });
            ViewData["GoodsTypes"] = new SelectList(selectListGoodsType, "Value", "Text");

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

            GoodsViewModel model = new GoodsViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.TypeId = data.TypeId;
            model.GoodsNo = data.GoodsNo;
            model.SpecModel = data.SpecModel;
            model.GWeight = data.GWeight;
            model.Grade = data.Grade;
            model.Brand = data.Brand;
            model.PieceWeight = data.PieceWeight;
            model.Packing = data.Packing;
            model.Remark = data.Remark;

            return View(model);
        }