public List<KHAOSAT> SelectKHAOSATsAll() { List<KHAOSAT> list = new List<KHAOSAT>(); using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString)) { ISingleResult<KHAOSAT_getallResult> lp = db.KHAOSAT_getall(); foreach (KHAOSAT_getallResult KHAOSAT in lp) { KHAOSAT var1 = new KHAOSAT(); var1.MaDapAn = KHAOSAT.MaDapAn ; var1.MaYKKS = KHAOSAT.MaYKKS ; var1.YKienKhac = KHAOSAT.YKienKhac ; list.Add(var1); } try { // Save the changes. db.SubmitChanges(); } // Detect concurrency conflicts. catch (ChangeConflictException) { // Resolve conflicts. db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges); } } return list; }
protected void btnThem_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox KHAOSAT lpDTO = new KHAOSAT(); lpDTO.YKienKhac = txtykienkhac.Text; lpDTO.MaDapAn = int.Parse(txtmadapan.Text); //Goi ham cap nhat BUSKhaoSat BUSKhaoSat = new BUSKhaoSat(); if (BUSKhaoSat.Them(lpDTO) == 0) { //Thong bao lbThongBao.Text = "Thêm Thành Công"; lbThongBao.Visible = true; //Response.Redirect("LoaiMatHang.aspx"); } else { lbThongBao.Text = "Thêm Không Thành Công"; lbThongBao.Visible = true; } } catch { lbThongBao.Text = "Thêm Không Thành Công"; lbThongBao.Visible = true; } }
public ActionResult DeleteConfirmed(int id) { KHAOSAT kHAOSAT = service.Detail(id); kHAOSAT.isDeleted = 1; service.Delete(kHAOSAT); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "MaKS,NgayKS,NguoiKS,DiaChiKS,TiLeDonKhach,GiaKS,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] KHAOSAT kHAOSAT) { if (ModelState.IsValid) { kHAOSAT.isDeleted = 0; service.Add(kHAOSAT); return(RedirectToAction("Index")); } return(View(kHAOSAT)); }
public ActionResult Edit([Bind(Include = "MaKS,NgayKS,NguoiKS,DiaChiKS,TiLeDonKhach,GiaKS,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] KHAOSAT kHAOSAT) { if (ModelState.IsValid) { KHAOSAT ks = service.Detail(kHAOSAT.MaKS); //ks.TenLoai = lOAIXE.TenLoai; //ks.SLGhe = lOAIXE.SLGhe; service.Update(ks); return(RedirectToAction("Index")); } return(View(kHAOSAT)); }
public ActionResult Create([Bind(Include = "MaKS,NgayKS,NguoiKS,DiaChiKS,TiLeDonKhach,GiaKS,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] KHAOSAT kHAOSAT) { string nguoiKhaoSat = Request.Form["nhanVienDropList"].ToString(); if (ModelState.IsValid) { kHAOSAT.isDeleted = 0; kHAOSAT.NguoiKS = Int32.Parse(nguoiKhaoSat); service.Add(kHAOSAT); return(RedirectToAction("Index")); } return(View(kHAOSAT)); }
// GET: KHAOSATs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KHAOSAT kHAOSAT = service.Detail(id); if (kHAOSAT == null) { return(HttpNotFound()); } return(View(kHAOSAT)); }
public int Them(KHAOSAT lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); return db.KHAOSAT_add( lpDTO.MaDapAn , lpDTO.YKienKhac ); } catch (Exception ex) { throw (ex); } }
public void Update(KHAOSAT ks) { var user = HttpContext.Current.Session[GlobalConstant.USER]; if (user != null) { NHANVIEN currentUser = (NHANVIEN)user; ks.lastupdateUser = currentUser.MaNV; } DateTime current = DateTime.Now; ks.lastupdateDate = current; using (QLXeKhachEntities context = new QLXeKhachEntities()) { context.Entry(ks).State = EntityState.Modified; context.SaveChanges(); } }
public int Add(KHAOSAT ks) { using (QLXeKhachEntities context = new QLXeKhachEntities()) { var user = HttpContext.Current.Session[GlobalConstant.USER]; if (user != null) { NHANVIEN currentUser = (NHANVIEN)user; ks.createUser = currentUser.MaNV; ks.lastupdateUser = currentUser.MaNV; } DateTime current = DateTime.Now; ks.createDate = current; ks.lastupdateDate = current; context.KHAOSATs.Add(ks); context.SaveChanges(); return(1); } }
public ActionResult Edit([Bind(Include = "MaKS,NgayKS,NguoiKS,DiaChiKS,TiLeDonKhach,GiaKS,createUser,lastupdateUser,createDate,lastupdateDate,isDeleted")] KHAOSAT kHAOSAT) { string nguoiKhaoSat = Request.Form["nhanVienDropList"].ToString(); if (ModelState.IsValid) { INhanVienService nhanVienService = new NhanVienService(); NHANVIEN nv = nhanVienService.Detail(Int32.Parse(nguoiKhaoSat)); IList <KHAOSAT> ks = service.Detail(kHAOSAT.MaKS); ks[0].NguoiKS = Int32.Parse(nguoiKhaoSat); ks[0].DiaChiKS = kHAOSAT.DiaChiKS; ks[0].TiLeDonKhach = kHAOSAT.TiLeDonKhach; ks[0].GiaKS = kHAOSAT.GiaKS; ks[0].NgayKS = kHAOSAT.NgayKS; ks[0].NHANVIEN = nv; service.Update(ks[0]); return(RedirectToAction("Index")); } return(View(kHAOSAT)); }
protected void btSubmit_Click(object sender, EventArgs e) { int i = -1; i = rblistDanhSachDapAn.SelectedIndex; if (i == -1) { lThongTin.Text = "Bạn chưa chọn đáp án"; } else { KHAOSAT KhaoSat = new KHAOSAT(); BUSKhaoSat KhaoSatBUS = new BUSKhaoSat(); lThongTin.Text = rblistDanhSachDapAn.Items[i].Text; KhaoSat.MaDapAn = int.Parse(rblistDanhSachDapAn.SelectedValue); KhaoSatBUS.Them(KhaoSat); } }
protected void btSubmit_Click(object sender, EventArgs e) { int i = -1; if (((NGUOIDUNG)Session["LOGIN"]) == null) { lbCauHoi.Text = "Mời bạn đăng nhập để tham gia khảo sát!!!"; return; } i = rblDanhSachDapAn.SelectedIndex; if (i == -1) { lThongTin.Text = "Bạn chưa chọn đáp án"; } else { lThongTin.Text = rblDanhSachDapAn.Items[i].Text; KHAOSAT KhaoSat = new KHAOSAT(); KhaoSat.MaDapAn = int.Parse(rblDanhSachDapAn.SelectedValue); BUSKhaoSat KhaoSatBUS = new BUSKhaoSat(); KhaoSatBUS.Them(KhaoSat); } }
public int Xoa(KHAOSAT lpDTO) { try { LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString); db.KHAOSAT_delete( lpDTO.MaYKKS ); db.SubmitChanges(); return 0; } catch (Exception ex) { throw (ex); } }
public int CapNhat(KHAOSAT lpDTO) { DAOKhaoSat KHAOSAT = new DAOKhaoSat(); return KHAOSAT.CapNhat(lpDTO); }
public int Them(KHAOSAT lpDTO) { DAOKhaoSat KHAOSAT = new DAOKhaoSat(); return KHAOSAT.Them(lpDTO); }
public int Xoa(KHAOSAT lpDTO) { DAOKhaoSat KHAOSAT = new DAOKhaoSat(); return KHAOSAT.Xoa(lpDTO ); }
protected void btnXoa_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox int makhaosat = int.Parse(Request.QueryString["id"]); KHAOSAT khaosat = new KHAOSAT(); khaosat.MaYKKS = int.Parse(txtMaYKKS.Text); khaosat.YKienKhac = txtykienkhac.Text; //xac nhan truoc khi xoa DialogResult rs = MessageBox.Show("Bạn có chắc là muốn xoá Hoạt Động <" + khaosat.MaDapAn + "> không?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (rs == DialogResult.Yes) { //Goi ham xoa BUSKhaoSat BUSKhaoSat = new BUSKhaoSat(); if (BUSKhaoSat.Xoa(khaosat) == 0) { //Thong bao lbThongBao.Text = "Xóa Thành Công"; lbThongBao.Visible = true; Response.Redirect("HoatDong.aspx"); } else { lbThongBao.Text = "Xóa Không Thành Công"; lbThongBao.Visible = true; } } else { Response.Redirect("HoatDong.aspx"); } } catch { lbThongBao.Text = "Xoa Không Thành Công"; lbThongBao.Visible = true; } }