/// <summary> /// 生成流水信息,并更新付款单的最新流水信息号 /// </summary> public void GenerateFlowOrders() { try { #region 生成流水信息 T_Pay_Info_DetailsEntity payDetailsEntity = new T_Pay_Info_DetailsEntity() { Amount = this.operationAmount, Createtime = DateTime.Now, PayInfoDetailsCode = CodeNumber, Details_Name = EnumHelper.ToDescription(PayDetailsTypeEnum.Consumption), Details_Type = (int)PayDetailsTypeEnum.Consumption, EcommerceGroupID = inputPayEntity.EcommerceGroupID, EcommerceGroupName = this.EcommerceProjectMoneyCapacity.EcommerceGroupName, Electricity_Supplier_Code = inputPayEntity.Electricity_Supplier_Code, Electricity_Supplier_Id = inputPayEntity.EcommerceID, Electricity_Supplier_Name = inputPayEntity.Electricity_Supplier_Name, Pay_Info_Code = inputPayEntity.Pay_Info_Code, Pay_Info_Details_ID = Guid.NewGuid().ToString(), Pay_Info_ID = inputPayEntity.Pay_Info_Id, Project_Code = inputPayEntity.Project_Code, Project_ID = inputPayEntity.Project_Id, Project_Name = inputPayEntity.Project_Name, }; Transdb.Insert(payDetailsEntity); inputPayEntity.LastPayInfoDetailsCode = CodeNumber; Transdb.Update(inputPayEntity); #endregion } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="inputPayEntity"></param> /// <param name="existingPayEntity"></param> /// <param name="lastPayInfoDetailsEntity"></param> /// <param name="db"></param> public PayToolsBase(Pay_InfoEntity entity) { this._inputPayEntity = entity; #region 为了保证下面的数据都是一致的所以这里把该查的数据都一起查出来 //项目信息 var projectInfo = new Base_ProjectInfoEntity(); if (entity.Project_Id != null) { _projectInfoEntity = projectService.GetEntityBase(entity.Project_Id); } if (_projectInfoEntity == null) { throw new Exception("项目信息不正确!"); } //数据库存储的付款单 this._existingPayEntity = payInfoService.GetEntity(entity.Pay_Info_Id); if (existingPayEntity != null) { this._lastPayInfoDetailsEntity = payDeailsService.GetEntityByCode(existingPayEntity.LastPayInfoDetailsCode); } this._ecommerceProjectMoneyCapacity = eprService.GetTrunkEntity(entity.Project_Id, entity.EcommerceID); if (_ecommerceProjectMoneyCapacity == null) { throw new Exception("未找到对应的电商合同!"); } _codeNumber = coderuleService.SetBillCodeByCode("System", "100"); #endregion try { string errMsg = string.Empty; if (existingPayEntity != null) { inputPayEntity.Modify(inputPayEntity.Pay_Info_Id); new RepositoryFactory().BaseRepository().Update(inputPayEntity); } else { inputPayEntity.CompanyID = projectInfoEntity.CompanyCode; inputPayEntity.CompanyName = projectInfoEntity.CompanyName; inputPayEntity.Create(); new RepositoryFactory().BaseRepository().Insert(inputPayEntity); } Transdb = new RepositoryFactory().BaseRepository().BeginTrans(); } catch (Exception ex) { Transdb.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, T_Pay_Info_DetailsEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, T_Pay_Info_DetailsEntity entity) { try { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); this.BaseRepository().Update(entity); } else { entity.Create(); this.BaseRepository().Insert(entity); } } catch (Exception ex) { throw new Exception(ex.Message); } }