Ejemplo n.º 1
0
 private void tsbSave_Click(object sender, EventArgs e)
 {
     if (op == operation.insert)
     {
         DataClasses1DataContext db = new DataClasses1DataContext(connStr);
         reserveManage           re = new reserveManage();
         re.cus2_name   = txtName.Text;
         re.cus2_id     = txtId.Text;
         re.cus2_phone  = txtPhone.Text;
         re.cus2_type   = cbroomType.Text;
         re.cus2_roomid = Convert.ToInt32(cbRoomID.Text);
         re.cus2_time   = dtTime.Value;
         re.cus2_days   = Convert.ToInt32(txtDays.Text);
         re.cus2_pay    = Convert.ToSingle(txtPay.Text);
         re.cus2_extra  = Convert.ToInt32(txtExtra.Text);
         db.reserveManage.InsertOnSubmit(re);
         db.SubmitChanges();
         MessageBox.Show("数据添加成功", "添加记录", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         BindInfo();
     }
     else if (op == operation.update)
     {
         DataClasses1DataContext db  = new DataClasses1DataContext(connStr);
         reserveManage           cre = new reserveManage();
         var result = from c in db.reserveManage
                      where c.cus2_id == txtId.Text
                      select c;
         foreach (reserveManage c in result)
         {
             c.cus2_name   = txtName.Text;
             c.cus2_id     = txtId.Text;
             c.cus2_phone  = txtPhone.Text;
             c.cus2_type   = cbroomType.Text;
             c.cus2_roomid = Convert.ToInt32(cbRoomID.Text);
             c.cus2_time   = dtTime.Value;
             c.cus2_days   = Convert.ToInt32(txtDays.Text);
             c.cus2_pay    = Convert.ToSingle(txtPay.Text);
             c.cus2_extra  = Convert.ToInt32(txtExtra.Text);
             db.SubmitChanges();
             MessageBox.Show("数据修改成功", "修改记录", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             BindInfo();
         }
     }
 }
Ejemplo n.º 2
0
 partial void UpdatereserveManage(reserveManage instance);
Ejemplo n.º 3
0
 partial void DeletereserveManage(reserveManage instance);
Ejemplo n.º 4
0
 partial void InsertreserveManage(reserveManage instance);