예제 #1
0
        // Data Source -- update Model
        public bool DSupdateModel(ProductModel model)
        {
            try
            {
                // set adapter
                mta = new canoeDataSetTableAdapters.Canoe_ModelTableAdapter();

                // update
                mta.UpdateModelQuery(
                    model.Brand,
                    model.Capacity,
                    model.Dimension,
                    model.Weight,
                    model.EnergySource,
                    model.Discription,
                    model.RentDeposite,
                    model.RentRatePerDay,
                    model.CategoryID,
                    model.ModelID
                    );
                return true;
            }
            catch (Exception ex)
            {
                throw new CanoeException("DSupdateModel", ex.Message);
            }
        }
예제 #2
0
파일: Manage.cs 프로젝트: kayshoji/C-.Net
 // update Model
 public bool updateDSModelDB(ProductModel model)
 {
     db = new DatabaseAccess();
     db.DSupdateModel(model);
     return true;
 }
예제 #3
0
        // DAO -- update model
        public bool DAOupdateModel(ProductModel model)
        {
            try
            {
                // connect
                GetConnection();

                // update pserson
                SqlCommand cmd;
                cmd = new SqlCommand(updateModelQuery, con);
                cmd.Parameters.AddWithValue("@ModelID", model.ModelID);
                cmd.Parameters.AddWithValue("@Brand", model.Brand);
                cmd.Parameters.AddWithValue("@Capacity", model.Capacity);
                cmd.Parameters.AddWithValue("@Dimension", model.Dimension);
                cmd.Parameters.AddWithValue("@Weight", model.Weight);
                cmd.Parameters.AddWithValue("@EnergySource", model.EnergySource);
                cmd.Parameters.AddWithValue("@Discription", model.Discription);
                cmd.Parameters.AddWithValue("@RentDeposite", model.RentDeposite);
                cmd.Parameters.AddWithValue("@RentRatePerDay", model.RentRatePerDay);
                cmd.Parameters.AddWithValue("@CategoryID", model.CategoryID);
                cmd.ExecuteScalar();

                // close
                con.Close();
                con.Dispose();
                cmd.Dispose();

                return true;
            }
            catch (Exception ex)
            {
                throw new CanoeException("DAOupdateModel", ex.Message);
            }
        }
예제 #4
0
파일: Manage.cs 프로젝트: kayshoji/C-.Net
 // insert Model
 public bool insertDSModelDB(ProductModel model)
 {
     db = new DatabaseAccess();
     db.DSinsertModel(model);
     return true;
 }
예제 #5
0
파일: Manage.cs 프로젝트: kayshoji/C-.Net
        //
        // --- Model -----------------------
        //

        // make Model instance
        public ProductModel makeModel(String modelID, String brand, String capacity, String dimension,
            int weight, String energySource, String discription, decimal rentDeposite, 
            decimal rentRatePerDay, int categoryID)
        {
            ProductModel model = new ProductModel(
                modelID,
                brand,
                capacity,
                dimension,
                weight,
                energySource,
                discription,
                rentDeposite,
                rentRatePerDay,
                categoryID
            );
            return model;
        }
예제 #6
0
 // model make instance  
 private ProductModel makeModelInstance()
 {
     model = manage.makeModel(
         modelID, brand, capacity, dimension, int.Parse(weight),
         energySource, discription, decimal.Parse(rentDeposite),
         decimal.Parse(rentRatePerDay), int.Parse(categoryID));
     return model;
 }
예제 #7
0
        // update button click  
        private void btnDSUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // get input item
                getInputItem();

                // input check
                CheckModel();

                // make instance
                model = makeModelInstance();

                // update
                manage.updateDSModelDB(model);
                MessageBox.Show("Model has been updated");
            }
            catch (CanoeException)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #8
0
        // 
        // tab: model
        // 

        // -- event Using DAO --------------------------

        // create button click  
        private void btnDAOCreate_Click(object sender, EventArgs e)
        {
            try
            {
                // get input item
                getInputItem();

                // input check
                CheckModel();

                // make instance
                model = makeModelInstance();

                // insert
                manage.insertDAOModel(model);
                MessageBox.Show("New Model has been added");
            }
            catch (CanoeException)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }