/// <summary> /// Method to set tax free fuel price /// </summary> /// <param name="sProductKey">Product key</param> /// <param name="eProductCategory">Product category</param> /// <param name="dNewCashPrice">New cash price</param> /// <param name="dNewCreditPrice">New credit price</param> /// <param name="sEmpId">Emp id</param> /// <returns>True or false</returns> public bool SetTaxFreeFuelPrice(ref string sProductKey, mPrivateGlobals.teProductEnum eProductCategory, double dNewCashPrice, double dNewCreditPrice, string sEmpId) { //Check if a record exists.... //if it does, then update the record //if it does not then insert a new record. short iTier = 0; short iGrade = 0; short iLevel = 0; if (!TeExtractFuelKey(ref sProductKey, ref iGrade, ref iTier, ref iLevel)) { return(false); } var oRecs = _fuelPumpService.GetFuelPrice(iGrade, iTier, iLevel); if (oRecs == null) { //Insert a record into the table for this fuel product. _fuelPumpService.set_FuelPrice(ref Variables.gPumps, (byte)iGrade, (byte)iTier, (byte)iLevel, new CFuelPrice { teCashPrice = CommonUtility.GetFloatValue(dNewCashPrice), teCreditPrice = CommonUtility.GetFloatValue(dNewCreditPrice), EmplID = "\'" + sEmpId + "\'", Date_Time = (int)(CommonUtility.GetDateTimeValue(IsoFormat(DateAndTime.Today, DateAndTime.TimeOfDay)).ToOADate()) }); } else { //Update the existing record with the new price. var sSql = "UPDATE FuelPrice " + "SET TaxFreePrice=" + System.Convert.ToString(dNewCashPrice) + ", TaxFreeCreditPrice=" + System.Convert.ToString(dNewCreditPrice) + ", EmplID=\'" + sEmpId + "\', Date_Time=\'" + IsoFormat(DateAndTime.Today, DateAndTime.TimeOfDay) + "\' WHERE GradeID=" + (iGrade).ToString() + " AND TierID=" + (iTier).ToString() + " AND LevelID=" + (iLevel).ToString(); _fuelPumpService.set_FuelPrice(ref Variables.gPumps, (byte)iGrade, (byte)iTier, (byte)iLevel, new CFuelPrice { teCashPrice = CommonUtility.GetFloatValue(dNewCashPrice), teCreditPrice = CommonUtility.GetFloatValue(dNewCreditPrice), EmplID = "\'" + sEmpId + "\'", Date_Time = (int)(CommonUtility.GetDateTimeValue(IsoFormat(DateAndTime.Today, DateAndTime.TimeOfDay)).ToOADate()), CashPrice = CommonUtility.GetFloatValue(oRecs.CashPrice), CreditPrice = CommonUtility.GetFloatValue(oRecs.CreditPrice) }); } return(true); }
/// <summary> /// Method to set fuel price /// </summary> /// <param name="fuelProperty">Get property</param> /// <param name="gradeId">Grade id</param> /// <param name="tierId">Tier id</param> /// <param name="levelId">Level id</param> /// <param name="value">Fuel price</param> public void set_FuelPrice(ref GetProperty fuelProperty, byte gradeId, byte tierId, byte levelId, CFuelPrice value) { _fuelPumpService.set_FuelPrice(ref fuelProperty, gradeId, tierId, levelId, value); }