示例#1
0
 private void SetData(VanBan data)
 {
     lblId.Text = data.ID.ToString();
     txtTieuDeVn.Text = data.TenVanBan;
     txtTomTatVn.Text = data.MoTa;
     txtDuongDan.Text = data.DuongDan;
     txtSoHieu.Text = data.SoHieu;
     txtNgayBanHanh.Text = data.NgayBanHanh.ToShortDateString();
     ddlLoaiMenu.SelectedValue = data.IDTheLoai.ToString();
     //if (data.TrangChu == true)
     //    ckbTrangChu.Checked = true;
 }
示例#2
0
 public static int Them(VanBan noiDung)
 {
     try
     {
         object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@ID", "VanBan_Them", noiDung.ID, noiDung.SoHieu,
             noiDung.TenVanBan, noiDung.MoTa, noiDung.NgayBanHanh, noiDung.DuongDan, noiDung.IDTheLoai);
         return Convert.ToInt32(rs);
     }
     catch
     {
         return 0;
     }
 }
示例#3
0
 private VanBan GetData()
 {
     VanBan data = new VanBan();
     if (lblId.Text != "")
     {
         //lay thong tin cu tu Database de cap nhat
         data = VanBan.LayTheoID(lblId.Text);
     }
     else
     {
         data = new VanBan();//them moi
     }
     data.SoHieu = txtSoHieu.Text.Trim();
     data.TenVanBan = txtTieuDeVn.Text.Trim();
     data.MoTa = txtTomTatVn.Text.Trim();
     data.DuongDan = txtDuongDan.Text.Trim();
     data.NgayBanHanh = Convert.ToDateTime(txtNgayBanHanh.Text.Trim());
     data.IDTheLoai = ConvertType.ToInt32(ddlLoaiMenu.SelectedValue.Trim());
     return data;
 }
示例#4
0
 public static bool Sua(VanBan noiDung)
 {
     try
     {
         object rs = DataProvider.Instance.ExecuteNonQuery("VanBan_Sua", noiDung.ID, noiDung.SoHieu,
             noiDung.TenVanBan, noiDung.MoTa, noiDung.NgayBanHanh, noiDung.DuongDan, noiDung.IDTheLoai);
         return Convert.ToInt32(rs) > 0;
     }
     catch
     {
         return false;
     }
 }