public ActionResult Create(ContractComposite contractComposite) { var contract = contractComposite.ContractDTO; var accountDTO = this._IAccountService.GetByDepartmentId(this.User.BranchId); if (ModelState.IsValid) { if (accountDTO.Balance < contract.TotalAmount) { ModelState.AddModelError("overbalance", "余额不足,请充值!"); return(View(contractComposite)); } contract.ModifiedBy = contract.CreatedBy = this.User.Id; contract.CreatedDate = contract.ModifiedDate = DateTime.Now; contract.OwnerId = this.User.Id; contract.IsActive = true; contract.Version = 1; contract = this._IContractService.Create(contract); return(RedirectToAction("Index")); } contractComposite.AccountDTO = accountDTO; contractComposite.ClientDTOList = this._IClientService.GetAll(); contractComposite.ProductDTOList = this._IProductService.GetAll(); contractComposite.UserDTOList = this._IUserService.GetUsers(null, Ingenious.Infrastructure.Enum.UserStatusEnum.Available); contractComposite.PriceStrategyDTOList = this._IPriceStrategyService.GetAll(); contractComposite.DepartmentDTOList = this._IDepartmentService.GetAll(true); this.DataBind(); return(View(contractComposite)); }
public ActionResult Edit(Guid id) { var model = new ContractComposite(); model.ClientDTOList = this._IClientService.GetAll(); model.ProductDTOList = this._IProductService.GetAll(); model.UserDTOList = this._IUserService.GetUsers(null, Ingenious.Infrastructure.Enum.UserStatusEnum.Available); model.ContractDTO = this._IContractService.GetByKey(id); this.DataBind(); return(View(model)); }
public ActionResult Create() { var model = new ContractComposite(); model.AccountDTO = this._IAccountService.GetByDepartmentId(this.User.BranchId); model.ClientDTOList = this._IClientService.GetAll(string.Empty, this.User.IsSupper ? null : new Nullable <Guid>(this.User.BranchId)); model.ProductDTOList = this._IProductService.GetAll(); model.UserDTOList = this._IUserService.GetUsers(this.User.IsSupper ? null : new Nullable <Guid>(this.User.BranchId), Ingenious.Infrastructure.Enum.UserStatusEnum.Available); model.PriceStrategyDTOList = this._IPriceStrategyService.GetAll(); model.DepartmentDTOList = this._IDepartmentService.GetAll(true); model.User = this.User; this.DataBind(); return(View(model)); }
public ActionResult Edit(ContractComposite contractComposite) { var contract = contractComposite.ContractDTO; if (ModelState.IsValid) { contract.ModifiedBy = this.User.Id; this._IContractService.Update(new ContractDTOList { contract }); return(RedirectToAction("Index")); } contractComposite.ClientDTOList = this._IClientService.GetAll(); contractComposite.ProductDTOList = this._IProductService.GetAll(); contractComposite.UserDTOList = this._IUserService.GetUsers(null, Ingenious.Infrastructure.Enum.UserStatusEnum.Available); this.DataBind(); return(View(contractComposite)); }