Ejemplo n.º 1
0
        public bool InsertContribution(ContributionVO p)
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();



                dt.Rows.Add(new Object[] { p.ContributionID1, p.University1, p.Year1, p.Month1, p.SubDate1, p.Amount1, p.ReceiptNo1, p.OwnerID1 });

                return(cd.InsertContribution(dt));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
Ejemplo n.º 2
0
 public void UpdateContribution()
 {
     try
     {
         ContributionVO cv = new ContributionVO(Convert.ToInt32(lContributionID.Text), Convert.ToInt32(tUniversity.SelectedValue.ToString()), Convert.ToInt32(tYear.Text.ToString()), Convert.ToInt32(tMonth.Text.ToString()), Convert.ToDateTime(tSubDate.Text.ToString()), Convert.ToDouble(tAmount.Text.ToString()), tReceiptNo.Text.ToString(), tOwnerID.SelectedValue.ToString());
         if (cb.EditContribution(cv))
         {
             MessageBox.Show("Update Successful");
         }
         else
         {
             MessageBox.Show("Update Faailed");
         }
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.ToString());
     }
 }
Ejemplo n.º 3
0
        private void Insert_Click(object sender, EventArgs e)
        {
            if (tPeriod.Value.Year > DateTime.Now.Year || (tPeriod.Value.Month > DateTime.Now.Month && tPeriod.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }
            ContributionVO cv = new ContributionVO(Convert.ToInt32(tContributionID.Text), Convert.ToInt32(tUniversity.SelectedValue.ToString()), Convert.ToInt32(tPeriod.Value.Year.ToString()), Convert.ToInt32(tPeriod.Value.Month.ToString()), tSubDate.Value, Convert.ToDouble(tAmount.Text), tReceiptNo.Text, tOwnerID.SelectedValue.ToString());

            if (cb.InsertContribution(cv))
            {
                MessageBox.Show("Insert Successful");
                tContributionID.Clear();
                tAmount.Clear();
                tReceiptNo.Clear();
            }
            else
            {
                MessageBox.Show("Record Failed");
            }
        }
Ejemplo n.º 4
0
        public void InsertContribution(DataTable dt, int length)
        {
            string          conn      = @DBStr.connectionString;
            MySqlConnection DBConnect = new MySqlConnection(conn);
            int             progress  = 0;

            try
            {
                for (int n = 0; n < length; n++)
                {
                    ContributionVO cv = new ContributionVO(Convert.ToInt32(dt.Rows[n][0].ToString()), Convert.ToInt32(dt.Rows[n][1].ToString()), Convert.ToInt32(dt.Rows[n][2].ToString()), Convert.ToInt32(dt.Rows[n][3].ToString()), (Convert.ToDateTime(dt.Rows[n][4].ToString())), Convert.ToDouble(dt.Rows[n][5].ToString()), dt.Rows[n][6].ToString(), dt.Rows[n][7].ToString());

                    if (cb.InsertContribution(cv))
                    {
                        if (cb.UpdateEntryCon(dt.Rows[n][0].ToString()))
                        {
                            progress = Convert.ToInt32((n + 1) * 100 / length);
                            progressBar1.Increment(progress);
                        }
                    }
                }
                if (progress == 100)
                {
                    MessageBox.Show("Sucessfull");
                }

                cb.DisplayRemain(Remain);
                Available();
                progressBar1.Value = 0;
                MessageBox.Show("Data inserted");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }