Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["account"] != null)
     {
         Models.AccountEntity accEntity = new Models.AccountEntity();
         string         email           = Session["account"].ToString();
         Models.Account account         = accEntity.FindByEmail(email);
         if (account == null || account.ACCChucNang > 1)
         {
             Response.Redirect("~/");
         }
         else if (this.Page.RouteData.Values["ctxh"] != null)
         {
             try
             {
                 int ctxhID = Convert.ToInt32(this.Page.RouteData.Values["ctxh"]);
                 Models.ChinhTriXaHoiEntity ctxhEntity = new Models.ChinhTriXaHoiEntity();
                 Models.ChinhTriXaHois      ctxh       = ctxhEntity.Find(ctxhID);
                 if (ctxh == null)
                 {
                     Response.Redirect("~/");
                 }
             }
             catch (Exception)
             {
                 Response.Redirect("~/");
             }
         }
     }
     else
     {
         Response.Redirect("~/");
     }
 }
Esempio n. 2
0
 public void Delete(int _ctxhID)
 {
     Models.EmployeeManagementEntities db   = new EmployeeManagementEntities();
     Models.ChinhTriXaHois             ctxh = db.ChinhTriXaHois.FirstOrDefault(x => x.CTXHID == _ctxhID);
     db.ChinhTriXaHois.Remove(ctxh);
     db.SaveChanges();
     db.Dispose();
 }
Esempio n. 3
0
 public void Update(int _ctxhID, string _ten, string _diachi, string _sdt, string _fax, string _email, string _website, string _gioithieu)
 {
     Models.EmployeeManagementEntities db   = new EmployeeManagementEntities();
     Models.ChinhTriXaHois             ctxh = db.ChinhTriXaHois.FirstOrDefault(x => x.CTXHID == _ctxhID);
     ctxh.CTXHTen       = _ten;
     ctxh.CTXHDiaChi    = _diachi;
     ctxh.CTXHDienThoai = _sdt;
     ctxh.CTXHFax       = _fax;
     ctxh.CTXHEmail     = _email;
     ctxh.CTXHWebsite   = _website;
     ctxh.CTXHGioiThieu = _gioithieu;
     db.SaveChanges();
     db.Dispose();
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.RouteData.Values["ctxh"] == null)
     {
         this.CreateStatus();
     }
     else
     {
         this.UpdateStatus();
         _ctxhID = Convert.ToInt32(this.Page.RouteData.Values["ctxh"]);
         if (!IsPostBack)
         {
             Models.ChinhTriXaHois ctxh = _ctxhEntity.Find(_ctxhID);
             txtTen.Text       = ctxh.CTXHTen;
             txtSDT.Text       = ctxh.CTXHDienThoai;
             txtFax.Text       = ctxh.CTXHFax;
             txtEmail.Text     = ctxh.CTXHEmail;
             txtWebsite.Text   = ctxh.CTXHWebsite;
             txtDiaChi.Text    = ctxh.CTXHDiaChi;
             txtGioiThieu.Text = ctxh.CTXHGioiThieu;
         }
     }
 }