示例#1
0
 protected void btnTinhSoNgayPhep_Click(object sender, DirectEventArgs e)
 {
     try
     {
         HeThongController          system     = new HeThongController();
         DanhSachNgayPhepController controller = new DanhSachNgayPhepController();
         DAL.DanhSachNgayPhep       ngayPhep   = new DanhSachNgayPhep()
         {
             Nam                = DateTime.Now.Year,
             CreatedBy          = CurrentUser.ID,
             SoNgayPhepNamNay   = string.IsNullOrEmpty(nbfSoNgayPhep.Text) ? 0 : int.Parse(nbfSoNgayPhep.Text),
             SoNgayPhepNamTruoc = 0,
             SoNgayPhepDuocThem = string.IsNullOrEmpty(nbfSoNgayPhepThuongThem.Text) ? 0 : int.Parse(nbfSoNgayPhepThuongThem.Text),
             SoNgayPhepCongDonToiDaTrongThang = int.Parse(nbfSoNgayPhepCongDonToiDaTrong1Thang.Text),
             CreatedDate = DateTime.Now,
         };
         if (ngayPhep.SoNgayPhepDuocThem != 0)
         {
             ngayPhep.ThoiHanSuDungNgayPhepDuocThem = dfHanDungNgayPhepThuongThem.SelectedDate;
         }
         if (ngayPhep.SoNgayPhepNamTruoc != 0)
         {
             ngayPhep.ThoiHanSuDungNgayPhepNamTruoc = dfHanDungNgayPhepNamTruoc.SelectedDate;
         }
         if (rdApDungChoTatCaNhanVien.Checked)
         {
             controller.TinhSoNgayPhep(ngayPhep, Session["MaDonVi"].ToString());
         }
         //else if (rdChiNhungNhanVienDuocChon.Checked)
         //{
         //    foreach (var item in RowSelectionModel1.SelectedRows)
         //    {
         //        controller.TinhSoNgayPhep(ngayPhep, int.Parse(item.RecordID));
         //    }
         //}
         wdTinhSoNgayPhep.Hide();
         //   GridPanel1.Reload();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
示例#2
0
 protected void btnOKDieuChinhNgayPhep_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DanhSachNgayPhepController controller = new DanhSachNgayPhepController();
         foreach (var item in RowSelectionModelNgayPhep.SelectedRows)
         {
             DAL.DanhSachNgayPhep obj = new DanhSachNgayPhep()
             {
                 ID = int.Parse(item.RecordID),
                 SoNgayPhepNamTruoc = double.Parse("0" + nbfDieuChinhSoNPNamTruoc.Text.Replace('.', ',')),
                 Thang1             = double.Parse("0" + nbfThang1.Text.Replace('.', ',')),
                 Thang2             = double.Parse("0" + nbfThang2.Text.Replace('.', ',')),
                 Thang3             = double.Parse("0" + nbfThang3.Text.Replace('.', ',')),
                 Thang4             = double.Parse("0" + nbfThang4.Text.Replace('.', ',')),
                 Thang5             = double.Parse("0" + nbfThang5.Text.Replace('.', ',')),
                 Thang6             = double.Parse("0" + nbfThang6.Text.Replace('.', ',')),
                 Thang7             = double.Parse("0" + nbfThang7.Text.Replace('.', ',')),
                 Thang8             = double.Parse("0" + nbfThang8.Text.Replace('.', ',')),
                 Thang9             = double.Parse("0" + nbfThang9.Text.Replace('.', ',')),
                 Thang10            = double.Parse("0" + nbfThang10.Text.Replace('.', ',')),
                 Thang11            = double.Parse("0" + nbfThang11.Text.Replace('.', ',')),
                 Thang12            = double.Parse("0" + nbfThang12.Text.Replace('.', ',')),
                 SoNgayPhepNamNay   = double.Parse("0" + nbfDieuChinhNgayPhepNamNay.Text.Replace('.', ',')),
                 SoNgayPhepDuocThem = double.Parse("0" + nbfDieuChinhNgayPhepDuocThem.Text.Replace('.', ','))
             };
             if (!SoftCore.Util.GetInstance().IsDateNull(dfHanDungPhep.SelectedDate))
             {
                 obj.ThoiHanSuDungNgayPhepNamTruoc = dfHanDungPhep.SelectedDate;
             }
             controller.UpdateNgayPhep(obj);
         }
         grpDanhSachNgayPhep.Reload();
         wdDieuChinhNgayPhep.Hide();
     }
     catch (Exception ex)
     {
         X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }