//[RestAuthenticationAttribute] public IEnumerable <RefuelSearchDataObjectResponseRequest> searchRefuels([FromBody] RefuelSearchDataObjectRequest request) { BLRefuel refuelObject = new BLRefuel() { CompanyID = 5, PumpID = request.pumpID, FuelingMethod = request.fuelingMethod, RefuelStartDate = request.startDate.convertDate().Value, RefuelStartTime = request.startTime.convertTime().Value, RefuelEndDate = request.endDate.convertDate().Value, RefuelEndTime = request.endTime.convertTime().Value, TagID = request.tagID, DriverID = request.driverID }; BLRefuels refuelsObject = new BLRefuels(5, refuelObject, 1); GlobalData.InsertSessionProperty(HttpContext.Current.Session.SessionID, typeof(BLRefuels), refuelsObject); return(refuelsObject.DataTable.DataTableToList <RefuelSearchDataObjectResponseRequest>()); }
//[RestAuthenticationAttribute] public void updateRefuelRow([FromBody] RefuelSearchDataObjectResponseRequest request) { BLRefuels refuelsObject = GlobalData.GetSessionProperty(HttpContext.Current.Session.SessionID, typeof(BLRefuels)); BLRefuel bl = refuelsObject.RefuelByIndex(request.Sequence); bl.ActualPayment = bl.ActualPayment == 0 ? -1 : bl.ActualPayment; bl.ChangeTime = DateTime.Now.ToUniversalTime(); if (request.R_FUELING_METHOD == 2) { bl.DriverID = bl.TagID = "0000000000"; } else { bl.DriverID = request.R_BB_DRIVER_ID; bl.TagID = request.R_TAG_ID; } bl.Odometer = request.R_VEHICLE_ODOMETER == 0 ? -1 : request.R_VEHICLE_ODOMETER; bl.EngineHours = request.R_ENGINE_HOURS; bl.Project = request.R_PROJECT; bl.RefuelStartDate_NEW = request.R_DATE.convertDate().Value; bl.RefuelStartTime_NEW = request.R_TIME.convertTime().Value; bl.StartCounter = request.R_START_COUNTER == 0 ? -1 : request.R_START_COUNTER; bl.EndCounter = request.R_END_COUNTER == 0 ? -1 : request.R_END_COUNTER; //bl.User=USERNAME bl.FuelingMethod = request.R_FUELING_METHOD; bl.PumpIDNew = request.R_BB_PUMP_ID; bl.FuelSupplierID = request.R_FUEL_SUPPLIER_ID; bl.SupplierInvoiceNumber = request.R_SUPPLIER_INVOICE_NUMBER == "" ? -1 : int.Parse(request.R_SUPPLIER_INVOICE_NUMBER); bl.ActualPayment = request.R_ACTUAL_PAYMENT == 0 ? -1 : request.R_ACTUAL_PAYMENT; bl.NewTotalCounter = request.R_TOTAL_COUNTER == 0 ? -1 : request.R_TOTAL_COUNTER;/*old logic to do*/ try { refuelsObject.Save(); } catch (Exception e) { } }