public static FuelCorrectionObject FuelRowToObject(DataRow Fuel)
        {
            FuelCorrectionObject obj = new FuelCorrectionObject();

            try
            {
                if (Fuel != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(Fuel, FuelCorrectionObject.FUELCOR_ID, false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.FuelCorID           = RowFunctions.GetValueFromRowToGuid(Fuel, FuelCorrectionObject.FUELCOR_ID, true, DataRowVersion.Current);
                        obj.DateFrom            = RowFunctions.GetValueFromRowToString(Fuel, FuelCorrectionObject.DATE_FROM, false, DataRowVersion.Current);
                        obj.DateTo              = RowFunctions.GetValueFromRowToString(Fuel, FuelCorrectionObject.DATE_TO, false, DataRowVersion.Current);
                        obj.Quantity            = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelCorrectionObject.QUANTITY, false, DataRowVersion.Current);
                        obj.MaxQuantity         = RowFunctions.GetValueFromRowToDecimal(Fuel, FuelCorrectionObject.MAXQUANTITY, false, DataRowVersion.Current);
                        obj.VehiclesNotIncluded = RowFunctions.GetValueFromRowToString(Fuel, FuelCorrectionObject.VEHICLES_NOT_INCLUDED, false, DataRowVersion.Current);
                        obj.SuppliersIncluded   = RowFunctions.GetValueFromRowToString(Fuel, FuelCorrectionObject.SUPPLIERS_INCLUDED, false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Esempio n. 2
0
 public int Add(FuelCorrectionObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 3
0
 public void Remove(FuelCorrectionObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 4
0
 // Called by FuelCorrectionObject when it changes
 internal void FuelCorrectionObjectChanged(FuelCorrectionObject 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);
     }
 }
Esempio n. 5
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         FuelCorrectionObject Fuel = new FuelCorrectionObject();
         List.Add(Fuel);
         return(Fuel);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 6
0
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         FuelCorrectionObject Fuel = (FuelCorrectionObject)value;
         Fuel.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 7
0
 public void Save(FuelCorrectionObject fuelCorrection)
 {
     try
     {
         CheckTransaction();
         new FuelCorrectionDataService(Transaction).Save(fuelCorrection);
         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();
     }
 }
Esempio n. 8
0
 public Fuel()
 {
     try
     {
         InitializeComponent();
         _fuelCorrection = new FuelCorrectionObject();
         _fuelCorrectionRows = new FuelObjectCollection();
         _saveEnable = true;
         FillControls();
         FillControlsCorrection();
         FillControlsDelivery();
         FillControlsFuelReport();
         SetPermissions();
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 9
0
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    FuelCorrectionObject oldFuel = (FuelCorrectionObject)oldValue;
                    FuelCorrectionObject newFuel = (FuelCorrectionObject)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 bool Remove(FuelCorrectionObject fuelCorrection)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "FuelCorrection_DELETE",
             CreateParameter("@fuelcorID", SqlDbType.UniqueIdentifier, fuelCorrection.FuelCorID, 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;
     }
 }
 // Called by FuelCorrectionObject when it changes
 internal void FuelCorrectionObjectChanged(FuelCorrectionObject 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);
     }
 }
 public void Remove(FuelCorrectionObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         FuelCorrectionObject Fuel = new FuelCorrectionObject();
         List.Add(Fuel);
         return Fuel;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(FuelCorrectionObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 15
0
        private void ClearFuelCorrectionControls()
        {
            try
            {
                this.ccbxSuppliersIncluded.Properties.Items.Clear();
                string[] suppliers = new BL.Internal.Fuel().GetSuppliers();
                foreach (string supplier in suppliers)
                {
                    this.ccbxSuppliersIncluded.Properties.Items.Add(supplier);
                }

                this.ccbxVehiclesNotIncluded.Properties.Items.Clear();
                string[] vehicles = new BL.Internal.Fuel().GetVehicles();
                foreach (string vehicle in vehicles)
                {
                    this.ccbxVehiclesNotIncluded.Properties.Items.Add(vehicle);
                }

                dteDateFromCorrection.Text = "";
                dteDateToCorrection.Text = "";
                _fuelCorrection = new FuelCorrectionObject();

                this.gdcFuelCorrectionCalc.DataSource = null;
                _saveEnable = true;
                btnSaveCorrection.Enabled = false;
                btnCancelCorrection.Enabled = false;
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }

            spinMaxQuantity.Value = 0;
            spinQuantityCorrection.Value = 0;
        }
Esempio n. 16
0
 private void gdvFuelCorrection_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         GridView view = (GridView)sender;
         _fuelCorrection = (FuelCorrectionObject)view.GetRow(view.FocusedRowHandle);
         FillFuelCorrectionControls();
         _saveEnable = false;
         btnSaveCorrection.Enabled = false;
         btnCancelCorrection.Enabled = false;
         btnCalculateCorrection.Enabled = true;
     }
     catch (System.Exception excepion1)
     {
         System.Exception thisException = excepion1;
         Management.ShowException(thisException);
     }
 }
 public void Save(FuelCorrectionObject fuelCorrection)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "FuelCorrection_SAVE",
             CreateParameter("@fuelcorID", SqlDbType.UniqueIdentifier, fuelCorrection.FuelCorID, ParameterDirection.InputOutput),
             CreateParameter("@DateFrom", SqlDbType.VarChar, fuelCorrection.DateFrom),
             CreateParameter("@DateTo", SqlDbType.VarChar, fuelCorrection.DateTo),
             CreateParameter("@Quantity", SqlDbType.Decimal, fuelCorrection.Quantity),
             CreateParameter("@MaxQuantity", SqlDbType.Decimal, fuelCorrection.MaxQuantity),
             CreateParameter("@VehiclesNotIncluded", SqlDbType.VarChar, fuelCorrection.VehiclesNotIncluded),
             CreateParameter("@SuppliersIncluded", SqlDbType.VarChar, fuelCorrection.SuppliersIncluded)
             );
         fuelCorrection.FuelCorID = (Guid)cmd.Parameters["@fuelcorID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }