예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.RouteData.Values["tien"] != null)
     {
         this.UpdateStatus();
         _tienID = Convert.ToInt32(this.Page.RouteData.Values["tien"]);
         Models.Tien tien = _tienEntity.Find(_tienID);
         _kekhaiID = tien.KKID;
         if (!this.Page.IsPostBack)
         {
             txtNoiDung.Text = tien.TIENoiDung;
             if (tien.TIESoLuong % 1 == 0)
             {
                 txtSoLuong.Text = tien.TIESoLuong.ToString("###");
             }
             else
             {
                 txtSoLuong.Text = tien.ToString();
             }
             txtTienTe.Text = tien.TIETienTe;
         }
     }
     else
     {
         this.CreateStatus();
         _kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]);
     }
 }
예제 #2
0
 public void Delete(int _tienID)
 {
     Models.EmployeeManagementEntities db = new EmployeeManagementEntities();
     Models.Tien tien = db.Tiens.FirstOrDefault(x => x.TIEID == _tienID);
     db.Tiens.Remove(tien);
     db.SaveChanges();
     db.Dispose();
 }
예제 #3
0
 public void Update(int _tienID, decimal _soluong, string _tiente, string _noidung)
 {
     Models.EmployeeManagementEntities db = new EmployeeManagementEntities();
     Models.Tien tien = db.Tiens.FirstOrDefault(x => x.TIEID == _tienID);
     tien.TIESoLuong = _soluong;
     tien.TIETienTe  = _tiente;
     tien.TIENoiDung = _noidung;
     db.SaveChanges();
     db.Dispose();
 }
예제 #4
0
 private string ConvertSoLuong(Models.Tien _tien)
 {
     if (_tien.TIESoLuong % 1 == 0)
     {
         return(_tien.TIESoLuong.ToString("#,###"));
     }
     else
     {
         return(_tien.TIESoLuong.ToString("#,###.##"));
     }
 }
예제 #5
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["tien"] != null)
             {
                 try
                 {
                     int tienID = Convert.ToInt32(this.Page.RouteData.Values["tien"]);
                     Models.TienEntity tienEntity = new Models.TienEntity();
                     Models.Tien       tien       = tienEntity.Find(tienID);
                     if (tien == null)
                     {
                         this.RedirectToIndex();
                     }
                     else if (tien.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["tien"] != null)
         {
             try
             {
                 int tienID = Convert.ToInt32(this.Page.RouteData.Values["tien"]);
                 Models.TienEntity tienEntity = new Models.TienEntity();
                 Models.Tien       tien       = tienEntity.Find(tienID);
                 if (tien == 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();
     }
 }