Beispiel #1
0
        public ActionResult Edit(int id, string boxName = "", string message = "")
        {
            var model = _missionService.GetById(id);

            if (model == null)
            {
                throw new Exception("未知任务。");
            }
            ViewBag.BoxName       = boxName;
            ViewBag.Message       = message;
            ViewBag.UserGroup     = (CommonEnum.GroupOfCustomer)_customerService.GetEntityById(UserContext.Current.Id).GroupId;
            ViewBag.TypeOfPayment = _missionService.GetPaymentTypeList();
            if (model.Status >= (int)CommonEnum.StatusOfMission.Contract)
            {
                M_Contract c = _missionService.GetContractByMission(model.Id);
                if (c != null)
                {
                    C_File f = _fileService.GetById(c.FileId);
                    if (f != null)
                    {
                        ViewBag.ContractUrl = CommonContorllers.FILE_UPLOAD_MISSION_CONTRACT_PATH + f.FileName;
                    }
                }
            }
            if (model.Publisher != UserContext.Current.Id && model.Receiver != UserContext.Current.Id)
            {
                throw new Exception("未知的任务。");
            }
            return(View(model));
        }
Beispiel #2
0
        public ActionResult AddPost(ProductViewModel model)
        {
            C_Object Cmodel = new C_Object();

            Cmodel.Name           = model.Name;
            Cmodel.ParentId       = model.ParentId;
            Cmodel.Sort           = model.Sort;
            Cmodel.Creater        = UserId;
            Cmodel.CreateTime     = DateTime.Now;
            Cmodel.LastModifyTime = DateTime.Now;
            Cmodel.LastModifyUser = UserId;
            Cmodel.Status         = 0;
            Cmodel.Type           = (int)CommonEnum.TypeOfDbObject.Product;
            Cmodel.IsDelete       = false;
            this._ObjectService.Insert(Cmodel);

            C_File imgmodel = new C_File();

            imgmodel.FileName = model.Image;
            this._ObjectService.InsertImage(imgmodel);

            G_Name Gmodel = new G_Name();

            Gmodel.Id    = Cmodel.Id;
            Gmodel.Unit  = model.Unit;
            Gmodel.Image = imgmodel.Id;
            this._GoodsService.InsertUnit(Gmodel);

            CategorySearchCriteria SearchCriteria = new CategorySearchCriteria();

            SearchCriteria.ParentId = -1;
            SearchCriteria.Type     = (int)CommonEnum.TypeOfDbObject.Classification;
            var attrsTypes = this._ObjectService.SearchCategory(SearchCriteria).Item1;
            var typelist   = (from m in attrsTypes
                              select new SelectListItem
            {
                Text = m.Name,
                Value = m.Id.ToString()
            }).ToList();

            ViewBag.shopType = typelist;
            ViewBag.msg      = "添加成功";
            return(View(model));
        }
Beispiel #3
0
        public ActionResult EditPost(ProductViewModel model)
        {
            var Cmodel = this._ObjectService.GetById(model.Id);

            Cmodel.Name           = model.Name;
            Cmodel.ParentId       = model.ParentId;
            Cmodel.Sort           = model.Sort;
            Cmodel.LastModifyTime = DateTime.Now;
            Cmodel.LastModifyUser = UserId;
            this._ObjectService.Update(Cmodel);

            C_File imgmodel = this._ObjectService.GetImageById(Cmodel.G_Name.Image);

            imgmodel.FileName = model.Image;
            imgmodel.Id       = Cmodel.G_Name.Image;
            this._ObjectService.UpdateImage(imgmodel);

            G_Name Gmodel = this._GoodsService.GetById(Cmodel.Id);

            Gmodel.Unit  = model.Unit;
            Gmodel.Image = imgmodel.Id;
            this._GoodsService.UpdateUnit(Gmodel);

            CategorySearchCriteria SearchCriteria = new CategorySearchCriteria();

            SearchCriteria.ParentId = -1;
            SearchCriteria.Type     = (int)CommonEnum.TypeOfDbObject.Classification;
            var attrsTypes = this._ObjectService.SearchCategory(SearchCriteria).Item1;
            var typelist   = (from m in attrsTypes
                              select new SelectListItem
            {
                Text = m.Name,
                Value = m.Id.ToString()
            }).ToList();

            ViewBag.shopType = typelist;
            this._ObjectService.Update(Cmodel);
            ViewBag.msg = "修改成功";
            return(View(model));
        }