private void btn_Sua_Click(object sender, EventArgs e) { if (ID != "") { DataTable dt = new DataTable(); DataTable dskh = new DataTable(); using (SqlConnection cnn = Class.datatabase.getConnection()) { cnn.Open(); SqlDataAdapter adap = new SqlDataAdapter(@"select * from SMSTuyBienStore Where IdCongTy=@IdCongTy and IdSMSTuyBien=@IdSMSTuyBien", cnn); adap.SelectCommand.Parameters.AddWithValue("@IdCongTy", Class.CompanyInfo.idcongty); adap.SelectCommand.Parameters.AddWithValue("@IdSMSTuyBien", Convert.ToInt64(ID)); adap.Fill(dt); SqlDataAdapter adap1 = new SqlDataAdapter(@"select kh.* from KhachHang kh, TinNhan tn Where kh.IdCongTy=@IdCongTy and tn.IdKhachHang=kh.IdKhachHang and tn.IdSMSTuyBien=@IdSMSTuyBien", cnn); adap1.SelectCommand.Parameters.AddWithValue("@IdCongTy", Class.CompanyInfo.idcongty); adap1.SelectCommand.Parameters.AddWithValue("@IdSMSTuyBien", Convert.ToInt64(ID)); adap1.Fill(dskh); cnn.Close(); } FrmSMSTuyBien frm = new FrmSMSTuyBien(); frm.Id = ID; frm.txt_GioNhan.Text = dt.Rows[0][5].ToString(); frm.txt_SMS.Text = dt.Rows[0][3].ToString(); frm.dt_NgayNhan.Value = Convert.ToDateTime(dt.Rows[0][6].ToString()); frm.dskh = dskh; frm.ShowDialog(); } else { MessageBox.Show("Hãy chọn lịch muốn sửa!"); } }
private void btn_DatLich_Click(object sender, EventArgs e) { FrmSMSTuyBien frm = new FrmSMSTuyBien(); frm.ShowDialog(); }