Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.RouteData.Values["taisan"] != null)
     {
         this.UpdateStatus();
         _taisanID = Convert.ToInt32(this.Page.RouteData.Values["taisan"]);
         Models.TaiSanNuocNgoai taisan = _tsEntity.Find(_taisanID);
         _kekhaiID = taisan.KKID;
         if (!this.Page.IsPostBack)
         {
             txtTen.Text     = taisan.TSNNTen;
             txtSoLuong.Text = taisan.TSNNSoLuong.ToString();
             if (taisan.TSNNGiaTri % 1 == 0)
             {
                 txtGiaTri.Text = taisan.TSNNGiaTri.ToString("###");
             }
             else
             {
                 txtGiaTri.Text = taisan.TSNNGiaTri.ToString();
             }
         }
     }
     else
     {
         this.CreateStatus();
         _kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]);
     }
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["account"] != null)
     {
         string email = Session["account"].ToString();
         Models.AccountEntity accEntity = new Models.AccountEntity();
         Models.Account       account   = accEntity.FindByEmail(email);
         if (account == null)
         {
             this.RedirectToIndex();
         }
         else if (account.ACCChucNang > 1)
         {
             if (!account.ACCUpKeKhai)
             {
                 this.RedirectToIndex();
             }
             else if (this.Page.RouteData.Values["taisan"] != null)
             {
                 try
                 {
                     int taisanID = Convert.ToInt32(this.Page.RouteData.Values["taisan"]);
                     Models.TaiSanNuocNgoaiEntity tsEntity = new Models.TaiSanNuocNgoaiEntity();
                     Models.TaiSanNuocNgoai       taisan   = tsEntity.Find(taisanID);
                     if (taisan == null)
                     {
                         this.RedirectToIndex();
                     }
                     else if (taisan.KeKhai.NVID != account.NVID)
                     {
                         this.RedirectToIndex();
                     }
                 }
                 catch
                 {
                     this.RedirectToIndex();
                 }
             }
             else if (this.Page.RouteData.Values["kekhai"] != null)
             {
                 try
                 {
                     int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]);
                     Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity();
                     Models.KeKhai       kekhai   = kkEntity.Find(kekhaiID);
                     if (kekhai == null)
                     {
                         this.RedirectToIndex();
                     }
                     else if (kekhai.NVID != account.NVID)
                     {
                         this.RedirectToIndex();
                     }
                 }
                 catch
                 {
                     this.RedirectToIndex();
                 }
             }
             else
             {
                 this.RedirectToIndex();
             }
         }
         else if (this.Page.RouteData.Values["taisan"] != null)
         {
             try
             {
                 int taisanID = Convert.ToInt32(this.Page.RouteData.Values["taisan"]);
                 Models.TaiSanNuocNgoaiEntity tsEntity = new Models.TaiSanNuocNgoaiEntity();
                 Models.TaiSanNuocNgoai       taisan   = tsEntity.Find(taisanID);
                 if (taisan == null)
                 {
                     this.RedirectToIndex();
                 }
             }
             catch
             {
                 this.RedirectToIndex();
             }
         }
         else if (this.Page.RouteData.Values["kekhai"] != null)
         {
             try
             {
                 int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]);
                 Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity();
                 Models.KeKhai       kekhai   = kkEntity.Find(kekhaiID);
                 if (kekhai == null)
                 {
                     this.RedirectToIndex();
                 }
             }
             catch
             {
                 this.RedirectToIndex();
             }
         }
         else
         {
             this.RedirectToIndex();
         }
     }
     else
     {
         this.RedirectToIndex();
     }
 }