public string DiemDanh(string ScheduleID, string StudentID, string StudentStatusID, string StudyRecord, string CoPhep) { int result = -1; try { ThuVien tv = new ThuVien(); result = tv.SP_ExcecutePro("USP_Student_FurloughProcess", new string[] { "@ScheduleID", "@StudentID", "@StudentStatusID", "@StudyRecord", "@CoPhep", "@ModifyPeopleID" }, new object[] { ScheduleID, StudentID, StudentStatusID, StudyRecord, CoPhep, HttpContext.Current.Session["loginPeopleID"] }); } catch (Exception ex) { result = -1; //Gửi email báo lỗi SGmail sendEmail = new SGmail(); sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi Quản lý học viên", ex.ToString(), true); } if (result == 0) { return "Không thành công, vui lòng báo trung tâm"; } else if (result > 0) { return "Thao tác thành công"; } else if (HttpContext.Current.Session["PeopleCode"] + "" == "") return "Lỗi từ phía server làm session bị mất. Chỉ còn cách login lại"; else return "Lỗi chưa xác định. result: " + result.ToString() + " USP_Student_FurloughProcess"; }
public List<Branch_Model> GetListTrungTam() { List<Branch_Model> rs = new List<Branch_Model>(); ThuVien tv = new ThuVien(); try { DataTable tbBranch = tv.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" }); if (tbBranch.Rows.Count > 0) { for (int i = 0; i < tbBranch.Rows.Count; i++) { Branch_Model bmodel = new Branch_Model(); bmodel.BranchID = tbBranch.Rows[i]["BranchID"].ToString(); bmodel.BranchName = tbBranch.Rows[i]["BranchName"].ToString(); rs.Add(bmodel); } } } catch (Exception ex) { throw (ex); } return rs; }
public List<cAdMin_DMObject_Model> GetDMObject(string PeopleID) { List<cAdMin_DMObject_Model> rs = new List<cAdMin_DMObject_Model>(); ThuVien tv = new ThuVien(); try { DataTable tbDMObject = tv.SP_SelectDataTable("USP_DMObject_GetByID", new string[] { "@PeopleID" }, new object[] { PeopleID }); if (tbDMObject.Rows.Count > 0) { for (int i = 0; i < tbDMObject.Rows.Count; i++) { cAdMin_DMObject_Model omodel = new cAdMin_DMObject_Model(); //omodel.PeopleID = tbDMObject.Rows[i]["PeopleID"].ToString(); //omodel.PeopleName = tbDMObject.Rows[i]["PeopleName"].ToString(); omodel.ObjectCode = tbDMObject.Rows[i]["ObjectCode"].ToString(); omodel.ParentObjectCode = tbDMObject.Rows[i]["ParentObjectCode"].ToString(); //omodel.Level = tbDMObject.Rows[i]["Level"].ToString(); //omodel.GroupName = tbDMObject.Rows[i]["GroupName"].ToString(); //omodel.ModifyPeopleID = tbDMObject.Rows[i]["ModifyPeopleID"].ToString(); rs.Add(omodel); } } } catch (Exception ex) { throw (ex); } return rs; }
public List<People_Model> GetListGiaoVien(string BranchID) { List<People_Model> rs = new List<People_Model>(); ThuVien tv = new ThuVien(); try { DataTable tbBranch = tv.SP_SelectDataTable("USP_People_GetBySomeConditional", new string[] { "@flag", "@PeopleCode", "@BranchID" }, new object[] { 4,"GV", BranchID }); if (tbBranch.Rows.Count > 0) { for (int i = 0; i < tbBranch.Rows.Count; i++) { People_Model pmodel = new People_Model(); pmodel.PeopleID = tbBranch.Rows[i]["TeacherID"].ToString(); pmodel.PeopleName = tbBranch.Rows[i]["PeopleName"].ToString(); //pmodel.PeopleCode = tbBranch.Rows[i]["PeopleCode"].ToString(); rs.Add(pmodel); } } } catch (Exception ex) { throw (ex); } return rs; }
public ActionResult DoLogin(DangNhapModel m, string RedirectUrl, string subdomain) { if (ModelState.IsValid) { var matKhau = ThuVien.MaHoa_MD5(m.TaiKhoan_MatKhau).ToLower(); string SercurityAll = System.Configuration.ConfigurationManager.AppSettings["SercurityAll"].ToLower(); TBL_TAIKHOAN TaiKhoan = _connection.ThongTinDangNhap(m.TaiKhoan_DangNhap.Trim(), matKhau, SercurityAll); if (TaiKhoan != null) { var taikhoan_login = new DangNhapModel { TaiKhoan_ID = TaiKhoan.TaiKhoan_ID, TaiKhoan_PhongBan_ID = TaiKhoan.TaiKhoan_PhongBan_ID, TaiKhoan_NhomQuyen_ID = TaiKhoan.TaiKhoan_NhomQuyen_ID, TaiKhoan_ViTri_ID = TaiKhoan.TaiKhoan_ViTri_ID, TaiKhoan_DangNhap = TaiKhoan.TaiKhoan_DangNhap, TaiKhoan_HoTen = TaiKhoan.TaiKhoan_HoTen, TaiKhoan_Email = TaiKhoan.TaiKhoan_Email, TaiKhoan_SoDienThoai = TaiKhoan.TaiKhoan_SoDienThoai, TaiKhoan_AnhDaiDien = TaiKhoan.TaiKhoan_AnhDaiDien, TaiKhoan_TrangThai = TaiKhoan.TaiKhoan_TrangThai, }; var json = Newtonsoft.Json.JsonConvert.SerializeObject(taikhoan_login); // create encryption cookie FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, json, DateTime.Now, DateTime.Now.AddDays(90), true, string.Empty); // add cookie to response stream string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); if (authTicket.IsPersistent) { authCookie.Expires = authTicket.Expiration; } System.Web.HttpContext.Current.Response.Cookies.Add(authCookie); string backurl = Request.QueryString["backurl"]; if (!string.IsNullOrEmpty(RedirectUrl)) { RedirectUrl = Uri.UnescapeDataString(RedirectUrl); return(Redirect(Server.UrlDecode(RedirectUrl))); } else if (string.IsNullOrEmpty(backurl)) { backurl = "/"; } return(Json(new { Sucess = true, Errors = ModelState.Errors(), Url = backurl }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Sucess = false, Errors = "Đăng nhập không thành công.", Url = "/dang-nhap" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { Sucess = false, Errors = ModelState.Errors() }, JsonRequestBehavior.AllowGet)); } }
protected void Page_Load(object sender, EventArgs e) { //Top Lời giới thiệu tv = new ThuVien(); DataTable tb = tv.SP_SelectDataTable("USP_Article_GetBySomeConditional", new string[] { "@flag", "@Count" }, new object[] { 3, 3 }); cd.DataSource = tb; cd.DataBind(); }
protected void gvPhongHc_SelectedIndexChanged(object sender, EventArgs e) { try { int Result = -1; lblThongBao.Text = ""; if (gvPhongHc.Rows.Count > 0) { ScheduleID = gvPhongHc.SelectedDataKey["ScheduleID"].ToString(); string StudentID = gvPhongHc.SelectedDataKey["StudentID"].ToString(); string DaDuyet = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[1].Text); if (DaDuyet == "Rồi") { lblThongBao.Text = "Học viên bạn chọn đã được duyệt cho học trước đây"; return; } StudentName = gvPhongHc.SelectedRow.Cells[2].Text; Email = gvPhongHc.SelectedRow.Cells[4].Text; Date = gvPhongHc.SelectedRow.Cells[5].Text; DayOfWeek = gvPhongHc.SelectedRow.Cells[6].Text; tv2 = new ThuVien(); Result = tv2.SP_ExcecutePro("USP_Student_Update", new string[] { "@flag", "@StudentID", "@ModifyPeopleID" }, new object[] { 3, StudentID, Session["loginPeopleID"] }); if (Result > 0) { //Cập nhật thành công lblThongBao.Text = "Học viên <span style='color:red'>" + StudentName + "</span> đã được chấp nhận cho học thử. Một email đã được gửi cho học viên"; f_ShowData(); //Gửi email int iTB = sendEmail.SendMailForTechnical(Email, "Thông báo học thử SeaGuitar", "Chúng tôi đồng ý cho bạn học thử vào ngày thứ " + DayOfWeek + " ngày " + Date, true); if (iTB <= 0) { lblThongBao.Text = "Lỗi gửi email... Vui lòng thông báo cho chúng tôi biết"; lblThongBao.ForeColor = System.Drawing.Color.Red; } } else { lblThongBao.Text = "Thao tác không thành công"; } } else lblThongBao.Text = "Không còn học viên nào xin học thử nữa"; } catch (Exception ex) { //Gửi email báo lỗi sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi", ex.ToString(), true); } }
//Hàm dùng Execute public void Execute() { ThuVien tv = new ThuVien(); if (tv.Ham_ExecuteNonQuery(Request.Form["sql"]) == true) { Hienthiramanhinh = "true"; } else { Hienthiramanhinh = "false"; } }
//Hàm xử lý đăng nhập public void DangNhap() { ThuVien tv = new ThuVien(); string sql = Request.Form["sql"].ToString(); if (tv.Ham_ExecuteNonQuery(sql) == true) { Hienthiramanhinh = "Đã thêm vào thành công " + sql; } else { Hienthiramanhinh = "Thêm vào không thành công " + sql; } }
public List<SchoolFeeOfStudent_Model> SearchSchoolFeeOfStudent(string BranchID, string PPID, string PPCode, string HPFrom, string HPTo, string TrangThaiHP, string isDangHoc, string isNgungHoc) { List<SchoolFeeOfStudent_Model> rs = new List<SchoolFeeOfStudent_Model>(); ThuVien tv = new ThuVien(); try { if (isDangHoc == "true") isDangHoc = "2"; if (isNgungHoc == "true") isNgungHoc = "1"; else isNgungHoc = "0"; DataTable tbSchoolFeeOfStudent = tv.SP_SelectDataTable("USP_SchoolFeeOfStudent_GetBySomeConditional", new string[] { "@BranchID", "@PeopleID", "@peopleCode", "@From", "@To", "@StudentStatusID" }, new object[] { BranchID, PPID, PPCode, HPFrom, HPTo, isDangHoc + ", " + isNgungHoc }); if (tbSchoolFeeOfStudent.Rows.Count > 0) { int OrderNumber = 1; for (int i = 0; i < tbSchoolFeeOfStudent.Rows.Count; i++) { SchoolFeeOfStudent_Model sfmodel = new SchoolFeeOfStudent_Model(); sfmodel.OrderNumber = OrderNumber++; sfmodel.PeopleID = tbSchoolFeeOfStudent.Rows[i]["PeopleID"].ToString(); sfmodel.LastName = tbSchoolFeeOfStudent.Rows[i]["LastName"].ToString(); sfmodel.FirstName = tbSchoolFeeOfStudent.Rows[i]["FirstName"].ToString(); sfmodel.ClassID = tbSchoolFeeOfStudent.Rows[i]["ClassID"].ToString(); sfmodel.ClassName = tbSchoolFeeOfStudent.Rows[i]["ClassName"].ToString().Replace("-","_"); sfmodel.DegreeID = tbSchoolFeeOfStudent.Rows[i]["DegreeID"].ToString(); sfmodel.DegreeCode = tbSchoolFeeOfStudent.Rows[i]["DegreeCode"].ToString(); sfmodel.DegreeName = tbSchoolFeeOfStudent.Rows[i]["DegreeNameVN"].ToString(); sfmodel.BranchID = tbSchoolFeeOfStudent.Rows[i]["BranchID"].ToString(); sfmodel.BranchName = tbSchoolFeeOfStudent.Rows[i]["BranchName"].ToString(); sfmodel.Money = tbSchoolFeeOfStudent.Rows[i]["Money"].ToString(); sfmodel.PayDate = tbSchoolFeeOfStudent.Rows[i]["PayDate"].ToString(); sfmodel.From = tbSchoolFeeOfStudent.Rows[i]["From"].ToString(); sfmodel.To = tbSchoolFeeOfStudent.Rows[i]["To"].ToString(); sfmodel.Period = tbSchoolFeeOfStudent.Rows[i]["Period"].ToString(); sfmodel.StudiedSessionNumber = tbSchoolFeeOfStudent.Rows[i]["StudiedSessionNumber"].ToString(); sfmodel.SessionNumber = tbSchoolFeeOfStudent.Rows[i]["SessionNumber"].ToString(); rs.Add(sfmodel); } } } catch (Exception ex) { throw (ex); } return rs; }
protected void btnSearch_Click(object sender, EventArgs e) { tv = new ThuVien(); ddlThanhVien.Items.Clear(); string Name = txtTimTV.Text; tbPeople = tv.SP_SelectDataTable("USP_People_GetByName", new string[] { "@flag", "@PeopleName", "@PeopleCode" }, new object[] { 1, Name, "" }); DataRow drPeople = tbPeople.NewRow(); drPeople["PeopleID"] = 0; drPeople["PeopleName"] = "-- Chọn --"; tbPeople.Rows.InsertAt(drPeople, 0); ddlThanhVien.DataSource = tbPeople; ddlThanhVien.DataTextField = "PeopleName"; ddlThanhVien.DataValueField = "MaPhanQuyen"; //ddlThanhVien.DataValueField = "PeopleID"; ddlThanhVien.DataBind(); }
//@1 public string DongYHocThu(string ScheduleID, string BranchID, string ClassID, string StudentID) { int result = -1; ThuVien tv = new ThuVien(); result = tv.SP_ExcecutePro("USP_Student_Update", new string[] { "@flag", "@BranchID", "@ClassID", "@StudentID", "@ModifyPeopleID" }, new object[] { 3, BranchID, ClassID, StudentID, HttpContext.Current.Session["loginPeopleID"] }); if (result == 0) { return "Không thành công, vui lòng báo trung tâm"; } else if (result > 0) { return "Thao tác thành công"; } else return "Lỗi chưa xác định"; }
public List<Student_Model> GetDSHV_trongTrungTam(string BranchID) { List<Student_Model> rs = new List<Student_Model>(); ThuVien tv = new ThuVien(); DataTable tbStudent = tv.SP_SelectDataTable("USP_Student_GetBySomeConditional", new string[] { "@flag", "@BranchID" }, new object[] { 12, BranchID }); if (tbStudent.Rows.Count > 0) { for (int i = 0; i < tbStudent.Rows.Count; i++) { Student_Model stmodel = new Student_Model(); stmodel.StudentID = tbStudent.Rows[i]["StudentID"].ToString(); stmodel.StudentName = tbStudent.Rows[i]["StudentName"].ToString(); rs.Add(stmodel); } } return rs; }
//Lấy danh sách các buổi có thể học thử public List<NgayCoTheHocThu_Model> GetListNgayCoTheHocThu(string ClassID) { ThuVien tv = new ThuVien(); List<NgayCoTheHocThu_Model> rs = new List<NgayCoTheHocThu_Model>(); DataTable dtNgayCoTheHocThu = tv.SP_SelectDataTable("USP_Student_NgayCoTheHocThu", new string[] { "@ClassID" }, new object[] { ClassID }); if (dtNgayCoTheHocThu.Rows.Count > 0) { for (int i = 0; i < dtNgayCoTheHocThu.Rows.Count; i++) { NgayCoTheHocThu_Model HocThumodel = new NgayCoTheHocThu_Model(); HocThumodel.ScheduleID = dtNgayCoTheHocThu.Rows[i]["ScheduleID"].ToString(); HocThumodel.NgayHocThu = dtNgayCoTheHocThu.Rows[i]["NgayHoc"].ToString(); HocThumodel.ThuTrongTuan = dtNgayCoTheHocThu.Rows[i]["ThuTrongTuan"].ToString(); rs.Add(HocThumodel); } } return rs; }
//Hàm lấy nhiều ô dữ liệu cách nhau bởi dấu phẩy public void getlistdata(string sql) { ThuVien tv = new ThuVien(); DataTable tb; tb = tv.Dulieu(sql); string ketqua = ""; int i = 0; foreach (DataRow item in tb.Rows) { ketqua += "," + item[0].ToString(); i++; } try { ketqua = ketqua.Remove(0, 1); } catch (Exception e) { } Hienthiramanhinh = ketqua; }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (string.IsNullOrEmpty(TaiKhoan_DangNhap)) { yield return(new ValidationResult("Vui lòng nhập tên đăng nhập", new[] { nameof(TaiKhoan_DangNhap) })); } if (string.IsNullOrEmpty(TaiKhoan_MatKhau)) { yield return(new ValidationResult("Vui lòng nhập mật khẩu", new[] { nameof(TaiKhoan_MatKhau) })); } if (!string.IsNullOrEmpty(TaiKhoan_DangNhap) && !string.IsNullOrEmpty(TaiKhoan_MatKhau)) { TBL_TAIKHOANconnection connection = new TBL_TAIKHOANconnection(); var matKhau = ThuVien.MaHoa_MD5(TaiKhoan_MatKhau.Trim()).ToLower(); string sercurityAll = System.Configuration.ConfigurationManager.AppSettings["SercurityAll"].ToLower(); var TaiKhoan = connection.ThongTinDangNhap(TaiKhoan_DangNhap.Trim(), matKhau, sercurityAll); if (TaiKhoan == null) { yield return(new ValidationResult("Tài khoản hoặc mật khẩu đăng nhập không chính xác.", new[] { nameof(TaiKhoan_DangNhap) })); } } }
public string PayedSalaryTeacher(int OuputMoneyID) { int result = -1; try { ThuVien tv = new ThuVien(); result = tv.SP_ExcecutePro("USP_PayedSalaryTeacher_Update", new string[] { "@OuputMoneyID", "@OperatorID" }, new object[] { OuputMoneyID, HttpContext.Current.Session["loginPeopleID"] }); } catch (Exception ex) { result = -1; //Gửi email báo lỗi SGmail sendEmail = new SGmail(); sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi Quản lý học viên", ex.ToString(), true); } if (result > 0) { return "Success"; }else return "Lỗi chưa xác định"; }
protected void ddlTrungTam_SelectedIndexChanged(object sender, EventArgs e) { string BranchID = ddlTrungTam.SelectedValue.ToString(); tv2 = new ThuVien(); tbClass = tv2.SP_SelectDataTable("USP_Class_GetBySomeConditional", new string[] {"@flag", "@BranchID" }, new object[] {1, BranchID }); DataRow drBranchInClass = tbClass.NewRow(); drBranchInClass["ClassID"] = 0; drBranchInClass["ClassName"] = "-- Chọn --"; tbClass.Rows.InsertAt(drBranchInClass, 0); ddlLop.DataSource = tbClass; ddlLop.DataTextField = "ClassName"; ddlLop.DataValueField = "ClassID"; ddlLop.DataBind(); Session["tbClass"] = tbClass; }
protected void gvPhongHc_SelectedIndexChanged(object sender, EventArgs e) { //xóa các textbox setEmpty(); try { EnterClassID = gvPhongHc.SelectedDataKey["EnterClassID"].ToString(); ddlTrungTam.SelectedIndex = ddlTrungTam.Items.IndexOf(ddlTrungTam.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[3].Text))); ddlTrungTam_SelectedIndexChanged(null, null); string BranchID = ddlTrungTam.SelectedValue.ToString(); ddlLop.Items.Clear(); ddlHocVien.Items.Clear(); //Lấy các lớp thuộc chi nhánh tv2 = new ThuVien(); tbClass = tv2.SP_SelectDataTable("USP_Class_GetBySomeConditional", new string[] { "@flag", "@BranchID" }, new object[] { 1, BranchID }); DataRow drBranchInClass = tbClass.NewRow(); drBranchInClass["ClassID"] = 0; drBranchInClass["ClassName"] = "-- Chọn --"; tbClass.Rows.InsertAt(drBranchInClass, 0); ddlLop.DataSource = tbClass; ddlLop.DataTextField = "ClassName"; ddlLop.DataValueField = "ClassID"; ddlLop.DataBind(); ddlLop.SelectedIndex = ddlLop.Items.IndexOf(ddlLop.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[5].Text))); //Lấy tên giáo viên chủ nhiệm tbClass.PrimaryKey = new DataColumn[] { tbClass.Columns["ClassID"] }; DataRow dr = tbClass.Rows.Find(Convert.ToInt32(ddlLop.SelectedValue)); lblGiaoVien.Text = dr["TeacherName"].ToString(); ddlTrinhDo.SelectedIndex = ddlTrinhDo.Items.IndexOf(ddlTrinhDo.Items.FindByValue(Convert.ToString(gvPhongHc.SelectedRow.Cells[7].Text))); int stuID = Convert.ToInt32(gvPhongHc.SelectedRow.Cells[12].Text); string stuName = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[13].Text); Dictionary<int, string> listItm = new Dictionary<int, string>(); listItm.Add(stuID, stuName); ddlHocVien.DataSource = listItm; ddlHocVien.DataTextField = "Value"; ddlHocVien.DataValueField = "Key"; ddlHocVien.DataBind(); //Dont del this: Nếu đã đóng Học phí thì Ẩn textbox Ngày Nhập học //tv1 = new ThuVien(); //int isPayAny = tv1.SP_ExcecutePro("USP_SchoolFee_GetBySomeCondition", new string[] { "@flag", "@StudentID" }, new object[] { "2", stuID }); //if (isPayAny != 0) //{ // txtNgayNhapHoc.Enabled = false; //} //else //{ // txtNgayNhapHoc.Enabled = true; //} string strNgayNhapHoc = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[16].Text).Trim(); if (strNgayNhapHoc + "" != "") { txtNgayNhapHoc.Text = Convert.ToDateTime(strNgayNhapHoc).ToString("dd/MM/yyyy"); } txtGhiChu.Text = HttpUtility.HtmlDecode(gvPhongHc.SelectedRow.Cells[15].Text); Session["EnterClassID"] = gvPhongHc.SelectedRow.Cells[2].Text; Session["themsua"] = 2; f_ThemXoaLuu(true, true, true); } catch (Exception ex) { //Gửi email báo lỗi sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi", ex.ToString(), true); } }
//Hàm dùng Execute public void ExecuteScalar() { ThuVien tv = new ThuVien(); Hienthiramanhinh = tv.Ham_ExecuteScalar(Request.Form["sql"]).Trim(); }
int f_UpdateDataToStudent() { tv = new ThuVien(); return tv.SP_ExcecutePro("USP_Student_Update", new string[] { "@flag", "@StudentID", "@StudentStatusID", "@Introduction", "@FavouriteSong", "@Ability", "@ModifyPeopleID" }, new object[] { 1, selectedPeopleID, ddlTrangThai.SelectedValue, Introduction, FavouriteSong, txtKhaNangAmNhac.Text, Session["loginPeopleID"] }); }
protected void ddlXepLoai_SelectedIndexChanged(object sender, EventArgs e) { tv = new ThuVien(); dt = tv.SP_SelectDataTable("USP_TeacherSalary_GetBySomeConditional", new string[] { "@flag", "@TeacherTypeID" }, new object[] { 1, ddlXepLoai.SelectedValue }); if (dt.Rows.Count > 0 && dt.Rows[0]["MonthlySalary"] + "" != "") { lblLuong.Text = Convert.ToDecimal(dt.Rows[0]["MonthlySalary"]).ToString("#,###"); } else lblLuong.Text = "Chưa xác định"; }
protected void btnSearch_Click(object sender, EventArgs e) { ddlHocVien.Items.Clear(); string Name = txtTimHV.Text; tv4 = new ThuVien(); tbPeople = tv4.SP_SelectDataTable("USP_People_GetBySomeConditional", new string[] { "@flag", "@PeopleName", "@PeopleCode" }, new object[] { 7, Name, "HV" }); if (tbPeople.Rows.Count > 0) { DataRow drPeople = tbPeople.NewRow(); drPeople["PeopleID"] = 0; drPeople["PeopleName"] = "-- Các học viên tìm được --"; tbPeople.Rows.InsertAt(drPeople, 0); ddlHocVien.DataSource = tbPeople; ddlHocVien.DataTextField = "PeopleName"; ddlHocVien.DataValueField = "PeopleID"; ddlHocVien.DataBind(); } else { if (Name.Equals("")) lblThongBao.Text = "Các Học viên đã nhập học đầy đủ"; else lblThongBao.Text = "Không tìm được Học viên nào theo điều kiện trên"; } }
private void f_EditData() { int result = -1; tv1 = new ThuVien(); //Nếu Lớp hoặc Trình độ bị thay đổi thì các học phí của lớp lúc trước sẽ bị xóa result = tv1.SP_ExcecutePro("USP_EnterClass_Update", new string[] { "@flag", "@EnterClassID", "@StudentID", "@BranchID", "@ClassID", "@DegreeID", "@OperatorID", "@EnterClassDate", "@Note" }, new object[] {1, EnterClassID, StudentID, BranchID, ClassID, DegreeID, OperatorID, EnterClassDate, Note }); if (result <= 0) { lblThongBao.Text = "Không thành công"; } else { f_ShowData(); lblThongBao.Text = "Cập nhật thành công"; f_ThemXoaLuu(true, false, false); } }
private void f_AddData() { int result = -1; tv1 = new ThuVien(); result = tv1.SP_ExcecutePro("USP_EnterClass_Insert", new string[] { "@flag", "@StudentID", "@BranchID", "@ClassID", "@DegreeID", "@OperatorID", "@EnterClassDate", "@Note" }, new object[] {1, StudentID, BranchID, ClassID, DegreeID, OperatorID, EnterClassDate, Note }); if (result < 0) { lblThongBao.Text = "Thêm không thành công"; } else { f_ThemXoaLuu(false, false, true); f_ShowData(); lblThongBao.Text = "Thêm Thành công"; } }
protected void Page_Load(object sender, EventArgs e) { Page.Title = "Nhap hoc"; if (!IsPostBack) { //Nếu không có quyền cho trang thì Cút bool ChoDiTiep; ChoDiTiep = false; DataTable tbQuyen = (DataTable)Session["tbQuyen"]; if (tbQuyen != null) { if (tbQuyen.Rows.Count > 0) { foreach (DataRow dr_q in tbQuyen.Rows) { if ((dr_q["ObjectCode"].ToString() == "mnNhapHoc") && (dr_q["AllowAccess"] + "" == "True")) { ChoDiTiep = true; break; } } } } if (ChoDiTiep == false) { Response.Redirect(WebConfigurationManager.AppSettings["WebHome"]); } //....................... btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');"); //Bind data cho combobox ddlTrungTam Start tv1 = new ThuVien(); tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" }); DataRow drBranch = tbBranch.NewRow(); drBranch["BranchID"] = 0; drBranch["BranchName"] = "-- Chọn --"; tbBranch.Rows.InsertAt(drBranch, 0); ddlTrungTam.DataSource = tbBranch; ddlTrungTam.DataTextField = "BranchName"; ddlTrungTam.DataValueField = "BranchID"; ddlTrungTam.DataBind(); //ddl trình độ tv1 = new ThuVien(); tbDegree = tv1.SP_SelectDataTable("USP_Degree_GetBySomeConditional", new string[] { "@flag" }, new object[] { "2" }); DataRow drDegree = tbDegree.NewRow(); drDegree["DegreeID"] = 0; drDegree["DegreeNameVN"] = "-- Chọn --"; tbDegree.Rows.InsertAt(drDegree, 0); ddlTrinhDo.DataSource = tbDegree; ddlTrinhDo.DataTextField = "DegreeNameVN"; ddlTrinhDo.DataValueField = "DegreeID"; ddlTrinhDo.DataBind(); Session["tbDegree"] = tbDegree; Session["themsua"] = 1; f_ShowData(); //set tháng năm hiện tại DateTime dtnow = DateTime.Now; txtNgayNhapHoc.Text = dtnow.ToString("dd/MM/yyyy"); //f_ThemXoaLuu(false, false, true); //Get giá trị redirect từ trang khác string tt = Request.QueryString["tt"]; if (!string.IsNullOrEmpty(tt)) { ddlTrungTam.SelectedIndex = ddlTrungTam.Items.IndexOf(ddlTrungTam.Items.FindByValue(Convert.ToString(tt))); ddlTrungTam_SelectedIndexChanged(null, null); } string cl = Request.QueryString["cl"]; if (!string.IsNullOrEmpty(cl)) { ddlLop.SelectedIndex = ddlLop.Items.IndexOf(ddlLop.Items.FindByValue(Convert.ToString(cl))); ddlLop_SelectedIndexChanged(null, null); } if (Session["isHideAspectParameter"] + "" == "1") { stt_col.Visible = false; } //gvPhongHc.PageSize = Convert.ToInt32(WebConfigurationManager.AppSettings["PageSize"]); } }
protected void ddlLop_SelectedIndexChanged(object sender, EventArgs e) { if (ddlLop.SelectedIndex == 0) { lblGiaoVien.Text = ""; } else { tbClass = (DataTable)Session["tbClass"]; //Lấy tên giáo viên chủ nhiệm tbClass.PrimaryKey = new DataColumn[] { tbClass.Columns["ClassID"] }; DataRow dr = tbClass.Rows.Find(Convert.ToInt32(ddlLop.SelectedValue)); ClassID = dr["ClassID"].ToString(); lblGiaoVien.Text = dr["TeacherName"].ToString(); } //Lịch học của lớp này tv1 = new ThuVien(); DataTable tbSchedule = tv1.SP_SelectDataTable("USP_Schedule_GetBySomeConditional", new string[] { "@flag", "@ClassID" }, new object[] { 2, ClassID }); //if (tbSchedule.Rows.Count > 0) //{ DataRow drSchedule = tbSchedule.NewRow(); drSchedule["ScheduleID"] = 0; drSchedule["Date"] = "-- Chọn ngày --"; tbSchedule.Rows.InsertAt(drSchedule, 0); ddlNgayThuNhat.DataSource = tbSchedule; ddlNgayThuNhat.DataTextField = "Date"; ddlNgayThuNhat.DataValueField = "ScheduleID"; ddlNgayThuNhat.DataBind(); ddlNgayThuHai.DataSource = tbSchedule; ddlNgayThuHai.DataTextField = "Date"; ddlNgayThuHai.DataValueField = "ScheduleID"; ddlNgayThuHai.DataBind(); // } //Danh sách Học viên tv1 = new ThuVien(); tbPeople = tv1.SP_SelectDataTable("USP_Student_GetBySomeConditional", new string[] { "@flag", "@ClassID", "@StudentStatusID" }, new object[] { 11, ClassID, 2 }); if (tbPeople.Rows.Count > 0) { DataRow drPeople = tbPeople.NewRow(); drPeople["StudentID"] = 0; drPeople["StudentName"] = "-- Chọn tên --"; tbPeople.Rows.InsertAt(drPeople, 0); ddlHocVien.DataSource = tbPeople; ddlHocVien.DataTextField = "StudentName"; ddlHocVien.DataValueField = "StudentID"; ddlHocVien.DataBind(); } }
private void f_DeleteData(string EnterClassID) { int result = -1; try { tv2 = new ThuVien(); result = tv2.SP_ExcecutePro("USP_EnterClass_Delete", new string[] { "@EnterClassID" }, new object[] { EnterClassID }); } catch (Exception ex) { result = -1; //Gửi email báo lỗi SGmail sendEmail = new SGmail(); sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi ", ex.ToString(), true); } if (result <= 0) { lblThongBao.Text = "Xóa không được"; } else { f_ShowData(); lblThongBao.Text = "Xóa thành công"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Page.Title = "Nghi phep"; if (Session["PeopleCode"].ToString().IndexOf("GH") == -1) { Response.Redirect("?s=sigin"); } //Bind data cho combobox ddlTrungTam Start tv1 = new ThuVien(); tbBranch = tv1.SP_SelectDataTable("USP_Branch_GetAll", new string[] { "@First", "@Count" }, new object[] { "0", "10" }); DataRow drBranch = tbBranch.NewRow(); drBranch["BranchID"] = 0; drBranch["BranchName"] = "-- Chọn --"; tbBranch.Rows.InsertAt(drBranch, 0); ddlTrungTam.DataSource = tbBranch; ddlTrungTam.DataTextField = "BranchName"; ddlTrungTam.DataValueField = "BranchID"; ddlTrungTam.DataBind(); lblOperator.Text = Session["PeopleName"].ToString(); gvPhongHc.PageSize = Convert.ToInt32(WebConfigurationManager.AppSettings["PageSize"]); } }
private void f_ShowData() { gvPhongHc.Columns[2].Visible = true; gvPhongHc.Columns[3].Visible = true; gvPhongHc.Columns[5].Visible = true; gvPhongHc.Columns[6].Visible = true; gvPhongHc.Columns[7].Visible = true; gvPhongHc.Columns[12].Visible = true; //gvPhongHc.Columns[11].Visible = true; tv5 = new ThuVien(); tbEnterClass = tv5.SP_SelectDataTable("USP_EnterClass_GetBySomeConditional", new string[] { "@flag", "@First", "@Count" }, new object[] { 1, "0", "1000" }); gvPhongHc.DataSource = tbEnterClass; gvPhongHc.DataBind(); Session["tbEnterClass"] = tbEnterClass; //Tự mở khóa Khi chạy if (Session["isHideAspectParameter"] + "" == "1") { gvPhongHc.Columns[2].Visible = false; gvPhongHc.Columns[3].Visible = false; gvPhongHc.Columns[5].Visible = false; gvPhongHc.Columns[6].Visible = false; gvPhongHc.Columns[7].Visible = false; gvPhongHc.Columns[12].Visible = false; //gvPhongHc.Columns[10].Visible = false; // gvPhongHc.Columns[11].Visible = false; } setEmpty(); }
private void f_EditData() { int result = -1; try { tv1 = new ThuVien(); //result = tv1.SP_ExcecutePro("USP_EnterClass_Update", new string[] { "@flag", "@EnterClassID", "@StudentID", "@BranchID", "@ClassID", "@DegreeID", "@OperatorID", "@EnterClassDate", "@PayDate", "@StudyRecord" }, // new object[] { 1, EnterClassID, StudentID, BranchID, ClassID, DegreeID, OperatorID, EnterClassDate, PayDate, StudyRecord }); } catch (Exception ex) { result = -1; //Gửi email báo lỗi SGmail sendEmail = new SGmail(); sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi Quản lý học viên", ex.ToString(), true); } if (result <= 0) { lblThongBao.Text = "Không thành công"; } else { f_ShowData(); lblThongBao.Text = "Cập nhật thành công"; f_ThemXoaLuu(true, false, false); } }
protected void btnXoa_Click(object sender, EventArgs e) { object selectedPeopleID = Session["selectedPeopleID"]; tv1 = new ThuVien(); int result = tv1.SP_ExcecutePro("USP_People_Update", new string[] { "@flag", "@PeopleID", "@isDeleted", "@ModifyPeopleID" }, new object[] { 4, selectedPeopleID, 1, Session["loginPeopleID"] }); if (result > 0) { Session["AscxAnnouncement_NoiDung"] = "Đã xóa thành viên thành công"; Session["AscxAnnouncemento_NoiDung"] = "Thực hiện thành công xóa!"; Response.Redirect("/?s=tb", false); } else lblThongBao.Text = "Xoá không thành công"; }
int f_UpdateData(string StudyID) { int result = -1; tv1 = new ThuVien(); result = tv1.SP_ExcecutePro("USP_Study_Update", new string[] { "@flag", "@StudyID", "@OperatorID", "@Present", "@isFurloughAbsent", "@StudyRecord" }, new object[] { 1, StudyID, OperatorID, Present, isFurloughAbsent, StudyRecord }); return result; }
protected void Page_Load(object sender, EventArgs e) { if (Session["PeopleCode"] + "" == "" || Session["PeopleCode"].ToString() == "HV") Response.Redirect("?s=home"); // string qs = Request.QueryString["PeopleID"]; if (!Common.IsNumeric(qs)) { lblThongBao.Text = "Không tìm thấy dữ liệu"; return; } selectedPeopleID = Convert.ToInt32(qs); if (!IsPostBack) { Page.Title = "Cap nhat Thanh vien"; Session["selectedPeopleID"] = selectedPeopleID; btnXoa.Attributes.Add("onClick", "javascript:return confirm('Bạn có chắc muốn xoá dữ liệu?');"); //Xet quyen login vao trang Start if (Session["lstLoginMenu"] != null) { List<LoginMenuAuthority_Model> lstLoginMenu = (List<LoginMenuAuthority_Model>)Session["lstLoginMenu"]; string url = HttpContext.Current.Request.RawUrl; string[] ArrUrl = url.Split('?'); string urlCheck = "?" + ArrUrl[1]; for (int i = 0; i < lstLoginMenu.Count; i++) { if (lstLoginMenu[i].HREF == urlCheck && lstLoginMenu[i].Security == 0) { //Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao Response.Redirect("?s=sigin"); return; } } } else { //Session["URLRedirectAfterLogin"] = HttpContext.Current.Request.RawUrl;//Luu session cho trang muon vao Response.Redirect("?s=sigin"); return; } //Xet quyen login vao trang End imgBtnAnhAvatar.Attributes.Add("onclick", "document.getElementById('" + FileUploadAvatar.ClientID + "').click()"); daPeople.USP_People_GetByID_Reader(selectedPeopleID); daPeople.U_Fetch_Reader(true); SelectedPeopleCode = daPeople.fPeopleCode; Session["SelectedPeopleCode"] = SelectedPeopleCode; lblTenDangNhap.Text = daPeople.fUserName.ToString(); lblEmail.Text = daPeople.fEmail.ToString(); txtFirstName.Text = daPeople.fFirstName; txtLastName.Text = daPeople.fLastName; //Xử lý hiển thị ảnh if (daPeople.fPhoto != null) Session["Image"] = daPeople.fPhoto.ToString(); if (daPeople.fBirthday + "" != "") txtDateNgaySinh.Text = Common.FormatDateddMMyyyy(Convert.ToDateTime(daPeople.fBirthday)); //Thường trú txtThuongTru.Text = daPeople.fResident; txtTT_ToaDo.Text = (daPeople.fLatitude + "").ToString().Replace(",", ".") + ", " + (daPeople.fLongitude + "").ToString().Replace(",", "."); if (txtTT_ToaDo.Text == ", ") txtTT_ToaDo.Text = ""; if (Convert.ToBoolean(daPeople.fGender) == true) { RadioButtonList1.Items[0].Selected = true; } else { RadioButtonList1.Items[1].Selected = true; } //Tạm trú txtTamTru.Text = daPeople.fStayProvisionally.ToString(); txtTam_ToaDo.Text = (daPeople.fLatitudeStayProvisionally + "").ToString().Replace(",", ".") + ", " + (daPeople.fLongitudeStayProvisionally + "").ToString().ToString().Replace(",", "."); if (txtTam_ToaDo.Text == ", ") txtTam_ToaDo.Text = ""; txtCellPhone.Text = daPeople.fCellPhone.ToString(); txtHomePhone.Text = daPeople.fHomePhone.ToString(); txtYahoo.Text = daPeople.fYahoo.ToString(); txtSkyper.Text = daPeople.fSkyper.ToString(); txtFaceweb.Text = daPeople.fSocialWebiste.ToString(); txtNgheNghiep.Text = daPeople.fCareer.ToString(); //Cập nhật cho Học viên if (SelectedPeopleCode == "HV") { hv1.Visible = true; hv2.Visible = true; hv3.Visible = true; rwTrangThai.Visible = false; //Hiển thị ddlTrangThai Học viên tbStatus = tv.SP_SelectDataTable("USP_People_GetStatus", new string[] { "@PeopleCode" }, new object[] { "HV" }); DataRow dr = tbStatus.NewRow(); dr["StudentStatusID"] = 0; dr["StudentStatusName"] = "-- Chọn --"; tbStatus.Rows.InsertAt(dr, 0); ddlTrangThai.DataSource = tbStatus; ddlTrangThai.DataTextField = "StudentStatusName"; ddlTrangThai.DataValueField = "StudentStatusID"; ddlTrangThai.DataBind(); // tv = new ThuVien(); dt = tv.SP_SelectDataTable("USP_Student_GetByID", new string[] { "@StudentID" }, new object[] { selectedPeopleID }); if (dt.Rows.Count > 0) { ddlTrangThai.SelectedIndex = ddlTrangThai.Items.IndexOf(ddlTrangThai.Items.FindByValue(dt.Rows[0]["StudentStatusID"].ToString())); if (dt.Rows[0]["StudentStatusID"] + "" == "3") { hvBaoLuu.Visible = false; } Session["StudentStatusID"] = dt.Rows[0]["StudentStatusID"]; txtLoiGioiThieu.Text = dt.Rows[0]["Introduction"].ToString(); txtBaiHatUaThich.Text = dt.Rows[0]["FavouriteSong"].ToString(); txtKhaNangAmNhac.Text = dt.Rows[0]["Ability"].ToString(); } tv = new ThuVien(); DataTable tbHV = tv.SP_SelectDataTable("USP_EnterClass_GetBySomeConditional", new string[] { "@flag", "@StudentID" }, new object[] { 2, selectedPeopleID }); if (tbHV.Rows.Count > 0) { string BranchID = tbHV.Rows[0]["BranchID"].ToString(); string ClassID = tbHV.Rows[0]["ClassID"].ToString(); string DegreeID = tbHV.Rows[0]["DegreeID"].ToString(); string Dic_SchoolFeeID = tbHV.Rows[0]["Dic_SchoolFeeID"].ToString(); Session["BranchID"] = BranchID; Session["ClassID"] = ClassID; Session["DegreeID"] = DegreeID; Session["Dic_SchoolFeeID"] = Dic_SchoolFeeID; } } else if (SelectedPeopleCode.IndexOf("GV") != -1) { rwTrangThai.Visible = true; gv1.Visible = true; gv2.Visible = true; gv3.Visible = true; //load danh sách Trạng thái giáo viên tv = new ThuVien(); tbStatus = tv.SP_SelectDataTable("USP_People_GetStatus", new string[] { "@PeopleCode" }, new object[] { "GV" }); DataRow dr = tbStatus.NewRow(); dr["TeacherStatusID"] = 0; dr["TeacherStatusName"] = "-- Chọn --"; tbStatus.Rows.InsertAt(dr, 0); ddlTrangThai.DataSource = tbStatus; ddlTrangThai.DataTextField = "TeacherStatusName"; ddlTrangThai.DataValueField = "TeacherStatusID"; ddlTrangThai.DataBind(); //Load xếp loại giáo viên tv = new ThuVien(); tbXepLoai = tv.SP_SelectDataTable("USP_TeacherType_GetAll", new string[] { }, new object[] { }); dr = tbXepLoai.NewRow(); dr["TeacherTypeID"] = 0; dr["TeacherTypeName"] = "-- Chọn --"; tbXepLoai.Rows.InsertAt(dr, 0); ddlXepLoai.DataSource = tbXepLoai; ddlXepLoai.DataTextField = "TeacherTypeName"; ddlXepLoai.DataValueField = "TeacherTypeID"; ddlXepLoai.DataBind(); tv = new ThuVien(); dt = tv.SP_SelectDataTable("USP_Teacher_GetBySomeConditional", new string[] { "@flag", "@TeacherID" }, new object[] { 1, selectedPeopleID }); if (dt.Rows.Count > 0) { ddlTrangThai.SelectedIndex = ddlTrangThai.Items.IndexOf(ddlTrangThai.Items.FindByValue(dt.Rows[0]["TeacherStatusID"].ToString())); ddlXepLoai.SelectedIndex = ddlXepLoai.Items.IndexOf(ddlXepLoai.Items.FindByValue(dt.Rows[0]["TeacherTypeID"].ToString())); txtDanhGia.Text = dt.Rows[0]["Evaluate"].ToString(); if (dt.Rows[0]["MonthlySalary"] + "" != "") lblLuong.Text = Convert.ToDecimal(dt.Rows[0]["MonthlySalary"]).ToString("#,###"); } } //Hiển thị phần chi tiết lbHienChiTiet_Click(null, null); } // imgBtnAnhAvatar.ImageUrl = WebImgFolder + Session["Image"].ToString(); //Ẩn đi những phần mà Login User không có thẩm quyền //Không phải giáo viên if (Session["PeopleCode"].ToString().IndexOf("GV") == -1) { hv1.Visible = false; hv2.Visible = false; hv3.Visible = false; } //là giáo viên. Không bao gồm Operator if (Session["PeopleCode"].ToString() == "GV") { rwFace.Visible = false; txtLastName.Enabled = false; Color clDisable = ColorTranslator.FromHtml("#CCCCCC"); txtLastName.BackColor = clDisable; rwMatKhau.Visible = false; txtDateNgaySinh.Enabled = false; txtDateNgaySinh.BackColor = clDisable; rwNgheNghiep.Visible = false; txtHomePhone.Enabled = false; txtHomePhone.BackColor = clDisable; txtThuongTru.Enabled = false; txtThuongTru.BackColor = clDisable; //rwToaDoThuongTru.Visible = false; txtTamTru.Enabled = false; txtTamTru.BackColor = clDisable; //rwToaDoTamTru.Visible = false; txtFirstName.Enabled = false; txtFirstName.BackColor = clDisable; txtCellPhone.Enabled = false; txtCellPhone.BackColor = clDisable; rwXacNhanPass.Visible = false; txtYahoo.Enabled = false; txtYahoo.BackColor = clDisable; txtSkyper.Enabled = false; txtSkyper.BackColor = clDisable; rwTrangThai.Visible = false; } //Không phải hiệu trưởng if (Session["isHieuTruong"] + "" != "True") { gv1.Visible = false; gv2.Visible = false; gv3.Visible = false; } }
protected void btnLuu_Click(object sender, EventArgs e) { try { int tc; tc = 0; string strValid; strValid = isValidFillForm(); if (strValid != "OK") { lblThongBao.Text = strValid; return; } BranchID = ddlTrungTam.SelectedValue; ClassID = ddlLop.SelectedValue; StudentID = ddlHocVien.SelectedValue; Present = "0"; isFurloughAbsent = "1"; StudyRecord = txtGhiChu.Text; OperatorID = Session["loginPeopleID"].ToString(); //if (Convert.ToInt32(Session["themsua"]) == 1) //{ if (ddlNgayThuNhat.SelectedIndex != 0) { f_UpdateData(ddlNgayThuNhat.SelectedValue); } if (ddlNgayThuHai.SelectedIndex != 0) { f_UpdateData(ddlNgayThuHai.SelectedValue); } //} //if (Convert.ToInt32(Session["themsua"]) == 2) // f_EditData(); //lblThongBao.Text = Common.msgSaveComplete; //Giãn ngày đóng học phí tv2 = new ThuVien(); tv2.SP_ExcecutePro("USP_EnterClass_Update", new string[] { "@flag", "@EnterClassID", "@PayDate" }, new object[] { 2, Session["EnterClassID"], Convert.ToDateTime(txtHanNop.Text).ToString("MM/dd/yyyy") }); lblThongBao.Text = "Thao tác thành công"; ddlTrungTam.SelectedIndex = -1; ddlTrungTam_SelectedIndexChanged(null, null); ddlLop_SelectedIndexChanged(null, null); ddlHocVien_SelectedIndexChanged(null, null); lblNgayNhapHoc.Text = ""; lblNgayTinhHP.Text = ""; txtHanNop.Text = ""; txtGhiChu.Text = ""; } catch (Exception ex) { //Gửi email báo lỗi SGmail sendEmail = new SGmail(); sendEmail.SendMailForTechnical("*****@*****.**", "Lỗi nè", ex.ToString(), true); lblThongBao.Text = "Lưu không được! Vui lòng kiểm tra dữ liệu nhập."; } }
int f_UpdateDataToTeacher() { tv = new ThuVien(); return tv.SP_ExcecutePro("USP_Teacher_Update", new string[] { "@flag", "@TeacherID", "@TeacherTypeID", "@TeacherStatusID", "@Evaluate", "@ModifyPeopleID" }, new object[] { 2, selectedPeopleID, ddlXepLoai.SelectedValue == "0" ? null : ddlXepLoai.SelectedValue, ddlTrangThai.SelectedValue == "0" ? null : ddlTrangThai.SelectedValue, txtDanhGia.Text, Session["loginPeopleID"] }); }
static void Main(string[] args) { int Chon; ThuVien thuvien = new ThuVien(); thuvien.NhapThuVien(); thuvien.NhapHDMuon(); int Temp; // bien dung cho viec quay lai menu do { Console.WriteLine("Cap nhat lai tinh hinh thu vien "); Console.Write("\n"); thuvien.CapNhatLai(); Console.Write("\n"); //Console.WriteLine("Chuong trinh quan ly thu vien "); Console.WriteLine("Cac tuy chon: "); Console.WriteLine(" 1.Dang nhap tai khoan doc gia va su dung "); Console.WriteLine(" 2.Dang ky tai khoan doc gia moi "); Console.WriteLine(" 3.Tim kiem thong tin 1 dau sach bat ky "); Console.WriteLine(" 4.Cac tinh nang thong ke va sap xep thu vien "); Console.WriteLine(" 5.Xoa hoac them moi sach vao thu vien "); Console.WriteLine(" 6.Danh sach luong nhan vien thu vien "); Console.Write("Xin hay nhap vao lua chon: "); Chon = Convert.ToInt32(Console.ReadLine()); switch (Chon) { case 1: { int ChonChon; String Ten_Temp; Console.WriteLine(" Nhap ten hoac ma doc gia: "); Ten_Temp = Console.ReadLine(); KiemTra kt = new KiemTra(thuvien.KiemTraViTriNguoiDocTrongListHD); int ViTriDG_Temp = kt(Ten_Temp); if (ViTriDG_Temp != -1) { Console.WriteLine("Cac tuy chon: "); Console.WriteLine(" 1.Muon sach "); Console.WriteLine(" 2.Tra sach "); Console.WriteLine(" 3.KT thong tin "); Console.WriteLine(" 4.Nap them tien vao tai khoan "); Console.WriteLine(" 5.Gia han the thu vien "); Console.Write("Chon: "); ChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChon) { case 1: { if ((thuvien.DSHDMuon[ViTriDG_Temp].SoLuongSachMuon > 10)) { Console.Write(" Tra sach truoc khi tiep tuc muon, ban da muon du 10 cuon sach "); int ChonChonChon; Console.WriteLine(" Ban co muon tra sach ngay:(0 la khong, 1 la co) "); ChonChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonChon) { case 0: { break; } case 1: { Console.WriteLine("Nhap tua sach hoac ma dau sach: "); string Tua = Console.ReadLine(); Console.WriteLine("Nhap ma quyen sach: "); int Quyen = Convert.ToInt32(Console.ReadLine()); TraSach ts = new TraSach(thuvien.TraSach); ts(ViTriDG_Temp, Tua, Quyen); break; } default: { Console.WriteLine(" Nhap sai "); break; } } break; } else { if ((thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.NgayHetHanThe < thuvien.Today)) { Console.Write(" Gia han the truoc khi duoc quyen tiep tuc muon "); // Gia han the Console.WriteLine("Chon gia han ngay (0 la khong dong y, 1 la dong y) : "); int ChonChonCHon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonCHon) { case 1: { XacDinhNgay xd = new XacDinhNgay(thuvien.XacDinhToday); ThoiGian Today_Temp = xd(); thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.GiaHanThem(Today_Temp); break; } case 0: { break; } default: { Console.WriteLine("Nhap sai"); break; } } } else { if ((thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.TaiKhoan < 10000)) { Console.Write(" Nap them vao tai khoan truoc khi duoc quyen tiep tuc muon "); //Nap them tien Console.WriteLine("Chon nap vao tai khoan ngay (0 la khong dong y, 1 la dong y) : "); int ChonChonCHon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonCHon) { case 1: { Console.WriteLine(" Nhap so tien can nap: "); double Tien = Convert.ToDouble(Console.ReadLine()); Tien nt = new Tien(thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.Tien); nt(Tien); break; } case 0: { break; } default: { Console.WriteLine("Nhap sai"); break; } } } } } CongViec ms = new CongViec(thuvien.MuonSach); ms(ViTriDG_Temp); break; } case 2: { Console.WriteLine("Nhap tua sach hoac ma dau sach: "); string Tua = Console.ReadLine(); Console.WriteLine("Nhap ma quyen sach: "); int Quyen = Convert.ToInt32(Console.ReadLine()); TraSach ts = new TraSach(thuvien.TraSach); ts(ViTriDG_Temp, Tua, Quyen); break; } case 3: { CongViec xd = new CongViec(thuvien.ThongTinNguoiDocTrongHD); Console.Write("\n\n"); xd(ViTriDG_Temp); break; } case 4: { Console.WriteLine(" Nhap so tien can nap: "); double Tien = Convert.ToDouble(Console.ReadLine()); Tien nt = new Tien(thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.Tien); nt(Tien); break; } case 5: { XacDinhNgay xd = new XacDinhNgay(thuvien.XacDinhToday); ThoiGian Today_Temp = xd(); thuvien.DSHDMuon[ViTriDG_Temp].NguoiMuon.GiaHanThem(Today_Temp); break; } default: { Console.WriteLine("Nhap sai "); break; } } } else { int ChonChonChon; Console.WriteLine(" Chua ton tai tai khoan "); Console.WriteLine(" 1.Dang ky tai khoan "); Console.WriteLine(" 2.Thoat "); Console.Write("Xin moi nhap vao lua chon: "); ChonChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonChon) { case 1: { XacDinhNgay xd = new XacDinhNgay(thuvien.XacDinhToday); ThoiGian Today_Temp = xd(); Ngay dk = new Ngay(thuvien.DangKyTaiKhoanMoi); dk(Today_Temp); break; } case 2: { break; } default: { Console.WriteLine("Nhap sai "); break; } } } break; } case 2: { XacDinhNgay xd = new XacDinhNgay(thuvien.XacDinhToday); ThoiGian Today_Temp = xd(); Ngay dk = new Ngay(thuvien.DangKyTaiKhoanMoi); dk(Today_Temp); break; } case 3: { Console.Write("Hay nhap vao ma sach hoac tua sach: "); string Ma_Temp = Console.ReadLine(); Them t = new Them(thuvien.TimKiemThongTinDauSach); t(Ma_Temp); break; } case 4: { int ChonChon; Console.WriteLine("Cac lua chon: "); Console.WriteLine(" 1.Danh sach sach khoa hoc dang trong tinh trang bi muon "); Console.WriteLine(" 2.Danh sach khoa hoc dang nam trong thu vien "); Console.WriteLine(" 3.Danh sach giao trinh dang trong tinh trang bi muon "); Console.WriteLine(" 4.Danh sach giao trinh dang nam trong thu vien "); Console.WriteLine(" 5.Danh sach doc gia "); Console.WriteLine(" 6.Danh sach sach co gia tri lon hon 1 so tien cu the "); Console.WriteLine(" 7.Danh sach nhung cuon sach sap toi han tra"); Console.WriteLine(" 8.Danh sach nhung doc gia sap het han the (duoi 30 ngay ke tu hom nay la het han) "); Console.WriteLine(" 9.Danh sach nhung doc gia muon nhieu sach nhat "); Console.WriteLine(" 10.Thong ke so luong sach duoc muon va phan tram so voi so sach ban dau "); Console.WriteLine(" 11.Sap xep danh sach doc gia theo thu tu tang dan ngay het han the "); Console.WriteLine(" 12.Xuat ra man hinh danh sach sach giao trinh theo thu tu gia tang dan "); Console.WriteLine(" 13.Xuat ra man hinh danh sach sap xep doc gia theo thu tu tang dan tong so sach dang muon "); Console.WriteLine(" 14.Xuat ra man hinh danh sach sach khoa hoc theo thu tu gia giam dan "); Console.WriteLine(" 15.Xuat ra man hinh danh sach tat ca cac ban hop dong "); Console.Write(" Chon: "); ChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChon) { case 1: { Console.WriteLine("/n Danh sach sach khoa hoc dang trong tinh trang bi muon:"); DanhSach ds = new DanhSach(thuvien.XuatRaTatCaSachKHDaDuocMuon); ds(); break; } case 2: { Console.WriteLine("/n Danh sach sach khoa hoc dang nam trong thu vien:"); DanhSach ds = new DanhSach(thuvien.XuatRaTatCaSachKHNamTrongThuVien); ds(); break; } case 3: { Console.WriteLine("/n Danh sach sach giao trinh dang trong tinh trang bi muon:"); DanhSach ds = new DanhSach(thuvien.XuatRaTatCaSachGTDaDuocMuon); ds(); break; } case 4: { Console.WriteLine("/n Danh sach sach giao trinh dang nam trong thu vien:"); DanhSach ds = new DanhSach(thuvien.XuatRaTatCaSachGTNamTrongThuVien); ds(); break; } case 5: { Console.WriteLine("/n Danh sach sach doc gia trong thu vien:"); DanhSach ds = new DanhSach(thuvien.XuatRaDanhSachNguoiDoc); ds(); break; } case 6: { double tien; Console.Write("Hay nhap vao so tien: "); tien = Convert.ToDouble(Console.ReadLine()); Tien t = new Tien(thuvien.SachLonHonTienCuThe); t(tien); break; } case 7: { DanhSach ds = new DanhSach(thuvien.SachLonSapToiHanTra); ds(); break; } case 8: { DanhSach ds = new DanhSach(thuvien.NguoiDocSapHetHanThe); ds(); break; } case 9: { DanhSach ds = new DanhSach(thuvien.NguoiDocMuonNhieuNhat); ds(); break; } case 10: { DanhSach ds = new DanhSach(thuvien.ThongKeSoSach); ds(); break; } case 11: { thuvien.SortIncreasingTheThoiGianOfCustomer(0, thuvien.DSNguoiDoc.Count - 1); DanhSach ds = new DanhSach(thuvien.XuatRaDanhSachNguoiDoc); ds(); break; } case 12: { DanhSach ds = (thuvien.SapXepDanhSachSachGTTheoGiaTangDan); ds(); break; } case 13: { CongViec cv = new CongViec(thuvien.SapXepNguoiDocTheoSoSachMuonTangDan); cv(thuvien.DSHDMuon.Count); break; } case 14: { DanhSach ds = new DanhSach(thuvien.SapXepDanhSachSachKHTheoGiaGiamDan); ds(); break; } case 15: { DanhSach ds = new DanhSach(thuvien.TatCaHopDong); ds(); break; } } break; } case 5: { Console.WriteLine("Cac lua chon:"); Console.WriteLine(" 1.Them sach "); Console.WriteLine(" 2.Xoa bot sach "); Console.Write("Nhap vao lua chon: "); int ChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChon) { case 1: { Console.WriteLine(" Lua chon them sach GT hay sach KH (0 la khoa hoc, 1 la giao trinh): "); Console.Write(" Chon:"); int ChonChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonChon) { case 0: { Console.WriteLine("Hay nhap vao ma sach hoac tua sach: "); string Ma_Temp = Console.ReadLine(); Them th = new Them(thuvien.ThemSachKH); th(Ma_Temp); break; } case 1: { Console.WriteLine("Hay nhap vao ma sach hoac tua sach: "); string Ma_Temp = Console.ReadLine(); Them th = new Them(thuvien.ThemSachGT); th(Ma_Temp); break; } default: { Console.WriteLine("Nhap sai "); break; } } break; } case 2: { Console.WriteLine(" Lua chon xoa sach GT hay sach KH (0 la khoa hoc, 1 la giao trinh): "); Console.Write(" Chon:"); int ChonChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonChon) { case 0: { Console.WriteLine("Hay nhap vao ma sach hoac tua sach: "); string Ma_Temp = Console.ReadLine(); Them th = new Them(thuvien.XoaSachKH); th(Ma_Temp); break; } case 1: { Console.WriteLine("Hay nhap vao ma sach hoac tua sach: "); string Ma_Temp = Console.ReadLine(); Them th = new Them(thuvien.XoaSachGT); th(Ma_Temp); break; } default: { Console.WriteLine("Nhap sai "); break; } } break; } default: { Console.WriteLine("Nhap sai "); break; } } break; } case 6: { DanhSach ds = new DanhSach(thuvien.XuatTatCaThuThu); ds(); Console.WriteLine(" Nhap them nhan vien(0 la thoat, 1 la nhap): "); int ChonChonChon = Convert.ToInt32(Console.ReadLine()); switch (ChonChonChon) { case 0: { break; } case 1: { thuvien.DangKyThuThuMoi(); break; } default: { break; } } break; } default: { Console.WriteLine("Nhap sai "); break; } } Console.Write("\n Nhan phim so 0 + Enter de ket thuc or Nhan phim so khac 0 + Enter de tro ve Menu: "); Temp = Convert.ToInt32(Console.ReadLine()); Console.Write("\n\n"); } while (Temp != 0); }