public bool Delete(ProductTypeProvider provider)
        {
            bool isDelete = false;

            try
            {
                SqlCommand command = new SqlCommand();
                this.ConnectionOpen();
                command.Connection = Connection;
                this.BeginTransaction(true);
                command.Transaction = this.Transaction;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = StoredProcedureNames.ProductTypeSet;
                command.Parameters.Add("@ID", SqlDbType.Int).Value     = provider.ID;
                command.Parameters.Add("@Option", SqlDbType.Int).Value = DBConstants.DataModificationOption.Delete;
                command.ExecuteNonQuery();
                this.CommitTransaction();
                this.ConnectionClosed();
                isDelete = true;
            }
            catch (Exception exp)
            {
                this.RollbackTransaction();
                throw new Exception(exp.Message);
            }
            finally
            {
                this.ConnectionClosed();
            }
            return(isDelete);
        }
Beispiel #2
0
        public MainForm(UserModel loggedUser)
        {
            InitializeComponent();

            this.loggedUser = loggedUser;

            productProvider     = new ProductProvider();
            imageHelper         = new ImageHelper(new CloudHelper());
            productTypeProvider = new ProductTypeProvider();
            ingredientProvider  = new IngredientProvider();
            dishProvider        = new DishProvider();

            //Common Font for all Labels in the forms
            commonFont = new Font("Berlin Sans FB", 14F);

            //Common Table Padding without horisontal ScrollBar
            commonTablePadding = new Padding(0, 0, SystemInformation.VerticalScrollBarWidth, 0);
        }
 public ProductTypesController(ProductTypeProvider productTypeProvider)
 {
     this.productTypeProvider = productTypeProvider;
 }