Beispiel #1
0
 public CKTD_TaiKhoan getCKTD_TaiKhoanById(int iD)
 {
     try
     {
         CKTD_TaiKhoan CKTD_TaiKhoan = (CKTD_TaiKhoan)session.Get <CKTD_TaiKhoan>(iD);
         return(CKTD_TaiKhoan);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Beispiel #2
0
 public void xoaCKTD_TaiKhoan(CKTD_TaiKhoan CKTD_TaiKhoan)
 {
     sessionManager.BeginTransaction();
     try
     {
         session.Delete(CKTD_TaiKhoan);
         sessionManager.CommitTransaction();
     }
     catch (HibernateException ex)
     {
         throw new DataException(ex.Message, ex);
     }
 }
Beispiel #3
0
 public void themCKTD_TaiKhoan(CKTD_TaiKhoan CKTD_TaiKhoan)
 {
     sessionManager.BeginTransaction();
     try
     {
         session.Save(CKTD_TaiKhoan);
         sessionManager.CommitTransaction();
         //session.Close();
     }
     catch (HibernateException ex)
     {
         throw new DataException(ex.Message, ex);
     }
 }
Beispiel #4
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     if (nguoidung != null)
     {
         nguoidung.Ten           = txtTenHienThi.Text.Trim();
         nguoidung.TaiKhoan      = txtTenDangNhap.Text.Trim();
         nguoidung.LoaiNguoiDung = int.Parse(ddlLoaiTaiKhoan.SelectedValue);
         nguoidung.Role          = int.Parse(ddlLoaiTaiKhoan.SelectedValue);
         cktd.updateCKTD_TaiKhoan(nguoidung);
     }
     else
     {
         nguoidung               = new CKTD_TaiKhoan();
         nguoidung.Ten           = txtTenHienThi.Text.Trim();
         nguoidung.TaiKhoan      = txtTenDangNhap.Text.Trim();
         nguoidung.LoaiNguoiDung = int.Parse(ddlLoaiTaiKhoan.SelectedValue);
         nguoidung.Role          = int.Parse(ddlLoaiTaiKhoan.SelectedValue);
         cktd.themCKTD_TaiKhoan(nguoidung);
     }
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (HttpContext.Current.Request.QueryString["ID"] != null)
     {
         int id = 0;
         int.TryParse(HttpContext.Current.Request.QueryString["ID"].ToString(), out id);
         try
         {
             nguoidung = cktd.getCKTD_TaiKhoanById(id);
             if (!this.IsPostBack)
             {
                 initializeDataInControl();
             }
         }
         catch (Exception ex)
         {
             nguoidung = null;
         }
     }
     else
     {
         if (HttpContext.Current.Request.QueryString["TaiKhoan"] != null)
         {
             string taiKhoan = HttpContext.Current.Request.QueryString["TaiKhoan"].ToString();
             try
             {
                 nguoidung = cktd.getCKTD_TaiKhoan("where TaiKhoan=N'" + taiKhoan + "'")[0];
                 if (!this.IsPostBack)
                 {
                     initializeDataInControl();
                 }
             }
             catch (Exception ex)
             {
                 nguoidung = null;
             }
         }
     }
 }