public void PHIEUDATCHO_Update(PHIEUDATCHO_Info pdc)
 {
     SqlConnection con = SqlDataProvider.GetConnection();
     con.Open();
     SqlCommand cmd = new SqlCommand("sp_PHIEUDATCHO_Update", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add(new SqlParameter("@SoPhieuDatCho", pdc.SoPhieuDatCho));
     cmd.Parameters.Add(new SqlParameter("@NgayDat", pdc.NgayDat.ToString("MM/dd/yyyy")));
     cmd.Parameters.Add(new SqlParameter("@HanhKhachDat", pdc.HanhKhachDat));
     cmd.Parameters.Add(new SqlParameter("@CMND", pdc.CMND));
     cmd.Parameters.Add(new SqlParameter("@DienThoai", pdc.DienThoai));
     cmd.ExecuteNonQuery();
     con.Close();
 }
예제 #2
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if(txtsophieudatcho.Text != "" && txtngaydat.Text != "" && txthanhkhachdat.Text != "" && txtcmndhkd.Text != "" && txtdienthoaihkd.Text != "" && txthanhkhachbay.Text != "" && txtcmndhkb.Text != "" && txtdienthoaihkb.Text != "" && dgvhanhkhachbay.RowCount > 0 )
     {
         try
         {
             PHIEUDATCHO_Info pdc = new PHIEUDATCHO_Info();
             pdc.SoPhieuDatCho = txtsophieudatcho.Text;
             pdc.NgayDat = DateTime.Parse(txtngaydat.Text);
             pdc.HanhKhachDat = txthanhkhachdat.Text;
             pdc.CMND = txtcmndhkd.Text;
             pdc.DienThoai = txtdienthoaihkd.Text;
             QLBanVeChuyenBay_Service.PHIEUDATCHO_Insert(pdc);
             MessageBox.Show("Đặt lịch thành công!", "Thông báo");
             issave = true;
             for (int i = 0; i < dgvhanhkhachbay.RowCount; i++)
             {
                 CT_PHIEUDATCHO_Info ctpdc = new CT_PHIEUDATCHO_Info();
                 ctpdc.MaChuyenBay = dgvhanhkhachbay[4, i].Value.ToString();
                 ctpdc.SoPhieuDatCho = txtsophieudatcho.Text;
                 ctpdc.HanhKhachBay = dgvhanhkhachbay[1, i].Value.ToString();
                 ctpdc.CMND = dgvhanhkhachbay[2, i].Value.ToString();
                 ctpdc.DienThoai = dgvhanhkhachbay[3, i].Value.ToString();
                 ctpdc.HangVe = dgvhanhkhachbay[5, i].Value.ToString();
                 ctpdc.GiaVe = int.Parse(dgvhanhkhachbay[6, i].Value.ToString());
                 ctpdc.LayVe = 0;
                 QLBanVeChuyenBay_Service.CT_PHIEUDATCHO_Insert(ctpdc);
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Đặt lịch không thành công, vui lòng kiểm tra lại!", "Thông báo");
         }
     }
     else
     {
         MessageBox.Show("Bạn chưa điền đủ thông tin, vui lòng kiểm tra lại!", "Thông báo");
     }
 }