/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirm_Click(object sender, EventArgs e) { var input = CheckInput(); if (!input.Item1) { MessageUtil.ShowError(input.Item2); return; } SettlementRecord entity = new SettlementRecord(); SetEntity(entity); try { BusinessFactory <SettlementRecordBusiness> .Instance.Create(entity, this.currentUser); MessageUtil.ShowInfo("保存成功"); this.Close(); } catch (PoseidonException pe) { MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message)); } }
public void Update(SettlementRecord settlement) { // referential integrity: //GetFactionById(settlement.FactionId.Value); _gameConfigCache.GetRaceConfigById(settlement.RaceTypeId.Value); Settlements.Update(settlement); }
private Guid GenerateSettlementRecord(Operator currentOperator, DateTime settleTime, List <BillingRecord> matchedBills) { var newSettlementRecord = new SettlementRecord(currentOperator, settleTime); var settlementItems = GetSettlementItems(matchedBills); newSettlementRecord.AmountContent = settlementItems.ToJsonString(); return(_settlementRecordRepo.InsertAndGetId(newSettlementRecord)); }
/// <summary> /// 设置实体 /// </summary> /// <param name="entity"></param> private void SetEntity(SettlementRecord entity) { entity.SettlementId = this.settlementId; entity.DepartmentId = this.luDepartment.EditValue.ToString(); entity.EnergyType = Convert.ToInt32(this.cmbEnergyType.EditValue); entity.UnitPrice = this.spUnitPrice.Value; entity.Remark = this.txtRemark.Text; }
public void Settlement_tests() { var settlementRecord = new SettlementRecord(0, 1, new PointI(12, 9), "Gregville"); _repo.Add(settlementRecord); var id = settlementRecord.Id; settlementRecord = _repo.GetSettlementById(id); var settlements = _repo.GetSettlementsByFactionId(1); Assert.AreEqual(id, settlementRecord.Id); Assert.AreEqual(1, settlementRecord.FactionId.Value); Assert.AreEqual(0, settlementRecord.RaceTypeId.Value); Assert.AreEqual(new PointI(12, 9), settlementRecord.LocationHex.Value); Assert.AreEqual("Gregville", settlementRecord.Name.Value); Assert.AreEqual(1, settlements.Count); Assert.AreEqual(1, settlements[0].Id); }
/// <summary> /// 能源结算记录转报表模型 /// </summary> /// <param name="departmentName">部门名称</param> /// <param name="settlement">能源结算</param> /// <param name="entity">能源结算记录</param> /// <param name="targetRecord">指标记录</param> /// <returns></returns> public static SettlementReportModel SettlementReportTranslate(string departmentName, Settlement settlement, SettlementRecord entity, TargetRecord targetRecord) { SettlementReportModel model = new SettlementReportModel(); model.DepartmentName = departmentName; model.Term = settlement.BelongTime; if (entity.EnergyType == (int)EnergyType.Electric) { model.EnergyType = "电"; model.Unit = "度"; model.UnitPrice = string.Format("{0} 元/度", entity.UnitPrice); } else if (entity.EnergyType == (int)EnergyType.Water) { model.EnergyType = "水"; model.Unit = "吨"; model.UnitPrice = string.Format("{0} 元/吨", entity.UnitPrice); } if (targetRecord == null) { model.PlanQuantum = 0; model.PlanAmount = 0; } else { model.PlanQuantum = targetRecord.PlanQuantum; model.PlanAmount = targetRecord.PlanAmount; } model.LastQuantum = model.PlanQuantum - entity.BeginQuantum; model.LastAmount = model.PlanAmount - entity.BeginAmount; model.Quantum = entity.Quantum; model.Amount = entity.Amount; model.EndQuantum = entity.BeginQuantum - entity.Quantum; model.EndAmount = entity.BeginAmount - entity.Amount; return(model); }