/// <summary> /// Get ngay cuoi cung tong hop /// </summary> private void GetLastDate() { try { //Khởi tạo request DataTable dt = null; LDatatable.MakeParameterTable(ref dt); foreach (AutoCompleteCheckBox ChiNhanh in lstSourceChiNhanh.Where(f => f.CheckedMember == true)) { LDatatable.AddParameter(ref dt, "@MaChiNhanh", "STRING", ChiNhanh.ValueMember[INT_ZERO].ToString()); } TruyVanProcess truyVanProcess = new TruyVanProcess(); DataSet ds = truyVanProcess.TruyVanUDTT(MAX_DATE_TRANSACTION, dt); if (!ds.IsNullOrEmpty() && INT_ZERO < ds.Tables.Count && INT_ZERO < ds.Tables[INT_ZERO].Rows.Count) { raddtDenNgay.Value = LDateTime.StringToDate(ds.Tables[INT_ZERO].Rows[INT_ZERO][INT_ZERO].ToString(), ApplicationConstant.defaultDateTimeFormat); } else { raddtDenNgay.Value = DateTime.Now; } raddtTuNgay.Value = LDateTime.GetFirstDateOfMonth(raddtDenNgay.Value.GetValueOrDefault()); } catch (Exception ex) { raddtDenNgay.Value = DateTime.Now; raddtTuNgay.Value = LDateTime.GetFirstDateOfMonth(raddtDenNgay.Value.GetValueOrDefault()); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
public TDVM_TO_KE_THU() { InitializeComponent(); KhoiTaoCombobox(); raddtTuNgay.Value = LDateTime.GetFirstDateOfMonth(LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, ApplicationConstant.defaultDateTimeFormat)); raddtDenNgay.Value = LDateTime.GetLastDateOfMonth(LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, ApplicationConstant.defaultDateTimeFormat)); cmbChiNhanh.SelectionChanged += new SelectionChangedEventHandler(cmbChiNhanh_SelectionChanged); cmbPhongGD.SelectionChanged += new SelectionChangedEventHandler(cmbPhongGD_SelectionChanged); }
/// <summary> /// Kiểm tra các ngày trong tháng có phải là ngày làm việc /// </summary> /// <param name="year">Năm cần kiểm tra</param> /// <param name="month">Tháng cần kiểm tra</param> /// <returns>Trả lại danh sách theo từng ngày trong tháng chứa giá trị true là ngày làm việc, false là ngày nghỉ</returns> public List <bool> LayDSNgayLamViec(int year, int month) { // Lấy dữ liệu lịch theo tháng List <HT_LICH> listHTLich = (new DS_HT_LICH()).LayLich(year, month); // Lấy ngày đầu tháng DateTime dt = LDateTime.GetFirstDateOfMonth(year, month); List <bool> result = new List <bool>(); // Kiểm tra từng ngày trong tháng có phải là ngày làm việc //for (int i = 0; i < dt.CountDayOfMonth(); i++) result.Add(!dt.PlusDays(i).IsNotWorkingDay(listHTLich)); for (int i = 0; i < dt.CountDayOfMonth(); i++) { result.Add(!(new BS_Utilities().IsNotWorkingDay(dt.PlusDays(i), listHTLich))); } return(result); }
private void GetValuesOnForm() { DateTime dtNgayDauThang = new DateTime(); DateTime dtNgayCuoiThang = new DateTime(); int iMonth = Convert.ToDateTime(raddtThangBaoCao.Value).Month; int iYear = Convert.ToDateTime(raddtThangBaoCao.Value).Year; dtNgayDauThang = LDateTime.GetFirstDateOfMonth(iYear, iMonth); dtNgayCuoiThang = LDateTime.GetLastDateOfMonth(iYear, iMonth); machinhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First(); maphonggd = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings.First(); tungay = dtNgayDauThang.ToString(ApplicationConstant.defaultDateTimeFormat); denngay = dtNgayCuoiThang.ToString(ApplicationConstant.defaultDateTimeFormat); ngaybaocao = ClientInformation.NgayLamViecHienTai; ngonngu = lstSourceNgonNgu.ElementAt(cmbNgonNgu.SelectedIndex).KeywordStrings.First(); dinhdang = lstSourceDinhDang.ElementAt(cmbDinhDang.SelectedIndex).KeywordStrings.First(); thangbaocao = Convert.ToDateTime(raddtThangBaoCao.Value).ToString("yyyyMM"); }
public HDVO_BANG_THOP_CPHI_LAI_TGUI_CKH_THEO_PGD() { InitializeComponent(); LoadCombobox(); // Nếu người dùng là đơn vị >> disable thông tin chi nhánh if (ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_QTDV.layGiaTri()) || ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_NVDV.layGiaTri())) { cmbChiNhanh.IsEnabled = false; } else { cmbChiNhanh.IsEnabled = true; } raddtTuNgay.Value = LDateTime.GetFirstDateOfMonth(LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd")); raddtDenNgay.Value = LDateTime.GetLastDateOfMonth(LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd")); raddtNgayBaoCao.Value = DateTime.Now; }
/// <summary> /// Lấy nội dung bảng HT_LICH /// </summary> /// <param name="year">Năm cần giới hạn</param> /// <param name="month">Tháng cần giới hạn</param> /// <returns>Trả lại danh sách các dòng dữ liệu lịch</returns> public List <HT_LICH> LayLich(int year, int month) { List <HT_LICH> htLich = new List <HT_LICH>(); Entities entities = ContextFactory.GetInstance(); htLich = entities.HT_LICH.Where(lich => lich.DINH_DANG != ApplicationConstant.defaultDateTimeFormat || (lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) >= LDateTime.GetFirstDateOfMonth(year, month) && lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) <= LDateTime.GetLastDateOfMonth(year, month))).ToList(); // using (var ctx = new Entities()) //using (var ctx = ContextFactory.GetInstance()) //{ // // Lấy các dòng là lịch nghỉ, lễ hằng năm và ngày nghỉ/làm việc trong tháng nếu có // //htLich = ctx.HT_LICH.AsEnumerable().Where(lich => lich.DINH_DANG != ApplicationConstant.defaultDateTimeFormat // // || (lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) >= LDateTime.GetFirstDateOfMonth(year, month) // // && lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) <= LDateTime.GetLastDateOfMonth(year, month))).ToList(); // htLich = ctx.HT_LICH.Where(lich => lich.DINH_DANG != ApplicationConstant.defaultDateTimeFormat // || (lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) >= LDateTime.GetFirstDateOfMonth(year, month) // && lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) <= LDateTime.GetLastDateOfMonth(year, month))).ToList(); //} return(htLich); }
/// <summary> /// Lấy nội dung bảng HT_LICH /// </summary> /// <param name="year">Năm cần giới hạn</param> /// <param name="month">Tháng cần giới hạn</param> /// <returns>Trả lại danh sách các dòng dữ liệu</returns> public List <HT_LICH> LayLich(int year, int month) { List <HT_LICH> htLich = new List <HT_LICH>(); using (var ctx = new Entities()) { // Lấy tất cả các dòng là lịch nghỉ, lễ hằng năm và ngày nghỉ/làm việc cụ thể nếu có htLich = ctx.HT_LICH.AsEnumerable().Where(lich => lich.DINH_DANG != ApplicationConstant.defaultDateTimeFormat || (lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) >= LDateTime.GetFirstDateOfMonth(year, month) && lich.GIA_TRI.StringToDate(ApplicationConstant.defaultDateTimeFormat) <= LDateTime.GetLastDateOfMonth(year, month))).ToList(); } return(htLich); }