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); }
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; }
private void GetFormData() { string maChiNhanh = string.Empty; string tenChiNhanh = string.Empty; maChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First(); tenChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).DisplayName; lstMaPhongGiaoDich = new List <string>(); foreach (AutoCompleteCheckBox PhongGD in lstSourcePhongGD.Where(e => e.CheckedMember == true)) { lstMaPhongGiaoDich.Add(PhongGD.ValueMember.FirstOrDefault()); } DateTime thang = new DateTime(); if (raddtThang.Value is DateTime) { thang = (DateTime)raddtThang.Value; } DateTime ngayBaoCao = new DateTime(); if (raddtNgayBaoCao.Value is DateTime) { ngayBaoCao = (DateTime)raddtNgayBaoCao.Value; } string maNgonNgu = lstSourceNgonNgu.ElementAt(cmbNgonNgu.SelectedIndex).KeywordStrings.First(); string maDinhDang = lstSourceDinhDang.ElementAt(cmbDinhDang.SelectedIndex).KeywordStrings.First(); // Gán dữ liệu từ form vào các biến truyền cho báo cáo MaChiNhanh = maChiNhanh; TenChiNhanh = tenChiNhanh; TuNgay = (raddtThang.Value is DateTime) ? thang.ToString("yyyyMM") + "01" : ""; DenNgay = (raddtThang.Value is DateTime) ? thang.ToString("yyyyMM") + LDateTime.GetLastDateOfMonth(thang).ToString("dd") : ""; TuThoiHan = (!LObject.IsNullOrEmpty(nudTuThang.Value)) ? LNumber.StringToInt32(nudTuThang.Value.ToString()).ToString() : ""; DenThoiHan = (!LObject.IsNullOrEmpty(nudDenThang.Value)) ? LNumber.StringToInt32(nudDenThang.Value.ToString()).ToString() : ""; NgayBaoCao = (raddtNgayBaoCao.Value is DateTime) ? ngayBaoCao.ToString("yyyyMMdd") : ""; MaNguoiLap = ClientInformation.TenDangNhap; TenNguoiLap = ClientInformation.HoTen; MaNgonNgu = maNgonNgu; MaDinhDang = maDinhDang; }
private void GetFormData() { string maChiNhanh = string.Empty; string tenChiNhanh = string.Empty; maChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First(); tenChiNhanh = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).DisplayName; string maPhongGiaoDich = string.Empty; string tenPhongGiaoDich = string.Empty; if (lstSourcePhongGD_Select.Count > 0) { maPhongGiaoDich = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).KeywordStrings.First(); tenPhongGiaoDich = lstSourcePhongGD_Select.ElementAt(cmbPhongGD.SelectedIndex).DisplayName; } MaDonVi = (MaPhongGiaoDich.IsNullOrEmpty() || maPhongGiaoDich.Equals("%")) ? maChiNhanh : maPhongGiaoDich; DateTime tuNgay = new DateTime(); if (raddtTuNgay.Value is DateTime) { tuNgay = (DateTime)raddtTuNgay.Value; } DateTime denNgay = new DateTime(); if (raddtDenNgay.Value is DateTime) { denNgay = (DateTime)raddtDenNgay.Value; } DateTime ngayBaoCao = new DateTime(); if (raddtNgayBaoCao.Value is DateTime) { ngayBaoCao = (DateTime)raddtNgayBaoCao.Value; } string maNgonNgu = lstSourceNgonNgu.ElementAt(cmbNgonNgu.SelectedIndex).KeywordStrings.First(); string maDinhDang = lstSourceDinhDang.ElementAt(cmbDinhDang.SelectedIndex).KeywordStrings.First(); // Gán dữ liệu từ form vào các biến truyền cho báo cáo MaChiNhanh = maChiNhanh; TenChiNhanh = tenChiNhanh; MaPhongGiaoDich = maPhongGiaoDich; TenPhongGiaoDich = tenPhongGiaoDich; TuNgay = (raddtTuNgay.Value is DateTime) ? tuNgay.ToString("yyyyMM") + "01" : ""; DenNgay = (raddtDenNgay.Value is DateTime) ? denNgay.ToString("yyyyMM") + LDateTime.GetLastDateOfMonth(denNgay).ToString("dd") : ""; NgayBaoCao = (raddtNgayBaoCao.Value is DateTime) ? ngayBaoCao.ToString("yyyyMMdd") : ""; MaNguoiLap = ClientInformation.TenDangNhap; TenNguoiLap = ClientInformation.HoTen; MaNgonNgu = maNgonNgu; MaDinhDang = maDinhDang; }
/// <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); }