Example #1
0
        private void btnAdd_Click_1(object sender, EventArgs e)
        {
            int ri = dgvViewBidItems.CurrentRow.Index;

            if (ri >= 0)
            {
                DateTime ed       = DateTime.Parse(dgvViewBidItems.Rows[ri].Cells[2].Value.ToString());
                DateTime sd       = DateTime.Parse(dgvViewBidItems.Rows[ri].Cells[3].Value.ToString());
                DateTime det      = DateTime.Now;
                TimeSpan ds       = sd - det;
                TimeSpan de       = ed - det;
                int      dsNotNeg = ds.Days;
                int      deNeg    = de.Days;
                if (dsNotNeg >= 0 && deNeg <= 0)
                {
                    int         bid_id = int.Parse(dgvViewBidItems.Rows[ri].Cells[0].Value.ToString());
                    addBidItems add    = new addBidItems();
                    add.bid_id    = bid_id;
                    add.user_id   = user_id;
                    add.user_type = user_type;
                    add.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Bidding has already Expired!");
                }
            }
        }
Example #2
0
        private void btnViewItems_Click(object sender, EventArgs e)
        {
            int ri = dgvViewBidItems.CurrentRow.Index;

            if (ri >= 0)
            {
                DateTime ed       = DateTime.Parse(dgvViewBidItems.Rows[ri].Cells[2].Value.ToString());
                DateTime sd       = DateTime.Parse(dgvViewBidItems.Rows[ri].Cells[3].Value.ToString());
                DateTime det      = DateTime.Now;
                TimeSpan ds       = sd - det;
                TimeSpan de       = ed - det;
                int      dsNotNeg = ds.Days;
                int      deNeg    = de.Days;
                if (dsNotNeg >= 0 && deNeg <= 0)
                {
                    exp = 0;
                }
                else
                {
                    exp = 1;
                }
                int         bid_id = int.Parse(dgvViewBidItems.Rows[ri].Cells[0].Value.ToString());
                addBidItems add    = new addBidItems();
                add.bid_id    = bid_id;
                add.user_id   = user_id;
                add.user_type = user_type;
                add.offSet    = 1;
                add.exp       = exp;
                add.prevform  = this;
                add.ShowDialog();
            }
        }
Example #3
0
        private void dgvViewBidItems_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int ri = dgvViewBidItems.CurrentRow.Index;

            if (ri >= 0)
            {
                int         bid_id = int.Parse(dgvViewBidItems.Rows[ri].Cells[0].Value.ToString());
                addBidItems add    = new addBidItems();
                add.bid_id    = bid_id;
                add.user_id   = user_id;
                add.user_type = user_type;
                add.ShowDialog();
            }
        }
Example #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string ins = "Insert into bid Values(NULL, '" + txtTitle.Text + "', '" + dateStart.Text + "', '" + dateEnd.Text + "')";

            conn.Open();
            MySqlCommand comm = new MySqlCommand(ins, conn);

            comm.ExecuteNonQuery();
            conn.Close();
            DialogResult res = MessageBox.Show("Bid Information Added Successfully! Do you want to add items now?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (DialogResult.OK == res)
            {
                string sel = "SELECT max(bid_id) FROm bid";
                conn.Open();
                comm = new MySqlCommand(sel, conn);
                MySqlDataAdapter adp = new MySqlDataAdapter(comm);
                comm.ExecuteNonQuery();
                conn.Close();
                DataTable dt = new DataTable();
                adp.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    addBidItems add = new addBidItems();
                    add.bid_id    = int.Parse(dt.Rows[0][0].ToString());
                    add.user_id   = user_id;
                    add.user_type = user_type;
                    add.ShowDialog();
                }
                else
                {
                    MessageBox.Show("No selected bid!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                DialogResult re = MessageBox.Show("Do you want to add more?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (DialogResult.OK == re)
                {
                    foc();
                }
                else
                {
                    this.Close();
                }
            }
        }