Beispiel #1
0
        public bool Update(ProductPackSizeProvider provider)
        {
            bool isUpdate = false;

            try
            {
                SqlCommand command = null;
                command = ProcedureFunction(provider);
                command.Parameters.Add("@ID", SqlDbType.Int).Value           = provider.ID;
                command.Parameters.Add("@UpdateUserID", SqlDbType.Int).Value = provider.UpdateUserID;
                command.Parameters.Add("@Option", SqlDbType.Int).Value       = DBConstants.DataModificationOption.Update;
                command.ExecuteNonQuery();
                this.CommitTransaction();
                this.ConnectionClosed();
                isUpdate = true;
            }
            catch (Exception exp)
            {
                this.RollbackTransaction();
                throw new Exception(exp.Message);
            }
            finally
            {
                this.ConnectionClosed();
            }
            return(isUpdate);
        }
Beispiel #2
0
        public bool Delete(ProductPackSizeProvider 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.ProductPackSizeSet;
                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 #3
0
        private SqlCommand ProcedureFunction(ProductPackSizeProvider provider)
        {
            SqlCommand command = new SqlCommand();

            this.ConnectionOpen();
            command.Connection = Connection;
            this.BeginTransaction(true);
            command.Transaction = this.Transaction;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = StoredProcedureNames.ProductPackSizeSet;
            command.Parameters.Add("@PackName", SqlDbType.VarChar).Value      = provider.PackName;
            command.Parameters.Add("@PackTypeID", SqlDbType.Int).Value        = provider.PackTypeID;
            command.Parameters.Add("@Length", SqlDbType.VarChar).Value        = provider.Lenght;
            command.Parameters.Add("@Height", SqlDbType.Float).Value          = provider.Height;
            command.Parameters.Add("@Width", SqlDbType.Float).Value           = provider.Width;
            command.Parameters.Add("@Quantity", SqlDbType.Int).Value          = provider.Quantity;
            command.Parameters.Add("@MeasurementUnitID", SqlDbType.Int).Value = provider.MesurementUnitID;
            command.Parameters.Add("@StatusID", SqlDbType.Int).Value          = provider.StatusID;

            return(command);
        }