public async Task <IActionResult> Edit(string id, [Bind("ThuMa,ThuTen")] Thu thu) { if (id != thu.ThuMa) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(thu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThuExists(thu.ThuMa)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(thu)); }
public Period(int period, int month, int year) { this.period = period; this.month = month; this.year = year; int s = (period == 1 ? 1 : 16), e = (period == 1 ? 15 : DateTime.DaysInMonth(year, month)); for (int c = s; c <= e; c++) { switch (new DateTime(year, month, c).DayOfWeek) { case DayOfWeek.Monday: Mon.Add(c); break; case DayOfWeek.Tuesday: Tue.Add(c); break; case DayOfWeek.Wednesday: Wed.Add(c); break; case DayOfWeek.Thursday: Thu.Add(c); break; case DayOfWeek.Friday: Fri.Add(c); break; case DayOfWeek.Saturday: Sat.Add(c); break; case DayOfWeek.Sunday: Sun.Add(c); break; } } }
// GET: THUs/Create public ActionResult Create() { Thu obj = new Thu(); obj.ThuMa = CreateID.CreateID_ByteText(); return(View(obj)); }
public ActionResult DeleteConfirmed(string id) { Thu tHU = db.Thu.Find(id); db.Thu.Remove(tHU); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ThuMa,ThuTen")] Thu tHU) { if (ModelState.IsValid) { db.Entry(tHU).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tHU)); }
public ActionResult Create([Bind(Include = "ThuMa,ThuTen")] Thu tHU) { if (ModelState.IsValid) { db.Thu.Add(tHU); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tHU)); }
public async Task <IActionResult> Create([Bind("ThuMa,ThuTen")] Thu thu) { if (ModelState.IsValid) { _context.Add(thu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(thu)); }
// GET: THUs/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Thu tHU = db.Thu.Find(id); if (tHU == null) { return(HttpNotFound()); } return(View(tHU)); }
private void DeNgiGiangDay_Load(object sender, EventArgs e) { try { Clear(); foreach (DeNghi d in deNghis) { ISingleResult <sp_ThongTinDeNghiResult> thongTin = DeNghiBUS.ThongTinDeNghi(d.BuoiHoc, d.MaPC); foreach (var i in thongTin) { Thu t = Thu.Thu2; switch (i.Ngay.DayOfWeek) { case DayOfWeek.Monday: t = Thu.Thu2; break; case DayOfWeek.Tuesday: t = Thu.Thu3; break; case DayOfWeek.Wednesday: t = Thu.Thu4; break; case DayOfWeek.Thursday: t = Thu.Thu5; break; case DayOfWeek.Friday: t = Thu.Thu6; break; case DayOfWeek.Saturday: t = Thu.Thu7; break; case DayOfWeek.Sunday: t = Thu.ChuNhat; break; } Paint((int)t, i.TietBatDau, i.SoTiet, i.MaLop, i.TenMH); } } } catch (Exception ex) { throw ex; } }
private void ThoiKhoaBieu_Load(object sender, EventArgs e) { try { Clear(); #region Vẽ các thời khóa biểu đã xếp foreach (sp_XemTKBSinhVienResult t in phieuGiangDay) { Thu th = Thu.Thu2; switch (t.Ngay.DayOfWeek) { case DayOfWeek.Monday: th = Thu.Thu2; break; case DayOfWeek.Tuesday: th = Thu.Thu3; break; case DayOfWeek.Wednesday: th = Thu.Thu4; break; case DayOfWeek.Thursday: th = Thu.Thu5; break; case DayOfWeek.Friday: th = Thu.Thu6; break; case DayOfWeek.Saturday: th = Thu.Thu7; break; case DayOfWeek.Sunday: th = Thu.ChuNhat; break; } int mode = t.CoDay ? 1 : 0; Paint(t.MaPC, t.BuoiHoc, (int)th, t.TietBatDau, t.SoTiet, t.TenMH, t.TenGV, t.MaPhong, mode, t.DiaChi); } #endregion } catch (Exception ex) { throw ex; } }
/// <summary> /// Returns true if WorkingRestrictionHoursOfWork instances are equal /// </summary> /// <param name="other">Instance of WorkingRestrictionHoursOfWork to be compared</param> /// <returns>Boolean</returns> public bool Equals(WorkingRestrictionHoursOfWork other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Mon == other.Mon || Mon != null && Mon.Equals(other.Mon) ) && ( Tue == other.Tue || Tue != null && Tue.Equals(other.Tue) ) && ( Wed == other.Wed || Wed != null && Wed.Equals(other.Wed) ) && ( Thu == other.Thu || Thu != null && Thu.Equals(other.Thu) ) && ( Fri == other.Fri || Fri != null && Fri.Equals(other.Fri) ) && ( Sat == other.Sat || Sat != null && Sat.Equals(other.Sat) ) && ( Sun == other.Sun || Sun != null && Sun.Equals(other.Sun) )); }
private void lbl0_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { string lbl = ((LinkLabel)sender).Name; if (lbl == "lbl0") { thu = Thu.Thu2; } else if (lbl == "lbl1") { thu = Thu.Thu3; } else if (lbl == "lbl2") { thu = Thu.Thu4; } else if (lbl == "lbl3") { thu = Thu.Thu5; } else if (lbl == "lbl4") { thu = Thu.Thu6; } else if (lbl == "lbl5") { thu = Thu.Thu7; } else { thu = Thu.ChuNhat; } frmNhapTKB frm = new frmNhapTKB() { NgayDauTuan = ngayDauTuan, MaPhong = maPhong, Thu = thu }; frm.TKBDangXep = this.TKBDangXep; frm.TKBs = this.TKBs; frm.truyen += new frmNhapTKB.TruyenMatKhau(ThemTKB); frm.ShowDialog(); } catch (Exception ex) { ExceptionUtil.ThrowMsgBox(ex.Message); } }
private void lblThu2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { string lbl = ((LinkLabel)sender).Name; if (lbl == "lbl0") { thu = Thu.Thu2; } else if (lbl == "lbl1") { thu = Thu.Thu3; } else if (lbl == "lbl2") { thu = Thu.Thu4; } else if (lbl == "lbl3") { thu = Thu.Thu5; } else if (lbl == "lbl4") { thu = Thu.Thu6; } else if (lbl == "lbl5") { thu = Thu.Thu7; } else { thu = Thu.ChuNhat; } frmNhapDeNghi frm = new frmNhapDeNghi() { Text = thu.ToString(), MaGV = maGV, HocKy = hocKy, NamHoc = namHoc }; frm.truyen += new frmNhapDeNghi.TruyenMatKhau(NhanDuLieu); frm.ShowDialog(); } catch (Exception ex) { ExceptionUtil.ThrowMsgBox(ex.Message); } }
private void lblThu2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { string lbl = ((LinkLabel)sender).Name; if (lbl == "lbl0") { thu = Thu.Thu2; } else if (lbl == "lbl1") { thu = Thu.Thu3; } else if (lbl == "lbl2") { thu = Thu.Thu4; } else if (lbl == "lbl3") { thu = Thu.Thu5; } else if (lbl == "lbl4") { thu = Thu.Thu6; } else if (lbl == "lbl5") { thu = Thu.Thu7; } else { thu = Thu.ChuNhat; } frmInput frm = new frmInput(); frm.Text = thu.ToString(); frm.truyen += new frmInput.TruyenMatKhau(NhanDuLieu); frm.ShowDialog(); } catch (Exception ex) { throw ex; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Mon != null) { hashCode = hashCode * 59 + Mon.GetHashCode(); } if (Tue != null) { hashCode = hashCode * 59 + Tue.GetHashCode(); } if (Wed != null) { hashCode = hashCode * 59 + Wed.GetHashCode(); } if (Thu != null) { hashCode = hashCode * 59 + Thu.GetHashCode(); } if (Fri != null) { hashCode = hashCode * 59 + Fri.GetHashCode(); } if (Sat != null) { hashCode = hashCode * 59 + Sat.GetHashCode(); } if (Sun != null) { hashCode = hashCode * 59 + Sun.GetHashCode(); } return(hashCode); } }
private void ThoiKhoaBieu_Load(object sender, EventArgs e) { try { Clear(); #region Vẽ các đề nghị foreach (sp_DeNghiTheoPhongTrongTuanResult i in thongTinhXeopTKB) { Thu t = Thu.Thu2; switch (i.Ngay.DayOfWeek) { case DayOfWeek.Monday: t = Thu.Thu2; break; case DayOfWeek.Tuesday: t = Thu.Thu3; break; case DayOfWeek.Wednesday: t = Thu.Thu4; break; case DayOfWeek.Thursday: t = Thu.Thu5; break; case DayOfWeek.Friday: t = Thu.Thu6; break; case DayOfWeek.Saturday: t = Thu.Thu7; break; case DayOfWeek.Sunday: t = Thu.ChuNhat; break; } Paint(i.MaPC, i.BuoiHoc, (int)t, i.TietBatDau, i.SoTiet, "", "", "", 0, "", ""); } #endregion #region Vẽ các thời khóa biểu đã xếp foreach (sp_ThongTinTKBResult t in TKBs) { Thu th = Thu.Thu2; switch (t.Ngay.DayOfWeek) { case DayOfWeek.Monday: th = Thu.Thu2; break; case DayOfWeek.Tuesday: th = Thu.Thu3; break; case DayOfWeek.Wednesday: th = Thu.Thu4; break; case DayOfWeek.Thursday: th = Thu.Thu5; break; case DayOfWeek.Friday: th = Thu.Thu6; break; case DayOfWeek.Saturday: th = Thu.Thu7; break; case DayOfWeek.Sunday: th = Thu.ChuNhat; break; } Paint(t.MaPC, t.BuoiHoc, (int)th, t.TietBatDau, t.SoTiet, t.TenMH, t.TenGV, t.MaLop, 2, t.MaGV, t.MaMH); } #endregion } catch (Exception ex) { throw ex; } }
public override void WriteData(HttpContext context) { context.Response.ContentType = "text/plain"; if ((context.Request["hockyid"] != null) && (context.Request["namhocid"] != null)) { int hockyid = int.Parse(context.Request["hockyid"]); int namhocid = int.Parse(context.Request["namhocid"]); // Lay nam hoc DataTable dtNamHoc = data.dnn_NuceCommon_NamHoc.getByStatus(1); DateTime dtNgayBatDau = DateTime.Parse(dtNamHoc.Rows[0]["NgayBatDau"].ToString()); // Lấy tất cả danh sách phòng máy DataTable dtTKB = data.Nuce_Eduweb.getTKB("PM"); // Lay To Dang ki DataTable dtToDK = data.Nuce_Eduweb.getToDK("PM"); // Lay tong so sinh vien dang ki DataTable dtTongSoSVDK = data.Nuce_Eduweb.getTongSoSVDK("PM"); // Lay tat ca log de check DataTable dtLog = data.dnn_NuceQLPM_Log_Syn.getByType(Utils.synTypeLichHoc, 3); // Lay ta ca cac du lieu ve can bo DataTable dtCanBo = data.Nuce_Eduweb.getCanBo("PM"); // Lay danh sach phòng máy DataTable dtPhongMay = data.dnn_NuceCommon_PhongHoc.get(-1); // Lay ca hoc DataTable dtCaHoc = data.dnn_NuceCommon_CaHoc.get(-1); // Duyệt qua tất cả các danh sách string MaDK; string MaCB; string HoVaTenCB; string Lop; string MonHoc; string Thu; int iThu; string TietBD; string SoTiet; string MaPH; int PhongHocID; int BuoiHoc; string TuanHoc; DateTime Ngay; int CahocID; int HocKyID; int NamHocID; int SoSinhVien; string TTThemCB; string MoTa; string GhiChu; string Key; DataRow drThongTinLop; string[] tuans; for (int i = 0; i < dtTKB.Rows.Count; i++) { Key = dtTKB.Rows[i]["keytohop"].ToString(); if (!checkExists(dtLog, Key)) { MaDK = dtTKB.Rows[i]["MaDK"].ToString(); MaCB = dtTKB.Rows[i]["MaCB"].ToString(); HoVaTenCB = getHoVaTenCB(dtCanBo, MaCB); drThongTinLop = getThongTinLopHoc(dtToDK, MaDK); if (drThongTinLop != null) { Lop = drThongTinLop["MaNh"].ToString(); MonHoc = drThongTinLop["TenMH"].ToString(); } else { Lop = ""; MonHoc = ""; } Thu = dtTKB.Rows[i]["Thu"].ToString(); iThu = int.Parse(Thu.Trim()); TietBD = dtTKB.Rows[i]["TietBD"].ToString(); SoTiet = dtTKB.Rows[i]["SoTiet"].ToString(); MaPH = dtTKB.Rows[i]["MaPH"].ToString(); PhongHocID = getPhong(dtPhongMay, MaPH); BuoiHoc = int.Parse(dtTKB.Rows[i]["BuoiHoc"].ToString()); TuanHoc = dtTKB.Rows[i]["TuanHoc"].ToString(); #region Xu ly tuan hoc #endregion CahocID = getCaHoc(dtCaHoc, TietBD); SoSinhVien = getSoSinhVien(dtTongSoSVDK, MaDK); TTThemCB = ""; MoTa = ""; GhiChu = "---Dong bo " + MaDK + "-" + Lop + "-" + MonHoc + "-" + HoVaTenCB + "---"; // Insert vao bang dang ki va danh dau log for (int j = 0; j < TuanHoc.Length; j++) { if (TuanHoc[j].ToString().Trim().Replace(" ", "") != "") { Ngay = dtNgayBatDau.AddDays(iThu - 2 + (j + 19) * 7); if (Ngay > DateTime.Now && Ngay < DateTime.Now.AddDays(7)) { int test = 1; } // Cap nhat vao csdl try { data.dnn_NuceQLPM_LichPhongMay.Insert(MaDK, MaCB, HoVaTenCB, Lop, MonHoc, Thu, TietBD, SoTiet, MaPH, PhongHocID, BuoiHoc, TuanHoc, Ngay, CahocID, hockyid, namhocid, SoSinhVien, TTThemCB, MoTa, GhiChu, Utils.synTypeLichHoc, 1); } catch (Exception ex) { } } } // Danh dau da duyet try { data.dnn_NuceQLPM_Log_Syn.Insert(Key, 3, Utils.synTypeLichHoc, "Dong bo thanh cong lich hoc"); } catch (Exception ex) { } } } // Dong bo lich thi CultureInfo provider = CultureInfo.InvariantCulture; provider = new CultureInfo("fr-FR"); string dtformat = "dd/MM/yyyy"; DataTable dtLichThi = data.Nuce_Eduweb.getLichThi("PM"); DataTable dtLogThi = data.dnn_NuceQLPM_Log_Syn.getByType(Utils.synTypeLichThi, 3); for (int i = 0; i < dtLichThi.Rows.Count; i++) { Key = dtLichThi.Rows[i]["KeyThi"].ToString(); if (!checkExists(dtLogThi, Key)) { MaDK = dtLichThi.Rows[i]["KeyThi"].ToString().Replace(" ", ""); MaCB = ""; HoVaTenCB = ""; Lop = dtLichThi.Rows[i]["GhepThi"].ToString().Replace(" ", ""); MonHoc = getMonHoc(dtToDK, dtLichThi.Rows[i]["MaMH"].ToString().Replace(" ", "")); Thu = ""; //iThu = int.Parse(Thu.Trim()); TietBD = dtLichThi.Rows[i]["TietBD"].ToString(); SoTiet = dtLichThi.Rows[i]["SoTiet"].ToString(); MaPH = dtLichThi.Rows[i]["MaPh"].ToString(); PhongHocID = getPhong(dtPhongMay, MaPH); BuoiHoc = int.Parse(dtLichThi.Rows[i]["DotThi"].ToString()); TuanHoc = ""; #region Xu ly tuan hoc #endregion CahocID = getCaHoc(dtCaHoc, TietBD); SoSinhVien = int.Parse(dtLichThi.Rows[i]["SoLuong"].ToString()); TTThemCB = ""; MoTa = ""; GhiChu = "---Dong bo lich thi" + MaDK + "-" + Lop + "-" + MonHoc + "-" + HoVaTenCB + "---"; // Insert vao bang dang ki va danh dau log Ngay = DateTime.ParseExact(dtLichThi.Rows[i]["NgayThi"].ToString(), dtformat, provider); // Cap nhat vao csdl try { data.dnn_NuceQLPM_LichPhongMay.Insert(MaDK, MaCB, HoVaTenCB, Lop, MonHoc, Thu, TietBD, SoTiet, MaPH, PhongHocID, BuoiHoc, TuanHoc, Ngay, CahocID, hockyid, namhocid, SoSinhVien, TTThemCB, MoTa, GhiChu, Utils.synTypeLichThi, 1); } catch (Exception ex) { } // Danh dau da duyet try { data.dnn_NuceQLPM_Log_Syn.Insert(Key, 3, Utils.synTypeLichThi, "Dong bo thanh cong lich thi"); } catch (Exception ex) { } } } context.Response.Write("1"); //http://localhost:8055/Handler/nuce.web.qlpm/DongBoDuLieu_EduWeb.ashx?hockyid=2&&namhocid=1 } else { context.Response.Write("-1"); } context.Response.Flush(); // Sends all currently buffered output to the client. context.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client. context.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. context.Response.End(); }
public bool ThemBuoiHoc(Thu thu, int tietBD, int soTiet, string monHoc, string lop, string maPC) { try { if (tietBD < 0 || tietBD > 9) { throw new Exception("Tiết bắt đầu không hợp lệ."); } if (soTiet < 1 || soTiet > 5) { throw new Exception("Số tiết không hợp lệ."); } int idBuoiHoc = idBuoiHoc = BuoiHocBUS.LayMaCuoiCung() + 1; //kiem tra co ton tai buoi hoc chua bool tonTaiBuoiHoc = false; foreach (BuoiHoc b in buoiHocs) { if (b.Ngay == ngayDauTuan.AddDays((int)thu) && b.TietBatDau == tietBD && b.SoTiet == soTiet) { idBuoiHoc = b.BuoiHoc1; tonTaiBuoiHoc = true; if (deNghis.Any(i => i.MaPC == maPC && i.BuoiHoc == idBuoiHoc)) { MsgboxUtil.Exclamation("Đã tồn tại một đề nghị như thế này rồi."); return(false); } } } //them buoi hoc if (!tonTaiBuoiHoc)//neu chua ton tai buoi hoc { buoiHocs.Add(new BuoiHoc() { BuoiHoc1 = idBuoiHoc, Ngay = ngayDauTuan.AddDays((int)thu), SoTiet = (byte)soTiet, TietBatDau = (byte)tietBD }); } //kiểm tra không cho trùng int tietKT = tietBD + soTiet - 1; DateTime ngayDangXet = ngayDauTuan.AddDays((int)thu); foreach (var i in deNghis) { BuoiHoc b = buoiHocs.Single(c => c.BuoiHoc1 == i.BuoiHoc); if (b.Ngay == ngayDangXet) { int tietKTCu = b.TietBatDau + b.SoTiet - 1; if (tietBD == b.TietBatDau) { MsgboxUtil.Exclamation("Trùng rồi bạn ơi"); return(false); } if (tietBD < b.TietBatDau && tietKT >= b.TietBatDau) { MsgboxUtil.Exclamation("Trùng rồi bạn ơi"); return(false); } if (tietBD > b.TietBatDau && tietKT <= tietKTCu) { MsgboxUtil.Exclamation("Trùng rồi bạn ơi"); return(false); } if (tietBD == tietKTCu) { MsgboxUtil.Exclamation("Trùng rồi bạn ơi"); return(false); } } } //vẽ các panel Paint((int)thu, tietBD, soTiet, lop, monHoc); deNghis.Add(new DeNghi() { BuoiHoc = idBuoiHoc, MaPC = maPC }); return(true); } catch (Exception ex) { throw ex; } }
public bool ThemBuoiHoc(Thu thu, int tietBD, int soTiet, string monHoc, string phong) { try { if (tietBD < 0 || tietBD > 9) { throw new Exception("Tiết bắt đầu không hợp lệ."); } if (soTiet < 1 || soTiet > 5) { throw new Exception("Số tiết không hợp lệ."); } //kiem tra co trung ko foreach (BuoiHoc b in buoiHocs) { if (b.Ngay == ngayDauTuan.AddDays((int)thu) && tietBD < (b.SoTiet + b.TietDB)) { return(false); } } switch (soTiet) { case 1: MotTiet motTiet = new MotTiet(); motTiet.PhongHoc = phong; motTiet.MonHoc = monHoc; motTiet.Location = new Point(XThu[(int)thu], YTiet[tietBD]); pnChinh.Controls.Add(motTiet); motTiet.BringToFront(); break; case 2: HaiTiet haiTiet = new HaiTiet(); haiTiet.PhongHoc = phong; haiTiet.MonHoc = monHoc; haiTiet.Location = new Point(XThu[(int)thu], YTiet[tietBD]); pnChinh.Controls.Add(haiTiet); haiTiet.BringToFront(); break; case 3: BaTiet baTiet = new BaTiet(); baTiet.PhongHoc = phong; baTiet.MonHoc = monHoc; baTiet.Location = new Point(XThu[(int)thu], YTiet[tietBD]); pnChinh.Controls.Add(baTiet); baTiet.BringToFront(); break; case 4: BonTiet bonTiet = new BonTiet(); bonTiet.PhongHoc = phong; bonTiet.MonHoc = monHoc; bonTiet.Location = new Point(XThu[(int)thu], YTiet[tietBD]); pnChinh.Controls.Add(bonTiet); bonTiet.BringToFront(); break; case 5: NamTiet namTiet = new NamTiet(); namTiet.PhongHoc = phong; namTiet.MonHoc = monHoc; namTiet.Location = new Point(XThu[(int)thu], YTiet[tietBD]); pnChinh.Controls.Add(namTiet); namTiet.BringToFront(); break; } buoiHocs.Add(new BuoiHoc() { Ngay = ngayDauTuan.AddDays((int)thu), SoTiet = soTiet, TietDB = tietBD }); return(true); } catch (Exception ex) { throw ex; } }