示例#1
0
文件: Form1.cs 项目: jhonejay/cruud
        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();
        }