public static bool LoadFromReader_Ext(this IInvPrice invPrice, OdbcDataReader reader) { invPrice = invPrice ?? new InvPrice(); bool loadSucceeded = true; try { //invPrice.Department = (Int16)reader["Department"]; invPrice.Department = (Int16)TryAssign("Department", reader, 0, loadSucceeded, out loadSucceeded); invPrice.EndDate = (DateTime)(reader["EndDate"]).CDbNull(new DateTime(1000, 1, 1)); //invPrice.EndDate = (DateTime)TryAssign("EndDate", reader, new DateTime(1000, 1, 1), loadSucceeded, out loadSucceeded); invPrice.InvUnique = (int)TryAssign("InvUnique", reader, 0, loadSucceeded, out loadSucceeded); invPrice.PartUnique = (int)TryAssign("PartUnique", reader, 0, loadSucceeded, out loadSucceeded); invPrice.QuanDisc = (Single)TryAssign("QuanDisc", reader, 0, loadSucceeded, out loadSucceeded); invPrice.RegularPrice = (double)TryAssign("RegularPrice", reader, 0, loadSucceeded, out loadSucceeded); invPrice.RScheduleType = (string)TryAssign("RScheduleType", reader, "", loadSucceeded, out loadSucceeded); invPrice.SalePrice = (double)TryAssign("SalePrice", reader, 0, loadSucceeded, out loadSucceeded); invPrice.ScheduleLevel = (Int16)TryAssign("ScheduleLevel", reader, 0, loadSucceeded, out loadSucceeded); invPrice.SScheduleType = (string)TryAssign("SScheduleType", reader, "", loadSucceeded, out loadSucceeded); invPrice.StartDate = (DateTime)(reader["StartDate"]).CDbNull(new DateTime(1000, 1, 1)); loadSucceeded = true; } catch (Exception e) { loadSucceeded = false; string str = GetReaderInfo(reader); Console.WriteLine(str); } return(loadSucceeded); }
public InvPrice_Clean(IInvPrice component) { _InvPrice = component ?? new InvPrice(); _InvPrice.RScheduleType = _InvPrice.RScheduleType ?? string.Empty; _InvPrice.SScheduleType = _InvPrice.SScheduleType ?? string.Empty; ((IInvPrice)this).CopyFrom(component); }
public static PriceScheduleView GetView_RegularPrice ( this IInvPrice TodaysInvPriceRecord , short PriceScheduleToUse , IInventoryBasePriceInfo BasePriceInfo ) { PriceScheduleView view; view = BasePriceInfo.CalculatePrice(TodaysInvPriceRecord); return(view); }
public static void CopyFrom(this IInvPrice to, IInvPrice from) { to.Department = from.Department; to.EndDate = from.EndDate; to.InvUnique = from.InvUnique; to.PartUnique = from.PartUnique; to.QuanDisc = from.QuanDisc; to.RegularPrice = from.RegularPrice; to.RScheduleType = from.RScheduleType; to.SalePrice = from.SalePrice; to.ScheduleLevel = from.ScheduleLevel; to.SScheduleType = from.SScheduleType; to.StartDate = from.StartDate; }
public static bool LoadFromReader(IInvPrice invPrice, OdbcDataReader reader) { return(invPrice.LoadFromReader_Ext(reader)); }
public static int InventoryUnique(IInvPrice record) { return(record.PartUnique); }
public static PriceScheduleView CalculatePrice(this IInventoryBasePriceInfo info, IInvPrice price) { double WholesaleCost = info.WholesaleCost; double LandedCost = info.LandedCost(); double?Price0 = null; double?ListPrice = null; double?CashPrice = null; double?SalePrice = null; double?PriceToCalculate = null; Price0 = info.RegularPrice_0_Calculated; ListPrice = info.RegularPrice_List_Calculated; CashPrice = info.RegularPrice_Cash_Calculated; SalePrice = info.SalePrice_0_Calculated; string info_json = string.Empty; string nl = Environment.NewLine; try { PriceToCalculate = CalcPrice ( price.RScheduleType , price.RegularPrice , WholesaleCost , LandedCost , CashPrice , SalePrice , ListPrice ); } catch (ArgumentNullException e) { info_json = GetContents(info); Console.WriteLine($"Error: failed to calculate Web Price" + $"({info.ScheduleLevel_List}). " + "Details: " + e.Message + nl + info_json); } PriceScheduleView view = new PriceScheduleView(); view.Level = price.ScheduleLevel; view.Percentage = price.RegularPrice; view.Price = (decimal)PriceToCalculate; view.Code = price.RScheduleType; return(view); }