private void FilterChargeConfigurations(SqlPagedQuery query, ChargeLevel chargeType, ChargeConfigurationHeader header) { StringBuilder whereClause = new StringBuilder("("); whereClause.Append("(MODULECATEGORY = @ChargeType)"); if (header.AccountType != ChargeAccountType.None) { whereClause.Append(" AND (ACCOUNTCODE = @AccountType AND ACCOUNTRELATION = @AccountRelation) "); } if (header.ItemType != ChargeItemType.None) { whereClause.Append(" AND (ITEMCODE = @ItemType AND ITEMRELATION = @ItemRelation AND MODULETYPE = 1) "); } if (header.DeliveryType != ChargeDeliveryType.None) { whereClause.Append(" AND (DLVMODECODE = @DeliveryType AND DLVMODERELATION = @DeliveryRelation AND MODULETYPE = 3) "); } whereClause.Append(")"); query.Where = whereClause.ToString(); query.Parameters["@ChargeType"] = chargeType; query.Parameters["@AccountType"] = header.AccountType; query.Parameters["@AccountRelation"] = header.AccountRelation; query.Parameters["@ItemType"] = header.ItemType; query.Parameters["@ItemRelation"] = header.ItemRelation; query.Parameters["@DeliveryType"] = header.DeliveryType; query.Parameters["@DeliveryRelation"] = header.DeliveryRelation; }
public override void Load() { mod = this; if (!Main.dedServ) { chargeResources = new UserInterface(); chargeLevel = new ChargeLevel(); ChargeLevel.visible = true; chargeResources.SetState(chargeLevel); } }
public void CreateInDatabase(ChargeLevel chargeLevel) { if (chargeLevel == null) { throw new ArgumentNullException(nameof(chargeLevel)); } using (var ipPhoneEntities = new IPPhoneEntities()) { ipPhoneEntities.ChargeLevels.Add(chargeLevel); ipPhoneEntities.SaveChanges(); } }
public void UpdateInDatabase(int level, ChargeLevel chargeLevel) { if (chargeLevel == null) { throw new ArgumentNullException(nameof(chargeLevel)); } using (var ipPhoneEntities = new IPPhoneEntities()) { var focusChargeLevel = ipPhoneEntities.ChargeLevels.FirstOrDefault(c => c.Level == chargeLevel.Level); if (focusChargeLevel != null) { focusChargeLevel.Level = chargeLevel.Level; focusChargeLevel.Charge = chargeLevel.Charge; } ipPhoneEntities.SaveChanges(); } }
public bool InsertOrUpdate(ChargeLevel ChargeLevel) { return(_epr.InsertOrUpdate(ChargeLevel)); }
public override string ToString() => $"{nameof(ChargeLevel)}: {ChargeLevel.ToString()}, " + $"{nameof(State)}: {State}, " + $"{nameof(PowerSource)}: {PowerSource}";
public bool Save(ChargeLevel ChargeLevel) { _ChargeLevelApp.InsertOrUpdate(ChargeLevel); return(_connection.Save()); }
public ClaimDetail() { ChargeLevelDetail = new ChargeLevel(); }
public IHttpActionResult Put([FromUri] int level, [FromBody] ChargeLevel chargeLevel) { updateService.UpdateInDatabase(level, chargeLevel); return(Ok()); }
public IHttpActionResult Post([FromBody] ChargeLevel chargeLevel) { createService.CreateInDatabase(chargeLevel); return(Ok()); }