public static HtmlString DayMonthYearFor(this IHtmlHelper html, string name, DayMonthYear model) { return(new HtmlString("<div class='divDMY'>" + html.DropDownList(name + ".Day", new SelectList(DayList, "Id", "Text", model.Day), new { @class = "DMY-day input-sm" }) + html.DropDownList(name + ".Month", new SelectList(MonthList, "Id", "Text", model.Month), new { @class = "DMY-month input-sm" }) + html.DropDownList(name + ".Year", new SelectList(YearList, "Id", "Text", model.Year), new { @class = "DMY-year input-sm" }) + "</div>" )); }
private void ChangePanel(DayMonthYear dayMonthYear) { switch (dayMonthYear) { case DayMonthYear.Day: BtnIncMonth.Visibility = Visibility.Visible; BtnDecMonth.Visibility = Visibility.Visible; InitDayPanel(SelectedDate.Year, SelectedDate.Month); if (_currentPosition == DayMonthYear.Year) { _storyboard_yeartoMonth.Begin(); _storyboard_monthtoDay.Begin(); } if (_currentPosition == DayMonthYear.Month) { _storyboard_monthtoDay.Begin(); } BtnMonthYear.Content = $"{CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(SelectedDate.Month)} {SelectedDate.Year}"; break; case DayMonthYear.Month: BtnIncMonth.Visibility = Visibility.Visible; BtnDecMonth.Visibility = Visibility.Visible; InitMonthPanel(SelectedDate.Year); if (_currentPosition == DayMonthYear.Year) { _storyboard_yeartoMonth.Begin(); } if (_currentPosition == DayMonthYear.Day) { _storyboard_daytoMonth.Begin(); } BtnMonthYear.Content = $"{SelectedDate.Year}"; break; case DayMonthYear.Year: BtnIncMonth.Visibility = Visibility.Collapsed; BtnDecMonth.Visibility = Visibility.Collapsed; InitYearPanel(SelectedDate.Year); if (_currentPosition == DayMonthYear.Day) { _storyboard_daytoMonth.Begin(); _storyboard_monthtoYear.Begin(); } if (_currentPosition == DayMonthYear.Month) { _storyboard_monthtoYear.Begin(); } BtnMonthYear.Content = $"{SelectedDate.Year - 7} - {SelectedDate.Year + 7}"; break; } CheckButtonVisible(); _currentPosition = dayMonthYear; }
public ActionResult Registor() { var Thangs = new SelectList( new List <SelectListItem> { new SelectListItem { Text = "Tháng một", Value = "1" }, new SelectListItem { Text = "Tháng hai", Value = "2" }, new SelectListItem { Text = "Tháng ba", Value = "3" }, new SelectListItem { Text = "Tháng bốn", Value = "4" }, new SelectListItem { Text = "Tháng năm", Value = "5" }, new SelectListItem { Text = "Tháng sáu", Value = "6" }, new SelectListItem { Text = "Tháng bảy", Value = "7" }, new SelectListItem { Text = "Tháng tám", Value = "8" }, new SelectListItem { Text = "Tháng chín", Value = "9" }, new SelectListItem { Text = "Tháng mười", Value = "10" }, new SelectListItem { Text = "Tháng mười một", Value = "11" }, new SelectListItem { Text = "Tháng mười hai", Value = "12" } }, "Value", "Text"); ViewBag.Ngay = DayMonthYear.GetNgays(); ViewBag.Thang = Thangs; ViewBag.Nam = DayMonthYear.GetNams(); var Customer = new Customer(); return(View(Customer)); }
private bool CheckDateLimit(DateTime date, DayMonthYear limitCompareMode) { date = date.Date; var result = true; if (MaxDate != null) { var maxDate = ((DateTime)MaxDate).Date; switch (limitCompareMode) { case DayMonthYear.Day: result = date.Date <= maxDate.Date; break; case DayMonthYear.Month: result = date.Year < maxDate.Year ? true : (date.Year == maxDate.Year ? (date.Month <= maxDate.Month) : false); break; case DayMonthYear.Year: result = date.Year <= maxDate.Year; break; } } if (result && MinDate != null) { var minDate = ((DateTime)MinDate).Date; switch (limitCompareMode) { case DayMonthYear.Day: result = date >= minDate; break; case DayMonthYear.Month: result = date.Year > minDate.Year ? true : (date.Year == minDate.Year ? (date.Month >= minDate.Month) : false); break; case DayMonthYear.Year: result = date.Year >= minDate.Year; break; } } return(result); }
public ActionResult Registor(Customer customer) { KHACHHANG KhachHang = new KHACHHANG(); var CheckEmail = db.KHACHHANGs.Where(x => x.Email == customer.Email).ToList(); var CheckPhone = db.KHACHHANGs.Where(x => x.SoDienThoai == customer.SoDienThoai).ToList(); if (ModelState.IsValid) { if (CheckEmail.Count > 0) { ModelState.AddModelError("Email", "Email của bạn đã tồn tại"); } if (CheckPhone.Count > 0) { ModelState.AddModelError("SoDienThoai", "Số điện thoại của bạn tồn tại"); } if (CheckEmail.Count == 0 && CheckPhone.Count == 0) { var ngay = customer.Ngay.ToString(); var thang = customer.Thang.ToString(); if (customer.Ngay < 10) { ngay = '0' + customer.Ngay.ToString(); } if (customer.Thang < 10) { thang = '0' + customer.Thang.ToString(); } var thoigian = ngay + "/" + thang + "/" + customer.Nam; KhachHang = new KHACHHANG { TenKhachHang = customer.TenKhachHang, DiaChi = customer.DiaChi, SoDienThoai = customer.SoDienThoai, Email = customer.Email, PassWord = Helper.GenHash.GenSHA1(customer.PassWord), Id_LoaiKhachHang = 2 }; if (thoigian != " ") { KhachHang.NgaySinh = DateTime.ParseExact(thoigian, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); } // tổng chi +1, // dfsdfsd var aNewKhachHang = db.KHACHHANGs.Add(KhachHang); KhachHang.Id_KhachHang = aNewKhachHang.Id_KhachHang; DIACHI DiaChi = new DIACHI() { Id_KhachHang = aNewKhachHang.Id_KhachHang, SoDienThoai = aNewKhachHang.SoDienThoai, TenKhachHang = aNewKhachHang.TenKhachHang, DiaChi = aNewKhachHang.DiaChi, TrangThai = true }; db.DIACHIs.Add(DiaChi); db.SaveChanges(); return(RedirectToAction("Index", "Homepage")); } } var Thangs = new SelectList( new List <SelectListItem> { new SelectListItem { Text = "Tháng một", Value = "1" }, new SelectListItem { Text = "Tháng hai", Value = "2" }, new SelectListItem { Text = "Tháng ba", Value = "3" }, new SelectListItem { Text = "Tháng bốn", Value = "4" }, new SelectListItem { Text = "Tháng năm", Value = "5" }, new SelectListItem { Text = "Tháng sáu", Value = "6" }, new SelectListItem { Text = "Tháng bảy", Value = "7" }, new SelectListItem { Text = "Tháng tám", Value = "8" }, new SelectListItem { Text = "Tháng chín", Value = "9" }, new SelectListItem { Text = "Tháng mười", Value = "10" }, new SelectListItem { Text = "Tháng một", Value = "11" }, new SelectListItem { Text = "Tháng hai", Value = "12" } }, "Value", "Text"); ViewBag.Ngay = DayMonthYear.GetNgays(); ViewBag.Thang = Thangs; ViewBag.Nam = DayMonthYear.GetNams(); return(View(customer)); }