public static FuelObject FuelRowToObject(DataRow Fuel) { FuelObject obj = new FuelObject(); try { if (Fuel != null) { if (RowFunctions.GetValueFromRowToGuid(Fuel, FuelObject.FUEL_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.FuelID = RowFunctions.GetValueFromRowToGuid(Fuel, FuelObject.FUEL_ID, true, DataRowVersion.Current); obj.Transi_TNR_reg = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_REG, false, DataRowVersion.Current); obj.Transi_TNR_person = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_PERSON, false, DataRowVersion.Current); obj.Transi_TNR_mat = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_MAT, false, DataRowVersion.Current); obj.Transi_TNR_pump = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_PUMP, false, DataRowVersion.Current); obj.Transi_TNR_tank = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_TANK, false, DataRowVersion.Current); obj.Transi_FuelType = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_FUELTYPE, false, DataRowVersion.Current); obj.Transc_FuelId = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_FUELID, false, DataRowVersion.Current); obj.Transc_NawID = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_NAWID, false, DataRowVersion.Current); //obj.Transc_Date = RowFunctions.GetValueFromRowToInt64(Fuel, FuelObject.TRANSC_DATE, false, DataRowVersion.Current); obj.Transc_PriveBedrijf = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_PRIVEBEDRIJF, false, DataRowVersion.Current); obj.Transc_Product = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.TRANSC_PRODUCT, false, DataRowVersion.Current); obj.Date = RowFunctions.GetValueFromRowToDateTime(Fuel, FuelObject.DATE, false, DataRowVersion.Current); obj.EmployeeName = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.EMPLOYEE_NAME, false, DataRowVersion.Current).Trim(); obj.Employee = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.EMPLOYEE, false, DataRowVersion.Current).Trim(); obj.VehicleLicensePlate = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.VEHICLE_LICENSEPLATE, false, DataRowVersion.Current).Trim(); obj.VehicleKilometreCounter = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.VEHICLE_KILOMETRECOUNTER, false, DataRowVersion.Current); obj.Quantity = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.QUANTITY, false, DataRowVersion.Current); obj.QuantityCorrection = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.QUANTITY_CORRECTION, false, DataRowVersion.Current); obj.FullTank = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.FULLTANK, false, DataRowVersion.Current); obj.UnityPrice = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.UNITYPRICE, false, DataRowVersion.Current); obj.TotalPrice = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.TOTALPRICE, false, DataRowVersion.Current); obj.Unit = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.UNIT, false, DataRowVersion.Current); obj.Supplier = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.SUPPLIER, false, DataRowVersion.Current).Trim(); obj.Location = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.LOCATION, false, DataRowVersion.Current); obj.FuelType = (Framework.Common.Enumeration.Fuel.FuelType)RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.FUELTYPE, false, DataRowVersion.Current); obj.Btw = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.BTW, false, DataRowVersion.Current); obj.PrivateTanking = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.PRIVATE_TANKING, false, DataRowVersion.Current); obj.CompanyTanking = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.COMPANY_TANKING, false, DataRowVersion.Current); obj.InvoiceReceived = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.INVOICE_RECEIVED, false, DataRowVersion.Current); obj.InvoiceOK = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.INVOICE_OK, false, DataRowVersion.Current); obj.DateMailForbiddenFueling = PROF_IT.Common.Convert.DateFunctions.DBDateToDateTime(RowFunctions.GetValueFromRowToString(Fuel, FuelObject.DATEMAIL_FORBIDDENFUELING, false, DataRowVersion.Current), false); } return(obj); } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(obj); }
public int Add(FuelObject value) { try { return(List.Add(value)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void Remove(FuelObject value) { try { List.Remove(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public static FuelObject FuelRowToObject(DataRow Fuel) { FuelObject obj = new FuelObject(); try { if (Fuel != null) { if (RowFunctions.GetValueFromRowToGuid(Fuel, FuelObject.FUEL_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.FuelID = RowFunctions.GetValueFromRowToGuid(Fuel, FuelObject.FUEL_ID, true, DataRowVersion.Current); obj.Transi_TNR_reg = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_REG, false, DataRowVersion.Current); obj.Transi_TNR_person = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_PERSON, false, DataRowVersion.Current); obj.Transi_TNR_mat = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_MAT, false, DataRowVersion.Current); obj.Transi_TNR_pump = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_PUMP, false, DataRowVersion.Current); obj.Transi_TNR_tank = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_TNR_TANK, false, DataRowVersion.Current); obj.Transi_FuelType = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSI_FUELTYPE, false, DataRowVersion.Current); obj.Transc_FuelId = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_FUELID, false, DataRowVersion.Current); obj.Transc_NawID = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_NAWID, false, DataRowVersion.Current); //obj.Transc_Date = RowFunctions.GetValueFromRowToInt64(Fuel, FuelObject.TRANSC_DATE, false, DataRowVersion.Current); obj.Transc_PriveBedrijf = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.TRANSC_PRIVEBEDRIJF, false, DataRowVersion.Current); obj.Transc_Product = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.TRANSC_PRODUCT, false, DataRowVersion.Current); obj.Date = RowFunctions.GetValueFromRowToDateTime(Fuel, FuelObject.DATE, false, DataRowVersion.Current); obj.EmployeeName = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.EMPLOYEE_NAME, false, DataRowVersion.Current).Trim(); obj.Employee = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.EMPLOYEE, false, DataRowVersion.Current).Trim(); obj.VehicleLicensePlate = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.VEHICLE_LICENSEPLATE, false, DataRowVersion.Current).Trim(); obj.VehicleKilometreCounter = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.VEHICLE_KILOMETRECOUNTER, false, DataRowVersion.Current); obj.Quantity = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.QUANTITY, false, DataRowVersion.Current); obj.QuantityCorrection = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.QUANTITY_CORRECTION, false, DataRowVersion.Current); obj.FullTank = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.FULLTANK, false, DataRowVersion.Current); obj.UnityPrice = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.UNITYPRICE, false, DataRowVersion.Current); obj.TotalPrice = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.TOTALPRICE, false, DataRowVersion.Current); obj.Unit = RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.UNIT, false, DataRowVersion.Current); obj.Supplier = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.SUPPLIER, false, DataRowVersion.Current).Trim(); obj.Location = RowFunctions.GetValueFromRowToString(Fuel, FuelObject.LOCATION, false, DataRowVersion.Current); obj.FuelType = (Framework.Common.Enumeration.Fuel.FuelType)RowFunctions.GetValueFromRowToInteger(Fuel, FuelObject.FUELTYPE, false, DataRowVersion.Current); obj.Btw = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelObject.BTW, false, DataRowVersion.Current); obj.PrivateTanking = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.PRIVATE_TANKING, false, DataRowVersion.Current); obj.CompanyTanking = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.COMPANY_TANKING, false, DataRowVersion.Current); obj.InvoiceReceived = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.INVOICE_RECEIVED, false, DataRowVersion.Current); obj.InvoiceOK = RowFunctions.GetValueFromRowToBoolean(Fuel, FuelObject.INVOICE_OK, false, DataRowVersion.Current); obj.DateMailForbiddenFueling = PROF_IT.Common.Convert.DateFunctions.DBDateToDateTime( RowFunctions.GetValueFromRowToString(Fuel, FuelObject.DATEMAIL_FORBIDDENFUELING, false, DataRowVersion.Current),false); } return obj; } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return obj; }
// Called by FuelObject when it changes internal void FuelObjectChanged(FuelObject Fuel) { try { int index = List.IndexOf(Fuel); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
// Methods. object IBindingList.AddNew() { try { FuelObject Fuel = new FuelObject(); List.Add(Fuel); return(Fuel); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
protected override void OnRemoveComplete(int index, object value) { try { FuelObject Fuel = (FuelObject)value; Fuel.Parent = this; OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
protected override void OnSetComplete(int index, object oldValue, object newValue) { try { if (oldValue != newValue) { FuelObject oldFuel = (FuelObject)oldValue; FuelObject newFuel = (FuelObject)newValue; oldFuel.Parent = null; newFuel.Parent = this; OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index)); } } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public FuelDetail(PROF_IT.Common.Enumerations.TypeForm typeForm) { try { InitializeComponent(); _typeForm = typeForm; if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm) { FuelMember = new FuelObject(); FindAll(); } else { throw new NotImplementedException(); } SetPermissions(); } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public FuelDetail(PROF_IT.Common.Enumerations.TypeForm typeForm, TIS.DL.Internal.Fuel.FuelObject fuel) { try { InitializeComponent(); _fuel = fuel; _typeForm = typeForm; if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm) { throw new NotImplementedException(); } else { InitializePropertyForm(); } FindAll(); SetPermissions(); } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void Save(FuelObject Fuel) { try { CheckTransaction(); new FuelDataService(Transaction).Save(Fuel); if (IsOwner) Transaction.Commit(); } catch (Exception exception1) { if (IsOwner) Transaction.Rollback(); Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (IsOwner) Connection.Close(); } }
// Methods. object IBindingList.AddNew() { try { FuelObject Fuel = new FuelObject(); List.Add(Fuel); return Fuel; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public int Add(FuelObject value) { try { return List.Add(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
private void btnImportTotal_Click(object sender, EventArgs e) { try { try { OpenFileDialog ofdImport = new OpenFileDialog(); ofdImport.Title = "Select file"; ofdImport.Filter = "Excel Sheet(*.xlsx)|*.xlsx|Excel Sheet 2003(*.xls)|*.xls|All Files(*.*)|*.*"; ofdImport.FilterIndex = 1; ofdImport.RestoreDirectory = true; if (ofdImport.ShowDialog() != DialogResult.OK) return; string connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; data source={0}; Extended Properties=Excel 12.0;", ofdImport.FileName); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Download factuur in Excel$]", connectionString); DataSet ds = new DataSet(); adapter.Fill(ds); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr[18].ToString() == "" || dr[18].ToString().Trim() == "hoeveelheid") // Do not import header or empty rows from Excel continue; Enumeration.Fuel.FuelType fuelType; switch(dr[17].ToString().ToLower()) { case "adblue": fuelType = Enumeration.Fuel.FuelType.Unknown ; break; case "diesel 10 ppm": fuelType = Enumeration.Fuel.FuelType.Diesel ; break; case "excellium diesel": fuelType = Enumeration.Fuel.FuelType.Diesel ; break; default: fuelType = Enumeration.Fuel.FuelType.Unknown; break; } string currency = dr[28].ToString().ToLower().Trim(); if (currency.ToLower() != "eur" && currency.ToLower() != "pln") { XtraMessageBox.Show("Wisselkoers niet gekend", "De wisselkoers " + currency + "is niet gekend!" , MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; } if (fuelType == Enumeration.Fuel.FuelType.Diesel) { string licenseplate = ""; string employeename = ""; if (dr[12].ToString() != "") { int space1 = dr[12].ToString().IndexOf(' '); licenseplate = dr[12].ToString().Substring(0, space1); employeename = dr[12].ToString().Substring(space1 + 1); } TIS.DL.Internal.Fuel.FuelObject fuelObj = new FuelObject(); fuelObj.Btw = Convert.ToDecimal(dr[21].ToString()); fuelObj.CompanyTanking = false; fuelObj.Date = Convert.ToDateTime(dr[15].ToString()); fuelObj.Employee = employeename; fuelObj.EmployeeName = employeename; fuelObj.FuelType = fuelType; fuelObj.InvoiceOK = false; fuelObj.InvoiceReceived = false; fuelObj.Location = dr[26].ToString() + " -- " + dr[30].ToString(); fuelObj.PrivateTanking = false; fuelObj.Quantity = Convert.ToDecimal(dr[18].ToString()); fuelObj.QuantityCorrection = 0; fuelObj.Supplier = "TOTAL"; fuelObj.TotalPrice = Convert.ToDecimal(dr[20].ToString()); fuelObj.UnityPrice = Convert.ToDecimal(dr[20].ToString()) / Convert.ToDecimal(dr[18].ToString()); fuelObj.VehicleKilometreCounter = Convert.ToInt32(Math.Round(Convert.ToDecimal(dr[31].ToString()),0)); fuelObj.VehicleLicensePlate = licenseplate; if (currency == "pln") { decimal pln = Convert.ToDecimal(txtPLNCurrency.Text); fuelObj.Btw = fuelObj.Btw / pln; fuelObj.TotalPrice = fuelObj.TotalPrice / pln; fuelObj.UnityPrice = fuelObj.UnityPrice / pln; } TIS.BL.Internal.Fuel fuelBL = new BL.Internal.Fuel(); fuelBL.Save(fuelObj); } } XtraMessageBox.Show("Geïmporteerd", "Bestand is geïmporteerd.", MessageBoxButtons.OK, MessageBoxIcon.Warning); Filter(); } catch (System.Exception excepion1) { System.Exception thisException = excepion1; Management.ShowException(thisException); } } catch (System.Exception excepion1) { System.Exception thisException = excepion1; Management.ShowException(thisException); } }
public bool Remove(FuelObject fuel) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Fuel_DELETE", CreateParameter("@fuelID", SqlDbType.UniqueIdentifier, fuel.FuelID, ParameterDirection.Input) ); return true; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
public void Save(FuelObject fuel) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Fuel_SAVE", CreateParameter("@fuelID", SqlDbType.UniqueIdentifier, fuel.FuelID, ParameterDirection.InputOutput), CreateParameter("@transi_TNR_reg", SqlDbType.Int, fuel.Transi_TNR_reg), CreateParameter("@transi_TNR_person", SqlDbType.Int, fuel.Transi_TNR_person), CreateParameter("@transi_TNR_mat", SqlDbType.Int, fuel.Transi_TNR_mat), CreateParameter("@transi_TNR_pump", SqlDbType.Int, fuel.Transi_TNR_pump), CreateParameter("@transi_TNR_tank", SqlDbType.Int, fuel.Transi_TNR_tank), CreateParameter("@transi_FuelType", SqlDbType.Int, fuel.Transi_FuelType), CreateParameter("@transc_FuelId", SqlDbType.Int, fuel.Transc_FuelId), CreateParameter("@transc_NawID", SqlDbType.Int, fuel.Transc_NawID), CreateParameter("@transc_Date", SqlDbType.Float, fuel.Transc_Date), CreateParameter("@transc_PriveBedrijf", SqlDbType.Int , fuel.Transc_PriveBedrijf), CreateParameter("@transc_Product", SqlDbType.NChar, fuel.Transc_Product), CreateParameter("@Date", SqlDbType.DateTime, fuel.Date), CreateParameter("@EmployeeName", SqlDbType.NChar, fuel.EmployeeName), CreateParameter("@Employee", SqlDbType.NChar, fuel.Employee), CreateParameter("@VehicleLicensePlate", SqlDbType.NChar, fuel.VehicleLicensePlate), CreateParameter("@VehicleKilometreCounter", SqlDbType.Int, fuel.VehicleKilometreCounter), CreateParameter("@Quantity", SqlDbType.Decimal, fuel.Quantity), CreateParameter("@QuantityCorrection", SqlDbType.Decimal, fuel.QuantityCorrection), CreateParameter("@Fulltank", SqlDbType.Decimal, fuel.FullTank), CreateParameter("@UnityPrice", SqlDbType.Decimal, fuel.UnityPrice), CreateParameter("@TotalPrice", SqlDbType.Decimal, fuel.TotalPrice), CreateParameter("@Unit", SqlDbType.Int, fuel.Unit), CreateParameter("@Supplier", SqlDbType.NChar, fuel.Supplier), CreateParameter("@Location", SqlDbType.NChar, fuel.Location), CreateParameter("@Fueltype", SqlDbType.Int, (int)fuel.FuelType), CreateParameter("@BTW", SqlDbType.Decimal, fuel.Btw), CreateParameter("@PrivateTanking", SqlDbType.Bit, fuel.PrivateTanking), CreateParameter("@CompanyTanking", SqlDbType.Bit, fuel.CompanyTanking), CreateParameter("@InvoiceReceived", SqlDbType.Bit, fuel.InvoiceReceived), CreateParameter("@InvoiceOK", SqlDbType.Bit, fuel.InvoiceReceived), CreateParameter("@DateMailForbiddenFueling", SqlDbType.VarChar, PROF_IT.Common.Convert.DateFunctions.DateToLongStrDate(fuel.DateMailForbiddenFueling)) ); fuel.FuelID = (Guid)cmd.Parameters["@fuelID"].Value; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }