public void AddInformationBanBe(BanBe banBe, SqlCommand Cmd) { Cmd.Parameters.Add("@STT", SqlDbType.Int); Cmd.Parameters["@STT"].Value = banBe.STT; Cmd.Parameters.Add("@HoTen", SqlDbType.NVarChar); Cmd.Parameters["@HoTen"].Value = banBe.HoTen; Cmd.Parameters.Add("@Email", SqlDbType.NVarChar); Cmd.Parameters["@Email"].Value = banBe.Email; Cmd.Parameters.Add("@NgaySinh", SqlDbType.DateTime); Cmd.Parameters["@NgaySinh"].Value = banBe.NgaySinh; Cmd.Parameters.Add("@SoDienThoai", SqlDbType.NVarChar); Cmd.Parameters["@SoDienThoai"].Value = banBe.SoDienThoai; Cmd.Parameters.Add("@Facebook", SqlDbType.NVarChar); Cmd.Parameters["@Facebook"].Value = banBe.Facebook; Cmd.Parameters.Add("@Skype", SqlDbType.NVarChar); Cmd.Parameters["@Skype"].Value = banBe.Skype; Cmd.Parameters.Add("@GioiTinh", SqlDbType.Bit); Cmd.Parameters["@GioiTinh"].Value = banBe.GioiTinh; Cmd.Parameters.Add("@DiaChi", SqlDbType.NVarChar); Cmd.Parameters["@DiaChi"].Value = banBe.DiaChi; }
public void AddbanBe(BanBe banBe) { SqlCommand Cmd = new SqlCommand(); string query = "insert into BanBe values(@HoTen,@Email,@NgaySinh,@SoDienThoai,@Facebook,@Skype,@GioiTinh,@DiaChi)"; Cmd.CommandText = query; AddInformationBanBe(banBe, Cmd); this.DataHelper.DB_ExecuteNonQuery(Cmd); }
public void UpdatebanBe(BanBe banBe) { SqlCommand Cmd = new SqlCommand(); string query = "update BanBe set HoTen = @HoTen,Email=@Email,NgaySinh=@NgaySinh,SoDienThoai=@SoDienThoai," + "Facebook=@Facebook,Skype=@Skype,GioiTinh=@GioiTinh, DiaChi=@DiaChi where STT = @STT"; Cmd.CommandText = query; AddInformationBanBe(banBe, Cmd); this.DataHelper.DB_ExecuteNonQuery(Cmd); }
private void Hien_thi_thong_tin(BanBe banBe) { txtHoTen.Text = banBe.HoTen; txtEmail.Text = banBe.Email; txtDiaChi.Text = banBe.DiaChi; txtSdt.Text = banBe.SoDienThoai; txtSkype.Text = banBe.Skype; txtFb.Text = banBe.Facebook; dtNgaySinh.Value = banBe.NgaySinh; rbGtNam.Checked = banBe.GioiTinh; rbGtNu.Checked = !banBe.GioiTinh; }
public BanBe GetBanBe(DataRow dataRow) { BanBe BanBe = new BanBe(); BanBe.STT = Convert.ToInt32(dataRow["STT"].ToString()); BanBe.HoTen = dataRow["HoTen"].ToString(); BanBe.Email = dataRow["Email"].ToString(); BanBe.DiaChi = dataRow["DiaChi"].ToString(); BanBe.NgaySinh = Convert.ToDateTime(dataRow["NgaySinh"].ToString()); BanBe.SoDienThoai = dataRow["SoDienThoai"].ToString(); BanBe.Facebook = dataRow["Facebook"].ToString(); BanBe.Skype = dataRow["Skype"].ToString(); BanBe.GioiTinh = Convert.ToBoolean(dataRow["GioiTinh"].ToString()); return(BanBe); }
private void gv_DsBanBe_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { BanBe banBe = qLBB.GetBanBeBySTT(Convert.ToInt32(gv_DsBanBe.SelectedRows[0].Cells["STT"].Value.ToString())); Hien_thi_thong_tin(banBe); }