private bool monthSearchCondition(object b) { Bill bill = b as Bill; String month = MonthHelper.getMonthFromInt(months_search_cb.SelectedIndex + 1); return(bill.TrafficMonth.Equals(month)); }
public ActionResult Months(int year) { var months = _periodService.GetMonths(year); var monthList = MonthHelper.GetMonth(months); return(Json(new SelectList(monthList, "Id", "Name"), JsonRequestBehavior.AllowGet)); }
/// <summary> /// Check date /// </summary> /// <param name="year"></param> /// <param name="month"></param> /// <param name="day"></param> /// <param name="dateInfo"></param> /// <exception cref="DateTimeOutOfRangeException"></exception> /// <exception cref="InvalidDateTimeException"></exception> private void CheckDate(int year, int month, int day, out DateInfo dateInfo) { if (month > 12 || month < 1) { throw new DateTimeOutOfRangeException($"The value of {month} should be between 1 and 12."); } if (!MonthHelper.DoesDayInMonth(year, month, day, out dateInfo)) { throw new InvalidDateTimeException($"Invalid date: {year}-{month}-{day}"); } }
public Bill(int id, string dispatcher, int companyId, int billNumForYear, string trafficMonth, int trafficYear, DateTime billDate, double amount) { Id = id; Dispatcher = dispatcher; Company = new Company(companyId); BillNumForYear = billNumForYear; TrafficMonth = trafficMonth; TrafficYear = trafficYear; BillDate = billDate; BillNum = billNumForYear + "-" + MonthHelper.getIntFromMonth(trafficMonth) + "-" + (trafficYear - 2000); Amount = amount; }
public HttpResponseMessage GetLimitedMonths(HttpRequestMessage request, int year) { if (DateTime.Now.Year == year) { var result = MonthHelper.GetMonthLimit(DateTime.Now.Month); return(request.CreateResponse(HttpStatusCode.OK, result)); } else { var result = MonthHelper.GetMonths(); return(request.CreateResponse(HttpStatusCode.OK, result)); } }
//LoadItems comes from Parent Class public override ObservableCollection <CustomDay> LoadItems() { { CustomMonth cm = MonthHelper.CreateMonth(DateTime.Now); ObservableCollection <CustomDay> dayList = new ObservableCollection <CustomDay>(); foreach (var item in cm.Days) { dayList.Add(item); } CustomMonthList.Add(cm); return(dayList); } }
public ActionResult Create() { ViewBag.CommodityTypes = new SelectList(_commonService.GetAllCommodityType(), "CommodityTypeID", "Name"); ViewBag.Commodities = new SelectList(_commonService.GetAllParents(), "CommodityID", "Name"); ViewBag.Donors = new SelectList(_commonService.GetAllDonors(), "DonorID", "Name"); ViewBag.Regions = new SelectList(_commonService.GetRegions(), "AdminUnitID", "Name"); ViewBag.Zones = new SelectList(Enumerable.Empty <SelectListItem>(), "AdminUnitID", "Name"); ViewBag.Woredas = new SelectList(Enumerable.Empty <SelectListItem>(), "AdminUnitID", "Name"); ViewBag.FDPS = new SelectList(Enumerable.Empty <SelectListItem>(), "FDPID", "Name"); ViewBag.Years = new SelectList(_commonService.GetYears().Select(y => new { Name = y, Id = y }), "Id", "Name"); ViewBag.Months = new SelectList(MonthHelper.GetMonthList(), "Id", "Name"); ViewBag.Transporters = new SelectList(_transporterService.GetAllTransporter().OrderBy(t => t.Name), "TransporterID", "Name"); ViewBag.Programs = new SelectList(_commonService.GetAllProgram(), "ProgramID", "Name"); ViewBag.Units = new SelectList(_commonService.GetAllUnit(), "UnitID", "Name"); return(PartialView("Create", new DispatchAllocationViewModel())); }
//Add a month to the current date and refresh the displayed calendar private void Next() { SessionManager.CurrentDate = SessionManager.CurrentDate.AddMonths(1); CustomMonth cm = (customMonthList.Where(x => x.Month == SessionManager.CurrentDate.Month && x.Year == SessionManager.CurrentDate.Year).FirstOrDefault()); if (cm == null) { cm = MonthHelper.CreateMonth(SessionManager.CurrentDate); } ObservableCollection <CustomDay> dayList = new ObservableCollection <CustomDay>(); foreach (var item in cm.Days) { dayList.Add(item); } Items = dayList; //RaisePropertyChanged is here to update the label along with the dates themselves RaisePropertyChanged(nameof(Month)); RaisePropertyChanged(nameof(Year)); dayList.Where(x => x.DayInMonth == 1).FirstOrDefault().SelectedEvent.Invoke(this, EventArgs.Empty); CustomMonthList.Add(cm); }
public static DateTime GetMemorialDayDate(int year) { return(MonthHelper.DateFromWeekdayByEnd(year, 5, DayOfWeek.Monday, 1)); }
private string GetGenerateNumber(GenerateDocNumberInput input, out DOC_NUMBER_SEQ docSeqNumberToInsertOrUpdate) { var lastSeqData = _repository.Get(c => c.FORM_TYPE_ID != Enums.FormType.CK5).FirstOrDefault(); if (lastSeqData == null) { //insert new record lastSeqData = new DOC_NUMBER_SEQ() { YEAR = input.Year, MONTH = input.Month, DOC_NUMBER_SEQ_LAST = 1 }; } else { lastSeqData.DOC_NUMBER_SEQ_LAST += 1; } //var docNumber = lastSeqData.DOC_NUMBER_SEQ_LAST.ToString();//log : 2015-10-12 var docNumber = lastSeqData.DOC_NUMBER_SEQ_LAST.ToString("0000000000"); //log : 2015-1013 if (input.FormType != Enums.FormType.CK5) { //var t001Data = // _t001KReporRepository.Get( // c => // (c.T001W.NPPBKC_ID == input.NppbkcId || c.T001W.NPPBKC_IMPORT_ID == input.NppbkcId) && c.T001W.IS_MAIN_PLANT.HasValue && // c.T001W.IS_MAIN_PLANT.Value, null, "T001, T001W, T001W.ZAIDM_EX_NPPBKC").FirstOrDefault(); //2016-07-12 ////http://tp.voxteneo.co.id/entity/8347 var t001Data = _t001KReporRepository.Get( c => (c.T001W.NPPBKC_ID == input.NppbkcId || c.T001W.NPPBKC_IMPORT_ID == input.NppbkcId), null, "T001, T001W, T001W.ZAIDM_EX_NPPBKC").FirstOrDefault(); if (t001Data == null || t001Data.T001 == null) { throw new BLLException(ExceptionCodes.BLLExceptions.GenerateNumberCompanyDataHasNotSet); } if (string.IsNullOrEmpty(t001Data.T001.BUTXT_ALIAS)) { throw new BLLException(ExceptionCodes.BLLExceptions.GenerateNumberCompanyAliasHasNotSet); } if (t001Data.T001W == null || t001Data.T001W.ZAIDM_EX_NPPBKC == null) { throw new BLLException(ExceptionCodes.BLLExceptions.GenerateNumberPlantDataHasNotSet); } if (string.IsNullOrEmpty(t001Data.T001W.ZAIDM_EX_NPPBKC.CITY_ALIAS)) { throw new BLLException(ExceptionCodes.BLLExceptions.GenerateNumberCityAliasHasNotSet); } //generate number docNumber = docNumber + "/" + t001Data.T001.BUTXT_ALIAS + "/" + t001Data.T001W.ZAIDM_EX_NPPBKC.CITY_ALIAS + "/" + MonthHelper.ConvertToRomansNumeral(input.Month) + "/" + input.Year; } docSeqNumberToInsertOrUpdate = lastSeqData; return docNumber; }
public ActionResult ExpDocumentExportFilePdf(string productSeriesId, Guid id) { string name = $"Заключение о безопасности и качества.pdf"; var serieId = Convert.ToInt32(productSeriesId); var expDocument = db.OBK_StageExpDocument.FirstOrDefault(o => o.ProductSeriesId == serieId); StiReport report = new StiReport(); try { var declaration = db.OBK_AssessmentDeclaration.FirstOrDefault(o => o.Id == id); var applicationBlankNumber = expDocument.ExpApplicationNumber != null ? expDocument.ExpApplicationNumber : ""; if (applicationBlankNumber.Length < 6) { for (int c = applicationBlankNumber.Length; c < 6; c++) { applicationBlankNumber = "0" + applicationBlankNumber; } } if (CodeConstManager.OBK_SA_SERIAL.Equals(declaration.TypeId.ToString())) { if (expDocument.ExpApplication == false) { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentApplicationSerialPdf.mrt")); } else { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentSerialPdf.mrt")); } var tail = " согласно приложения КЗП № {" + applicationBlankNumber + "}, серийная"; var dictionary = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameRu + " серийный выпуск", 90, 120, 150, expDocument.ExpProductShortNameRu, tail); report.Dictionary.Variables["ProductNameRu1"].ValueObject = dictionary.ContainsKey(1) ? dictionary[1] : ""; report.Dictionary.Variables["ProductNameRu2"].ValueObject = dictionary.ContainsKey(2) ? dictionary[2] : ""; report.Dictionary.Variables["ProductNameRu3"].ValueObject = dictionary.ContainsKey(3) ? dictionary[3] : ""; var tailKaz = " ҚҚҚ № {" + applicationBlankNumber + "} қосымшаға сәйкес, сериялы шыгарылым"; var dictionaryKaz = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameKz + " сериялық", 60, 120, 150, expDocument.ExpProductShortNameKz, tailKaz); report.Dictionary.Variables["ProductNameKz1"].ValueObject = dictionaryKaz.ContainsKey(1) ? dictionaryKaz[1] : ""; report.Dictionary.Variables["ProductNameKz2"].ValueObject = dictionaryKaz.ContainsKey(2) ? dictionaryKaz[2] : ""; report.Dictionary.Variables["ProductNameKz3"].ValueObject = dictionaryKaz.ContainsKey(3) ? dictionaryKaz[3] : ""; report.Dictionary.Variables["productSeriesId"].ValueObject = serieId; var reportOp = db.OBK_AssessmentReportOP.FirstOrDefault(o => o.DeclarationId == id); if (reportOp != null) { var opExecutor = db.OBK_AssessmentReportOPExecutors.OrderByDescending(o => o.Date).FirstOrDefault(o => o.ReportId == reportOp.Id); if (opExecutor != null && opExecutor.Date != null) { report.Dictionary.Variables["OpExecutorDate"].ValueObject = ((DateTime)opExecutor.Date).ToString("dd.MM.yyyy"); } } } else if (CodeConstManager.OBK_SA_PARTY.Equals(declaration.TypeId.ToString())) { if (expDocument.ExpApplication == false) { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentApplicationPartyPdf.mrt")); } else { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentPartyPdf.mrt")); } var tail = " согласно приложения КЗП № {" + applicationBlankNumber + "}"; var dictionary = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameRu, 90, 120, 170, expDocument.ExpProductShortNameRu, tail); report.Dictionary.Variables["ProductNameRu1"].ValueObject = dictionary.ContainsKey(1) ? dictionary[1] : ""; report.Dictionary.Variables["ProductNameRu2"].ValueObject = dictionary.ContainsKey(2) ? dictionary[2] : ""; report.Dictionary.Variables["ProductNameRu3"].ValueObject = dictionary.ContainsKey(3) ? dictionary[3] : ""; var tailKaz = " ҚҚҚ № {" + applicationBlankNumber + "} қосымшаға сәйкес"; var dictionaryKaz = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameKz, 60, 120, 160, expDocument.ExpProductShortNameKz, tailKaz); report.Dictionary.Variables["ProductNameKz1"].ValueObject = dictionaryKaz.ContainsKey(1) ? dictionaryKaz[1] : ""; report.Dictionary.Variables["ProductNameKz2"].ValueObject = dictionaryKaz.ContainsKey(2) ? dictionaryKaz[2] : ""; report.Dictionary.Variables["ProductNameKz3"].ValueObject = dictionaryKaz.ContainsKey(3) ? dictionaryKaz[3] : ""; report.Dictionary.Variables["productSeriesId"].ValueObject = serieId; } else { if (expDocument.ExpApplication == false) { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentApplicationPdf.mrt")); } else { report.Load(Server.MapPath("~/Reports/Mrts/OBKExpDocumentPdf.mrt")); } var tail = " согласно приложения КЗП № {" + applicationBlankNumber + "}"; var dictionary = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameRu, 90, 120, 170, expDocument.ExpProductShortNameRu, tail); report.Dictionary.Variables["ProductNameRu1"].ValueObject = dictionary.ContainsKey(1) ? dictionary[1] : ""; report.Dictionary.Variables["ProductNameRu2"].ValueObject = dictionary.ContainsKey(2) ? dictionary[2] : ""; report.Dictionary.Variables["ProductNameRu3"].ValueObject = dictionary.ContainsKey(3) ? dictionary[3] : ""; var tailKaz = " ҚҚҚ № {" + applicationBlankNumber + "} қосымшаға сәйкес"; var dictionaryKaz = ZBKSpaceHelper.BuildName(expDocument.ExpProductNameKz, 60, 120, 160, expDocument.ExpProductShortNameKz, tailKaz); report.Dictionary.Variables["ProductNameKz1"].ValueObject = dictionaryKaz.ContainsKey(1) ? dictionaryKaz[1] : ""; report.Dictionary.Variables["ProductNameKz2"].ValueObject = dictionaryKaz.ContainsKey(2) ? dictionaryKaz[2] : ""; report.Dictionary.Variables["ProductNameKz3"].ValueObject = dictionaryKaz.ContainsKey(3) ? dictionaryKaz[3] : ""; } foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["StageExpDocumentId"].ValueObject = Convert.ToInt32(productSeriesId); report.Dictionary.Variables["AssessmentDeclarationId"].ValueObject = id; report.Dictionary.Variables["StartMonthRu"].ValueObject = MonthHelper.getMonthRu(expDocument.ExpStartDate); report.Dictionary.Variables["StartMonthKz"].ValueObject = MonthHelper.getMonthKz(expDocument.ExpStartDate); if (expDocument.ExpEndDate != null) { expDocument.ExpEndDate = ((DateTime)expDocument.ExpEndDate).AddMonths(1); } report.Dictionary.Variables["EndMonthRu"].ValueObject = MonthHelper.getMonthRu(expDocument.ExpEndDate); report.Dictionary.Variables["EndMonthKz"].ValueObject = MonthHelper.getMonthKz(expDocument.ExpEndDate); report.Dictionary.Variables["addInfo"].ValueObject = assessmentRepo.FormExpAdditionalInfo(declaration); report.Dictionary.Variables["addInfoKz"].ValueObject = assessmentRepo.FormExpAdditionalInfo(declaration, true); report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } var stream = new MemoryStream(); report.ExportDocument(StiExportFormat.Pdf, stream); stream.Position = 0; return(File(stream, "application/pdf", name)); }
public HttpResponseMessage GetMonths(HttpRequestMessage request) { var result = MonthHelper.GetMonths(); return(request.CreateResponse(HttpStatusCode.OK, result)); }
public void GenerateNumber_WhenValidInput_GenerateDocumentNumber() { //arr var docNumberSeq = new DOC_NUMBER_SEQ() { MONTH = 1, YEAR = 2015, DOC_NUMBER_SEQ_LAST = 1 }; var t001k = new T001K() { T001 = new T001() { BUTXT = "Philip Morris Indonesia", BUTXT_ALIAS = "HMS-E", BUKRS = "3006" }, T001W = new T001W() { ZAIDM_EX_NPPBKC = new ZAIDM_EX_NPPBKC() { CITY_ALIAS = "SBY" } } }; var input = new GenerateDocNumberInput() { Month = 1, Year = 1, NppbkcId = "1" }; _repository.Get().ReturnsForAnyArgs(new List <DOC_NUMBER_SEQ>() { docNumberSeq }); _t001KReporRepository.Get().ReturnsForAnyArgs(new List <T001K> { t001k }); string expectedResult = (docNumberSeq.DOC_NUMBER_SEQ_LAST + 1).ToString("0000000000") + "/" + t001k.T001.BUTXT_ALIAS + "/" + t001k.T001W.ZAIDM_EX_NPPBKC.CITY_ALIAS + "/" + MonthHelper.ConvertToRomansNumeral(input.Month) + "/" + input.Year.ToString(); //act var result = _bll.GenerateNumber(input); //assert Assert.AreEqual(expectedResult, result); }
public static DateTime GetWashingtonBirthdayDate(int year) { return(MonthHelper.DateFromWeekday(year, 2, DayOfWeek.Monday, 3)); }
public static DateTime GetMartinLutherKingBirthdayDate(int year) { return(MonthHelper.DateFromWeekday(year, 1, DayOfWeek.Monday, 3)); }
public static DateTime GetThanksGivingDayDate(int year) { return(MonthHelper.DateFromWeekday(year, 11, DayOfWeek.Thursday, 4)); }
public static DateTime GetColumbusDayDate(int year) { return(MonthHelper.DateFromWeekday(year, 10, DayOfWeek.Monday, 2)); }
public static DateTime GetLaborDayDate(int year) { return(MonthHelper.DateFromWeekday(year, 9, DayOfWeek.Monday, 1)); }