public async Task <IActionResult> Edit(int id, [Bind("Id,TripName,DriveDate,TripStart,TripEnd")] FuelData fuelData) { if (id != fuelData.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fuelData); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FuelDataExists(fuelData.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(fuelData)); }
public string SubmitCreateFuelData(FuelData FuelData) { var User = System.Web.HttpContext.Current.User.Identity.Name; FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; string userData = ticket.UserData; string[] roles = userData.Split(','); string userRole = roles[0]; UserOpMap userOpMap = new UserOpMap(); BAL.BAL_Common bAL_Common = new BAL.BAL_Common(); userOpMap = bAL_Common.GetUserOperationMapping(HttpContext.Current.User.Identity.Name, userRole); EntitySubmittedResponse entitySubmittedResponse = new EntitySubmittedResponse(); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); try { BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel(); long fuelID = bAL_Fuel.CreateFuel(FuelData, userOpMap); entitySubmittedResponse.submited = true; entitySubmittedResponse.message = "Fuel submitted!"; return(js.Serialize("Fuel Created")); } catch (Exception ex) { entitySubmittedResponse.submited = false; entitySubmittedResponse.message = string.Format("Error occured while generating Bill with message:{0}", ex.Message); //return js.Serialize(entitySubmittedResponse); return(js.Serialize(string.Format("Error occured while generating Bill with message:{0}", ex.Message))); } }
public List <FuelData> GetFuelData() { List <FuelData> list = new List <FuelData>(); List <Fuel> fuelList = new List <Fuel>(); List <DailyFuelCost> dailyFuelCostList = new List <DailyFuelCost>(); BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel(); fuelList = bAL_Fuel.GetFuelList(); dailyFuelCostList = bAL_Fuel.GetDailyFuelCost(); foreach (Fuel fuel in fuelList) { FuelData fuelData = new FuelData(); fuelData.Id = fuel.Id; fuelData.Name = fuel.Name; fuelData.Type = fuel.Type; fuelData.Description = fuel.Description; foreach (DailyFuelCost dailyFuelCost in dailyFuelCostList) { if (dailyFuelCost.FuelTypeId == fuel.Id) { fuelData.CostPerLiter = dailyFuelCost.CostPerLiter; break; } else { continue; } } list.Add(fuelData); } return(list); }
public async Task <IActionResult> Create([Bind("Id,TripName,DriveDate,TripStart,TripEnd")] FuelData fuelData) { if (ModelState.IsValid) { _context.Add(fuelData); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(fuelData)); }
public long CreateFuel(FuelData fuelData, UserOpMap userOpMap) { DAL_Fuel dAL_Fuel = new DAL_Fuel(); Fuel fuel = new Fuel(); DailyFuelCost dailyFuelCost = new DailyFuelCost(); fuel.Name = fuelData.Name; fuel.Description = fuelData.Description; fuel.Type = fuelData.Type; dailyFuelCost.CostPerLiter = fuelData.CostPerLiter; return(dAL_Fuel.CreateFuel(fuel, dailyFuelCost, userOpMap)); }
void SetFuelIntake() { FuelData gazData = ItemManager.Instance.GetData("Gaz") as FuelData; uint fuelCapacity = Game.Instance.rocket.fuelCapacity; uint gazNeeded = rocket == null ? fuelCapacity : fuelCapacity - rocket.fuelStored; fuelIntake.inventory.maxItemCount = gazNeeded; if (gazNeeded == 0) { fuelIntake.filter.infos.Clear(); fuelIntake.filter.allowedByDefault = false; } }
public List <FuelData> GetFuelList() { List <FuelData> list = new List <FuelData>(); List <Fuel> fuelList = new List <Fuel>(); BAL.BAL_Tanker bAL_Tanker = new BAL.BAL_Tanker(); fuelList = bAL_Tanker.GetFuelList(); foreach (Fuel fuel in fuelList) { FuelData fuelData = new FuelData(); fuelData.Id = fuel.Id; fuelData.Type = fuel.Type; list.Add(fuelData); } return(list); }
public void ValidateFileExistShouldPass() { var manager = new AcConfigManager(); manager.Add(config1); var fuelTable = new FuelData(null, "Boeing 777-300ER", ""); var toFile = new QSP.TOPerfCalculation.Entry("Boeing 777-300ER", ""); var toTable = new TOTable(null, toFile); var ldgFile = new QSP.LandingPerfCalculation.Entry("Boeing 777-300ER", ""); var ldgTable = new LdgTable(null, ldgFile); Assert.IsNull(manager.Validate( new[] { fuelTable }, new[] { toTable }, new[] { ldgTable })); }
/// <summary> /// AssignGasSales will assign 3 seperate fueldata objects. These objects would preferably be declared at the top level of the class. /// </summary> /// <param name="allfuelDataList"></param> private void AssignGasSales(List <FuelData> allfuelDataList) { foreach (FuelData fd in allfuelDataList) { if (fd.FuelTypeCode == 1) { unleadedData = fd; } else if (fd.FuelTypeCode == 3) { plusData = fd; } else if (fd.FuelTypeCode == 2) { premiumData = fd; } } }
void SetFuelBubble() { FuelData gazData = ItemManager.Instance.GetData("Gaz") as FuelData; uint fuelCapacity = Game.Instance.rocket.fuelCapacity; uint gazNeeded = rocket == null ? fuelCapacity : fuelCapacity - rocket.fuelStored; if (gazNeeded > 0) { fuelBubble.SetContent("Fuel Intake", new List <(string, uint, uint?)>() { ("Gaz", gazNeeded, fuelIntake.inventory.Count("Gaz")) }); } else { fuelBubble.SetTitle("Fueled !"); fuelBubble.ClearContent(); } }
void TryConsumeFuel() { if (rocket == null || rocket.Power >= 1f) { return; } if (fuelIntake.inventory.ItemCount == 0) { return; } Dictionary <string, uint> itemsConsumed = new Dictionary <string, uint>(); foreach (var item in fuelIntake.inventory.Items) { ItemData data = ItemManager.Instance.GetData(item.Key); for (int i = 0; i < item.Value; i++) { FuelData fuel = data as FuelData; if (fuel != null) { uint count; itemsConsumed.TryGetValue(item.Key, out count); itemsConsumed[item.Key] = count + 1; if (rocket.AddFuel(1)) { break; } } } } foreach (var item in itemsConsumed) { fuelIntake.inventory.Remove(item.Key, item.Value); } }
public FuelData GetFuelDataByID(string fuelID) { FuelData fuelRetData = new FuelData(); List <Fuel> fuelList = new List <Fuel>(); List <DailyFuelCost> dailyFuelCostList = new List <DailyFuelCost>(); BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel(); fuelList = bAL_Fuel.GetFuelList(); dailyFuelCostList = bAL_Fuel.GetDailyFuelCost(); foreach (Fuel fuel in fuelList) { if (Convert.ToString(fuel.Id) == fuelID) { FuelData fuelData = new FuelData(); fuelData.Id = fuel.Id; fuelData.Name = fuel.Name; fuelData.Type = fuel.Type; fuelData.Description = fuel.Description; foreach (DailyFuelCost dailyFuelCost in dailyFuelCostList) { if (dailyFuelCost.FuelTypeId == fuel.Id) { fuelData.CostPerLiter = dailyFuelCost.CostPerLiter; break; } else { continue; } } fuelRetData = fuelData; break; } else { continue; } } return(fuelRetData); }
public void sendReports() { ReportServiceClient rclient = new ReportServiceClient(); DailyReport dr = new DailyReport(); dr.Date = DateTime.Now.Date; FuelItem[] prchs=getFuelOrders(); FuelData[] purchase = new FuelData[2]; purchase[0] = new FuelData(); purchase[1] = new FuelData(); for (int i = 0; i < prchs.Length; i++) { if(prchs[i]!=null && prchs[i].Date==dr.Date) { int ind = 1; if (prchs[i].Type == "unleaded") ind = 0; purchase[ind].FuelType = prchs[i].Type; purchase[ind].Quantity += prchs[i].Amount; purchase[ind].Value += prchs[i].Value; } } dr.Purchases = purchase; FuelItem[] sl = getSaleData(); FuelData[] sales=new FuelData[2]; sales[0] = new FuelData(); sales[1] = new FuelData(); for (int i = 0; i < sl.Length; i++) { if (sl[i] != null && sl[i].Date == dr.Date) { int ind = 1; if (sl[i].Type == "unleaded") ind = 0; sales[ind].FuelType = sl[i].Type; sales[ind].Quantity = sl[i].Amount; sales[ind].Value = sl[i].Value; } } dr.Sales = sales; rclient.SendDailyReport(dr); }