Esempio n. 1
0
        // Data Source -- update Individual
        public bool DSupdateIndividual(Individual ind)
        {
            try
            {
                // set adapter
                ita = new canoeDataSetTableAdapters.Canoe_IndividualCanoeTableAdapter();

                // update
                ita.UpdateIndivisualQuery(
                    ind.Colour,
                    ind.BatteryLife,
                    ind.ManufactoredYear,
                    ind.Accessories,
                    ind.Status,
                    ind.RentPerDay,
                    ind.Deposit,
                    ind.ModelNo,
                    ind.IndCanoeID
                    );
                return true;
            }
            catch (Exception ex)
            {
                throw new CanoeException("DSupdateIndividual", ex.Message);
            }
        }
Esempio n. 2
0
 // get deposit  
 public decimal getDeposit(string indID)
 {
     individual = new Individual();
     individual = searchDAOIndividualById(int.Parse(indID));
     return individual.Deposit;
 }
Esempio n. 3
0
        // DAO -- update individual
        public bool DAOupdateIndividual(Individual ind)
        {
            try
            {
                // connect
                GetConnection();

                // update pserson
                SqlCommand cmd;
                cmd = new SqlCommand(updateIndQuery, con);
                cmd.Parameters.AddWithValue("@Colour", ind.Colour);
                cmd.Parameters.AddWithValue("@BatteryLife", ind.BatteryLife);
                cmd.Parameters.AddWithValue("@ManufactoredYear", ind.ManufactoredYear);
                cmd.Parameters.AddWithValue("@Accessories", ind.Accessories);
                cmd.Parameters.AddWithValue("@Status", ind.Status);
                cmd.Parameters.AddWithValue("@RentPerDay", ind.RentPerDay);
                cmd.Parameters.AddWithValue("@Deposit", ind.Deposit);
                cmd.Parameters.AddWithValue("@ModelNo", ind.ModelNo);
                cmd.Parameters.AddWithValue("@IndCanoeID", ind.IndCanoeID);
                cmd.ExecuteScalar();

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

                return true;
            }
            catch (Exception ex)
            {
                throw new CanoeException("DAOupdateIndividual", ex.Message);
            }
        }
Esempio n. 4
0
 public RentDetail makeRentDetail(int indCanoeID, DateTime? returnDueDate,
         DateTime? returnDate, decimal penaltyAmount, int quantity, decimal lIAmountTotal)
 {
     Individual ind = new Individual();
     ind = searchDAOIndividualById(indCanoeID);
     RentDetail detail = new RentDetail(
         indCanoeID,
         returnDueDate,
         returnDate,
         penaltyAmount,
         quantity,
         lIAmountTotal,
         ind
     );
     return detail;
 }
Esempio n. 5
0
 // set individual instance
 private Individual setIndividual(DataTable dt)
 {
     Individual individual = new Individual();
     individual.IndCanoeID = (int)dt.Rows[0][0];
     individual.Colour = dt.Rows[0][1].ToString();
     individual.BatteryLife = dt.Rows[0][2].ToString();
     individual.ManufactoredYear = (int)dt.Rows[0][3];
     individual.Accessories = dt.Rows[0][4].ToString();
     individual.Status = dt.Rows[0][5].ToString();
     individual.RentPerDay = (decimal)dt.Rows[0][6];
     individual.Deposit = (decimal)dt.Rows[0][7];
     individual.ModelNo = dt.Rows[0][8].ToString();
     return individual;
 }
Esempio n. 6
0
 // insert Individual
 public bool insertDSIndividualDB(Individual ind)
 {
     db = new DatabaseAccess();
     db.DSinsertIndividual(ind);
     return true;
 }
Esempio n. 7
0
 // update Individual
 public bool updateDSModelDB(Individual ind)
 {
     db = new DatabaseAccess();
     db.DSupdateIndividual(ind);
     return true;
 }
Esempio n. 8
0
 public Individual makeIndividual(int indCanoeID, string colour, string batteryLife,
         int manufactoredYear, string accessories, string status,
         decimal rentPerDay, decimal deposit, string modelNo)
 {
     Individual ind = new Individual(
         indCanoeID,
         colour,
         batteryLife,
         manufactoredYear,
         accessories,
         status,
         rentPerDay,
         deposit,
         modelNo
     );
     return ind;
 }
Esempio n. 9
0
 // update Individual
 public bool updateDAOIndividual(Individual ind)
 {
     db = new DatabaseAccess();
     db.DAOupdateIndividual(ind);
     return true;
 }
Esempio n. 10
0
        // update button click  
        private void btnDAOUpdateInd_Click(object sender, EventArgs e)
        {
            try
            {
                // get input item
                getInputItem();

                // input check
                CheckIndividual();
                IsRequireIndCanoeID();

                // make instance
                ind = makeIndvisualInstance();

                // update
                manage.updateDAOIndividual(ind);
                MessageBox.Show("Individual has been updated");
            }
            catch (CanoeException)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 11
0
 // Indvisual make instance  
 private Individual makeIndvisualInstance()
 {
     // make instance
     if (indCanoeID.Length > 0) {
         ind = manage.makeIndividual(
                 int.Parse(indCanoeID), colour, batteryLife,
                 int.Parse(manufactoredYear), accessories, status,
                 decimal.Parse(rentPerDay), decimal.Parse(deposit), modelNo);
     }
     else
     {
         ind = manage.makeIndividual(
                 colour, batteryLife,
                 int.Parse(manufactoredYear), accessories, status,
                 decimal.Parse(rentPerDay), decimal.Parse(deposit), modelNo);
     }
     return ind;
 }
Esempio n. 12
0
 // get rent 
 private ArrayList getRetrunList()
 {
     try
     {
         manage.returnlist = new ArrayList();
         foreach (DataGridViewRow row in dataGridViewReturn.Rows)
         {
             detail = new RentDetail();
             int id = int.Parse(row.Cells[1].Value.ToString());
             int indid = int.Parse(row.Cells[7].Value.ToString());
             detail = manage.searchDAORentedByID(id.ToString(), indid.ToString());
             decimal penalty = decimal.Parse(row.Cells[10].Value.ToString());
             detail.PenaltyAmount = penalty;
             Individual ind = new Individual();
             ind = manage.searchDAOIndividualById(indid);
             detail.Ind = ind;
             manage.returnlist.Add(detail);
         }
     }
     catch (Exception)
     {
     }
     finally
     {
     }
     return manage.returnlist;
 }
Esempio n. 13
0
 // get rent products
 private ArrayList getRentProduct()
 {
     manage.products = new ArrayList();
     foreach (DataGridViewRow row in dataGridViewRent.Rows)
     {
         try
         {
             individual = new Individual();
             int id = int.Parse(row.Cells[13].Value.ToString());
             individual = manage.searchDAOIndividualById(id);
             manage.products.Add(individual);
         }
         catch (Exception)
         {
         }
     }
     return manage.products;
 }
Esempio n. 14
0
        // select product event 
        private void dataGridViewProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // rent active 
                activeRented();

                // get current row
                DataGridViewRow row = dataGridViewProduct.CurrentRow;
                individual = new Individual();
                individual.IndCanoeID = int.Parse(row.Cells[11].Value.ToString());

                DataRow[] rows = table.Select("IndCanoeID=" + individual.IndCanoeID);
                foreach (DataRow d in rows)
                {
                    temp.ImportRow(d);

                }
                dataGridViewRent.DataSource = temp;
                dataGridViewProduct.Rows.RemoveAt(row.Index);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }