Пример #1
0
 public void Remove(FuelCorrectionObject fuelCorrection)
 {
     try
     {
         CheckTransaction();
         new FuelCorrectionDataService(Transaction).Remove(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();
         }
     }
 }
        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;
            }
        }
        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;
            }
        }
Пример #4
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);
     }
 }
Пример #5
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);
     }
 }
Пример #6
0
        private void bbiRemoveFuelCorrection_Click(object sender, EventArgs e)
        {
            try
            {

                if (DevExpress.XtraEditors.XtraMessageBox.Show(this.LookAndFeel, "Ben je zeker dat je de brandstof correctie wilt verwijderen?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button3) == DialogResult.Yes)
                {
                    //********************
                    //    GetFuels
                    //********************
                    FuelCorrectionObject fuel = (FuelCorrectionObject)this.gdvFuelCorrection.GetRow(this.gdvFuelCorrection.FocusedRowHandle);
                    FuelObjectCollection fuels;
                    BL.Internal.Fuel fuelBL = new BL.Internal.Fuel();
                    fuels = fuelBL.GetFilter(PROF_IT.Common.Convert.DateFunctions.DBDateToDate(fuel.DateFrom),
                                                            PROF_IT.Common.Convert.DateFunctions.DBDateToDate(fuel.DateTo),
                                                            fuel.VehiclesNotIncluded, fuel.SuppliersIncluded);
                    if (fuels != null)
                    {
                        foreach (FuelObject fuelObj in fuels)
                        {
                            fuelObj.QuantityCorrection = fuelObj.Quantity;
                            new BL.Internal.Fuel().Save(fuelObj);
                        }
                    }

                    new BL.Internal.FuelCorrection().Remove(fuel);
                    FillControlsCorrection();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception thisException = exception1;
                Management.ShowException(thisException);
            }
        }
Пример #7
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;
        }