Пример #1
0
        private void cmd_save_Click(object sender, EventArgs e)
        {
            if (isadd == true)
            {
                //add new record
                DBPrepaidCards prep = new DBPrepaidCards(txtCable.Text, Int32.Parse(txtAmount.Text), txtPin.Text, "Pending", dateTimePicker_DateReg.Value, dateTimePicker_Expire.Value);

                prep.Add();
            }
            else
            {
                //edit record
                int id = Int32.Parse(dataGridView_PrepaidCards.CurrentRow.Cells[0].Value.ToString());

                DBPrepaidCards rec = DBPrepaidCards.GetDataID(id);

                rec.Amount          = Int32.Parse(txtAmount.Text);
                rec.CableType       = txtCable.Text;
                rec.Date_Expired    = dateTimePicker_Expire.Value;
                rec.Date_Registered = dateTimePicker_DateReg.Value;
                rec.Pin             = txtPin.Text;

                rec.Update();
            }

            display();
        }
Пример #2
0
        private void cmd_delete_Click(object sender, EventArgs e)
        {
            int id = Int32.Parse(dataGridView_PrepaidCards.CurrentRow.Cells[0].Value.ToString());

            DBPrepaidCards rec = DBPrepaidCards.GetDataID(id);

            rec.Delete();

            display();
        }