} //insertOrder() /// <summary> /// DatarowToclsOrder(): Transforms a DataRow into a OrderExtended Object /// </summary> /// <param name="_dr">DataRow</param> /// <returns>OrderExtended-Objekt</returns> private clsOrderExtended DatarowToclsOrderExtended(DataRow _dr) { clsOrderExtended _myOrder = new clsOrderExtended(); //und hier die Daten nach Index _myOrder.ID = (int)_dr["OID"]; _myOrder.ProductId = AddIntFieldValue(_dr, "OFKProduktId"); _myOrder.ProductName = AddStringFieldValue(_dr, "PName"); _myOrder.UserId = AddIntFieldValue(_dr, "OFKUserId"); _myOrder.UserName = AddStringFieldValue(_dr, "UName"); _myOrder.OrderDate = AddDateTimeFieldValue(_dr, "ODate"); _myOrder.OrderExtras = AddIntFieldValue(_dr, "OExtras"); _myOrder.OrderSize = AddIntFieldValue(_dr, "OSize"); _myOrder.OrderCount = AddIntFieldValue(_dr, "OCount"); _myOrder.OrderSum = AddDoubleFieldValue(_dr, "OSum"); _myOrder.OrderDelivery = AddBoolFieldValue(_dr, "ODelivery"); _myOrder.OrderStatus = AddIntFieldValue(_dr, "OStatus"); return(_myOrder); } //DatarowToclsOrder()
/// <summary> /// Liest alle OrderExtended aus der DB und gibt sie als Liste zurück /// </summary> /// <returns></returns> public List<clsOrderExtended> getAllOrdersExtended() { //Hier wird ein DB-Provider instanziiert und eine Verbindung zur Access-Datenbank aufgebaut DAL.DALObjects.dDataProvider _myProvider = DAL.DataFactory.GetAccessDBProvider(_databaseFile); //Hier wird unser Dataset aus der DB befüllt DataSet _myDataSet = _myProvider.GetStoredProcedureDSResult("QOGetAllOrders"); //das DataSet enthält nur eine DataTable DataTable _myDataTable = _myDataSet.Tables[0]; //Instantiieren eine Liste von Order-Objekten List<clsOrderExtended> _myOrderList = new List<clsOrderExtended>(); //Lesen wir jetzt Zeile (DataRow) für Zeile foreach (DataRow _dr in _myDataTable.Rows) { //Wir füllen unsere Liste nach und nach mit neuen Ordern clsOrderExtended _myOrder = new clsOrderExtended(); _myOrder = DatarowToclsOrder(_dr); _myOrderList.Add(DatarowToclsOrder(_dr)); } return _myOrderList; }
/// <summary> /// DatarowToclsOrder(): Transforms a DataRow into a OrderExtended Object /// </summary> /// <param name="_dr">DataRow</param> /// <returns>OrderExtended-Objekt</returns> private clsOrderExtended DatarowToclsOrderExtended(DataRow _dr) { clsOrderExtended _myOrder = new clsOrderExtended(); //und hier die Daten nach Index _myOrder.ID = (int)_dr["OID"]; _myOrder.ProductId = AddIntFieldValue(_dr, "OFKProduktId"); _myOrder.ProductName = AddStringFieldValue(_dr, "PName"); _myOrder.UserId = AddIntFieldValue(_dr, "OFKUserId"); _myOrder.UserName = AddStringFieldValue(_dr, "UName"); _myOrder.OrderDate = AddDateTimeFieldValue(_dr, "ODate"); _myOrder.OrderExtras = AddIntFieldValue(_dr, "OExtras"); _myOrder.OrderSize = AddIntFieldValue(_dr, "OSize"); _myOrder.OrderCount = AddIntFieldValue(_dr, "OCount"); _myOrder.OrderSum = AddDoubleFieldValue(_dr, "OSum"); _myOrder.OrderDelivery = AddBoolFieldValue(_dr, "ODelivery"); _myOrder.OrderStatus = AddIntFieldValue(_dr, "OStatus"); return _myOrder; }
/// <summary> /// DatarowToclsOrder(): Transforms a DataRow into a OrderExtended Object /// </summary> /// <param name="fieldName">DataRow</param> /// <returns>OrderExtended-Objekt</returns> private clsOrderExtended DatarowToclsOrder(DataRow _dr) { clsOrderExtended _myOrder = new clsOrderExtended(); clsHelper h = new clsHelper(); //und hier die Daten nach Index _myOrder.ID = (int)_dr["OID"]; _myOrder.ProductId = h.AddIntFieldValue(_dr, "OFKProduktId"); _myOrder.ProductName = h.AddStringFieldValue(_dr, "PName"); _myOrder.UserId = h.AddIntFieldValue(_dr, "OFKUserId"); _myOrder.UserName = h.AddStringFieldValue(_dr, "UName"); _myOrder.OrderDate = Convert.ToDateTime(_dr["ODate"]); _myOrder.OrderExtras = h.AddIntFieldValue(_dr, "OExtras"); _myOrder.OrderSize = h.AddIntFieldValue(_dr, "OSize"); _myOrder.OrderCount = h.AddIntFieldValue(_dr, "OCount"); _myOrder.OrderSum = h.AddIntFieldValue(_dr, "OSum"); _myOrder.OrderDelivery = h.AddBoolFieldValue(_dr, "ODelivery"); _myOrder.OrderStorno = h.AddIntFieldValue(_dr, "OStorno"); return _myOrder; }