public void LoadData(object sender, DoWorkEventArgs e) { var query = SQLServer.MSSelectDataDictionary("SELECT * from whldata.reorder_orderitems WHERE SKU like'" + CurrentSku.ShortSku + "%';"); foreach (Dictionary <string, object> result in query) { var OrderHistory = SkuOrderHistoryClass.MakeNewClass(result); CurrentOrderHistory.Add(OrderHistory); } }
public static SkuOrderHistoryClass MakeNewClass(Dictionary <string, object> result) { var leadDaysCalc = (DateTime.Parse(result["RecievedDate"].ToString()) - DateTime.Parse(result["OrderDate"].ToString())).TotalDays; var returnable = new SkuOrderHistoryClass { ShortSku = result["ShortSku"].ToString(), OrderDate = DateTime.Parse(result["OrderDate"].ToString()), Supplier = result["Supplier"].ToString(), AmountOrder = int.Parse(result["AmountOrdered"].ToString()), AmountRecieved = int.Parse(result["AmountRecieved"].ToString()), RecievedDate = DateTime.Parse(result["RecievedDate"].ToString()), LeadDays = leadDaysCalc }; return(returnable); }