Exemplo n.º 1
0
        public ActionResult Save(string id)
        {
            ViewBag.types = ListToSelect(SysDataDictService.GetReceiptsCategories().Select(o => new SelectListItem()
            {
                Value = o.DicSN.ToString(), Text = o.Title
            }), emptyTitle: "请选择");
            var obj = new Receipts()
            {
                CreateTitle = Sys.CurrentUser.FullName, CreateDT = DateTime.Now
            };

            if (!id.IsNullOrEmpty())
            {
                obj = ReceiptsBLL.FindById(id);
                obj.IsNullThrow();
                if (obj.Source == 1)
                {
                    var user = UserInfoService.Find(o => o.UID == obj.CreateUID);
                    if (user != null)
                    {
                        obj.CreateTitle = user.FullName;
                    }
                }
                else
                {
                    var supplier = SupplierService.Find(o => o.Id == obj.CreateUID);
                    if (supplier != null)
                    {
                        obj.CreateTitle = supplier.Title;
                    }
                }
            }
            return(View(obj));
        }
Exemplo n.º 2
0
        public ActionResult Detail(string id)
        {
            ViewBag.types = ListToSelect(SysDataDictService.GetReceiptsCategories().Select(o => new SelectListItem()
            {
                Value = o.DicSN.ToString(), Text = o.Title
            }), emptyTitle: "请选择");
            var obj = ReceiptsBLL.FindById(id);

            obj.IsNullThrow();
            var user = UserInfoService.Find(o => o.UID == obj.CreateUID);

            if (user != null)
            {
                obj.CreateTitle = user.FullName;
            }
            var type = SysDataDictService.Find(o => o.DicSN == obj.CategoryId);

            if (type != null)
            {
                ViewData["Category"] = type.Title;
            }
            return(View(obj));
        }