public List<GOPY> SelectGopYsAll() { List<GOPY> list = new List<GOPY>(); using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString)) { ISingleResult<GOPY_getallResult> lp = db.GOPY_getall(); foreach (GOPY_getallResult GOPY in lp) { GOPY var1 = new GOPY(); var1.MaGopY = GOPY.MaGopY; var1.TieuDe = GOPY.TieuDe; var1.NoiDungGopY = GOPY.NoiDungGopY; var1.MSSV = GOPY.MSSV; var1.Email = GOPY.Email; list.Add(var1); } try { // Save the changes. db.SubmitChanges(); } // Detect concurrency conflicts. catch (ChangeConflictException) { // Resolve conflicts. db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges); } } return list; }
//góp ý public int GopY(GOPY entity, int maKH) { entity.MaKH = maKH; entity.NgayGopY = DateTime.Now; db.GOPies.Add(entity); db.SaveChanges(); return(entity.MaGopY); }
public int Them(GOPY lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); db.GOPY_add(lpDTO.TieuDe, lpDTO.NoiDungGopY, lpDTO.MSSV, lpDTO.Email ); return 1; } catch { return 0; } }
public ActionResult GopY(GOPY gy) { var session = (UserLogin)Session[CommonConstants.SESSION]; if (ModelState.IsValid) { var dao = new UserDao(); int id = dao.GopY(gy, session.MaKH); if (id > 0) { return(Redirect("/gop-y-thanh-cong")); } else { ModelState.AddModelError("", "Góp ý không thành công!"); return(View()); } } return(View()); }
public int Them(GOPY lpDTO) { DAOGopY GopY = new DAOGopY(); return GopY.Them(lpDTO); }
protected void Page_Load(object sender, EventArgs e) { Page.Title = "Danh Sách Góp Ý"; if (!IsPostBack) { int soDong = LoadGopY(); // if (Request.QueryString["id"] != null) // { // for (int i = 0; i < ((List<BAIVIET_getall_newResult>)this.GridViewBaiViet.DataSource).Count; i++) // { // if (((List<BAIVIET_getall_newResult>)this.GridViewBaiViet.DataSource)[i].MaBaiViet.ToString() == Request.QueryString["id"].ToString()) // { // // this.GridViewBaiViet.PageIndex = i / this.GridViewBaiViet.PageSize; // this.GridViewBaiViet.DataBind(); // // this.GridViewBaiViet.Rows[i].CssClass = "selectedrow"; // break; // } // } // } // FilterSTT(soDong, this.GridViewBaiViet.PageIndex, 10); } this.GridViewGopY.HeaderStyle.CssClass = "headerstyle"; int maGopY; if (int.TryParse(Request.QueryString["id"], out maGopY)) { BUSGopY busGopY = new BUSGopY(); GOPY gopy = new GOPY(); gopy = busGopY.LayGopYTheoMa(maGopY); txtTieuDe.Text = gopy.TieuDe; txtNoiDung.Text = gopy.NoiDungGopY; } }
protected void btGopY_Click1(object sender, EventArgs e) { //Lấy user và email if (txtTieuDe.Text == "") { lblThongTin.Text = "Vui lòng tiêu đề của góp ý!"; lblThongTin.Visible = true; return; } if (txtNoiDungGopY.Text == "") { lblThongTin.Text = "Vui lòng nhập nội dung góp ý của bạn!"; lblThongTin.Visible = true; return; } if (txtMSSV.Text == "") { lblThongTin.Text = "Vui lòng nhập MSSV!"; lblThongTin.Visible = true; return; } if (txtEmail.Text == "") { lblThongTin.Text = "Vui lòng nhập địa chỉ Email!"; lblThongTin.Visible = true; return; } //BUSNguoiDung busnguoidung = new BUSNguoiDung(); //NGUOIDUNG sv = busnguoidung.TimKiemTheoUsernameVaEmail(txtMSSV.Text, txtEmail.Text); //if (sv == null) //{ // lblThongTin.Text = "MSSV hoặc email không đúng, vui lòng nhập lại."; //} //else { BUSGopY busGopY = new BUSGopY(); GOPY gopY = new GOPY(); gopY.TieuDe = txtTieuDe.Text; gopY.NoiDungGopY = txtNoiDungGopY.Text; gopY.MSSV = txtMSSV.Text; gopY.Email = txtEmail.Text; int res = busGopY.Them(gopY); if (res == 1) { lblEmail.Visible = false; lblTieuDe.Visible = false; lblMSSV.Visible = false; lblNoiDung.Visible = false; txtTieuDe.Visible = false; lblThongBao.Visible = false; txtMSSV.Visible = false; txtEmail.Visible = false; txtNoiDungGopY.Visible = false; btGopY.Visible = false; lblThongTin.Text = "Cảm ơn bạn đã đóng góp ý kiến nhằm giúp phát triển website!"; } else lblThongTin.Text = "Chưa thực hiện được!"; } }