private RationViewModel BindRationViewModel(Ration ration) { var userPref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference; if (ration == null) { return(null); } var rationViewModel = new RationViewModel(); rationViewModel.RationID = ration.RationID; rationViewModel.IsDefaultRation = (bool)ration.IsDefaultRation; rationViewModel.CreatedBy = ration.CreatedBy; rationViewModel.CreatedDate = ration.CreatedDate; rationViewModel.UpdatedBy = ration.UpdatedBy; rationViewModel.UpdatedDate = ration.UpdatedDate; rationViewModel.ReferenceNumber = ration.RefrenceNumber; //rationViewModel.CreatedDateEC = ration.CreatedDate.HasValue // ? EthiopianDate.GregorianToEthiopian(ration.CreatedDate.Value) // : ""; rationViewModel.UpdatedDateEC = ration.UpdatedDate.HasValue ? EthiopianDate.GregorianToEthiopian(ration.UpdatedDate.Value) : ""; rationViewModel.DateCreated = ration.CreatedDate.ToCTSPreferedDateFormat(userPref);// RequistionDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()); return(rationViewModel); }
private void button1_Click(object sender, EventArgs e) { DateTime SelectedDate = dateTimePicker1.Value; txtEthiopianShortDate.Text = SelectedDate.ToEthiopianDateString(); txtEthiopianLongDate.Text = SelectedDate.ToEthiopianLongDateString(); txtEthiopianDate.Text = SelectedDate.ToEthiopianDateString(); txtEthiopianDateCustom.Text = SelectedDate.ToEthiopianDateString(textBox4.Text); EthiopianDate ethiopianDate = SelectedDate.ToEthiopianDate(); txtGreg.Text = ethiopianDate.ToGregorianDate().ToLongDateString(); }
public IList<Period> BuildEthiopianDate() { EthiopianDate fromDate; EthiopianDate toDate; _periods = new List<Period>(); for (int i = 1; i <= 12; i++) { fromDate = new EthiopianDate(_year, i, 01); toDate = new EthiopianDate(_year, i, 30); _periods.Add(new Period(fromDate.ToString("mmm"), fromDate.DateTime, toDate.DateTime)); } fromDate = new EthiopianDate(_year, 13, 01); toDate = new EthiopianDate(_year, 13, 5); _periods.Add(new Period(fromDate.ToString("mmm"), fromDate.DateTime, toDate.DateTime)); return _periods; }
public IList <Period> BuildEthiopianDate() { EthiopianDate fromDate; EthiopianDate toDate; _periods = new List <Period>(); for (int i = 1; i <= 12; i++) { fromDate = new EthiopianDate(_year, i, 01); toDate = new EthiopianDate(_year, i, 30); _periods.Add(new Period(fromDate.ToString("mmm"), fromDate.DateTime, toDate.DateTime)); } fromDate = new EthiopianDate(_year, 13, 01); toDate = new EthiopianDate(_year, 13, 5); _periods.Add(new Period(fromDate.ToString("mmm"), fromDate.DateTime, toDate.DateTime)); return(_periods); }
public static int ToJDN(EthiopianDate ethiopianDate) { return FromEthiopianDateToJDN(ethiopianDate.Year, ethiopianDate.Month, ethiopianDate.Day); }
public static int ToJDN(EthiopianDate ethiopianDate) { return(FromEthiopianDateToJDN(ethiopianDate.Year, ethiopianDate.Month, ethiopianDate.Day)); }
public static string ToEthiopianShortDateString(this DateTime dateTime) { var ethiopianDate = new EthiopianDate(dateTime); return ethiopianDate.ToShortDateString(); }
public static string ToEthiopianDateString(this DateTime dateTime,string format = "MMMM dd, yyyy") { var ethiopianDate = new EthiopianDate(dateTime); return ethiopianDate.ToString(format); }