void loadcbb() { ManHinh mh = new ManHinh(); cbbtenmanhinh.DataSource = mh.loadcbbtenmanhinh(); cbbtennhom.DataSource = mh.loadcbbtennhom(); }
public async Task <IHttpActionResult> PutManHinh(int id, ManHinh manHinh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != manHinh.ID) { return(BadRequest()); } db.Entry(manHinh).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManHinhExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void CapNhatManHinh(string mamanhinh, string tenmanhinh) { ManHinh mh = qlcf.ManHinhs.Where(t => t.MaManHinh == mamanhinh).FirstOrDefault(); mh.TenManHinh = tenmanhinh; qlcf.SubmitChanges(); }
public ActionResult DeleteConfirmed(int id) { ManHinh manHinh = db.ManHinhs.Find(id); db.ManHinhs.Remove(manHinh); db.SaveChanges(); return(RedirectToAction("Index")); }
private void btnthem_Click(object sender, EventArgs e) { ManHinh mh = new ManHinh(); mh.them(cbbtennhom.Text.Trim().ToString(), cbbtenmanhinh.Text.Trim().ToString()); dataGridView1.DataSource = mh.loaddataG(cbbtenmanhinh.Text); MessageBox.Show("Thao tác thành công!"); }
public void load2() { ManHinh mh = new ManHinh(); dataGridView2.DataSource = mh.load(manhom); TaiLieuu tl = new TaiLieuu(); cbbtimkiemtheotheloai.DataSource = tl.loadcbbtentheloai(); }
public void ThemManHinh(string pMaMH, string pTenMH) { ManHinh manHinh = new ManHinh(); manHinh.MaManHinh = pMaMH; manHinh.TenManHinh = pTenMH; nhakhoa.ManHinhs.InsertOnSubmit(manHinh); nhakhoa.SubmitChanges(); }
private void btnxoa_Click(object sender, EventArgs e) { string manhom = dataGridView1.CurrentRow.Cells[0].Value.ToString(); ManHinh mh = new ManHinh(); mh.xoa(manhom, cbbtenmanhinh.Text); dataGridView1.DataSource = mh.loaddataG(cbbtenmanhinh.Text); MessageBox.Show("Thao tác thành công!"); }
public bool Kiemtrakhoachinh(string mamanhinh) { ManHinh mh = qlcf.ManHinhs.Where(t => t.MaManHinh == mamanhinh).FirstOrDefault(); if (mh == null) { return(true); } return(false); }
public bool kiemtraMaManHinh(string mamh) { ManHinh mh = db.ManHinhs.Where(a => a.MaManHinh == mamh).FirstOrDefault(); if (mh != null) { return(false); } return(true); }
public async Task <IHttpActionResult> GetManHinh(int id) { ManHinh manHinh = await db.ManHinhs.FindAsync(id); if (manHinh == null) { return(NotFound()); } return(Ok(manHinh)); }
public async Task <IHttpActionResult> PostManHinh(ManHinh manHinh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ManHinhs.Add(manHinh); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = manHinh.ID }, manHinh)); }
public ActionResult Edit([Bind(Include = "ID,ManHinhSo,PortInfomaitonElectricID")] ManHinh manHinh) { int PortInfomaitonElectricID = db.Users.Where(user => user.Id == AccountID).Select(p => p.PortInfomaitonElectricID).FirstOrDefault(); ViewBag.PortInfomaitonElectric = db.PortInfomaitonElectrics.ToList().Where(p => p.IsPublic && p.ID == PortInfomaitonElectricID); if (ModelState.IsValid) { db.Entry(manHinh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(manHinh)); }
IEnumerator LoadObject() { model = GameObject.FindGameObjectWithTag("Model"); manHinh = model.GetComponent <ManHinh>(); manHinh.loadingScreen.SetActive(true); yield return(new WaitForEndOfFrame()); menu = model.GetComponent <Menu>(); yield return(new WaitForSeconds(0.1f)); eve = model.GetComponent <Event>(); eve.textNum = 0; menu.menuList.SetActive(false); yield return(new WaitForSeconds(0.1f)); backGround = model.GetComponent <BackGround>(); yield return(new WaitForSeconds(0.1f)); tg = model.GetComponent <ThoiGian>(); tg.dayNow = DateTime.Now.Day; tg.dayPrev = tg.dayNow - 1; yield return(new WaitForSeconds(0.1f)); if (!thPlay) { calendar = GameObject.FindGameObjectWithTag("Calendar").GetComponent <CalendarController>(); yield return(new WaitForSeconds(0.1f)); GetSelectedDayInCal(); } music = GameObject.FindGameObjectWithTag("Music").GetComponent <Music>(); yield return(new WaitForSeconds(0.1f)); sound = model.GetComponent <AudioSource>(); music.musicSound = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioSource>(); yield return(new WaitForSeconds(0.1f)); if (!thPlay) { ThayDoiNhacNen(music.normalMusic); } yield return(new WaitForSeconds(0.1f)); stat = model.GetComponent <PlayerStat>(); stat.LoadStat(PlayerPrefs.GetInt("idTKCurrent")); gameObject.GetComponent <EventController>().LoadCotTruyen(); yield return(new WaitForSeconds(0.1f)); loadComplete = true; manHinh.loadingScreen.SetActive(false); }
public async Task <IHttpActionResult> DeleteManHinh(int id) { ManHinh manHinh = await db.ManHinhs.FindAsync(id); if (manHinh == null) { return(NotFound()); } db.ManHinhs.Remove(manHinh); await db.SaveChangesAsync(); return(Ok(manHinh)); }
// GET: ManHinhs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ManHinh manHinh = db.ManHinhs.Find(id); if (manHinh == null) { return(HttpNotFound()); } return(View(manHinh)); }
public bool XoaManHinh(string pMaMH) { ManHinh manHinh = nhakhoa.ManHinhs.Where(mh => mh.MaManHinh == pMaMH).FirstOrDefault(); if (manHinh != null) { nhakhoa.ManHinhs.DeleteOnSubmit(manHinh); nhakhoa.SubmitChanges(); return(true); } else { return(false); } }
public int DeleteManHinhs(string qMaMH) { ManHinh manHinhs = qlhh.ManHinhs.Where(t => t.MaMH == qMaMH).FirstOrDefault(); if (manHinhs != null) { qlhh.ManHinhs.DeleteOnSubmit(manHinhs); qlhh.SubmitChanges(); return(1); } else { return(0); } }
public int UpdateManHinhs(string qMaMH, string qTenMH) { ManHinh manHinhs = qlhh.ManHinhs.Where(t => t.MaMH == qMaMH).FirstOrDefault(); if (manHinhs != null) { manHinhs.TenMH = qTenMH; qlhh.SubmitChanges(); return(1); } else { return(0); } }
public void suaManHinh(string mamanhinh, string tenmanhinh) { if (kiemtraMaManHinh(mamanhinh)) { MessageBox.Show("Mã màn hình không tồn tại."); return; } ManHinh mh = db.ManHinhs.Where(a => a.MaManHinh == mamanhinh).FirstOrDefault(); if (mh != null) { mh.TenManHinh = tenmanhinh; db.SubmitChanges(); MessageBox.Show("Sửa thành công."); } }
public void XoaManHinh(string mamanhinh) { ManHinh mh = qlcf.ManHinhs.Where(t => t.MaManHinh == mamanhinh).FirstOrDefault(); List <PhanQuyen> lst = new List <PhanQuyen>(); foreach (PhanQuyen pq in qlcf.PhanQuyens) { if (pq.MaManHinh == mamanhinh) { lst.Add(pq); } } qlcf.PhanQuyens.DeleteAllOnSubmit(lst); qlcf.ManHinhs.DeleteOnSubmit(mh); qlcf.SubmitChanges(); }
// GET: ManHinhs/Edit/5 public ActionResult Edit(int?id) { int PortInfomaitonElectricID = db.Users.Where(user => user.Id == AccountID).Select(p => p.PortInfomaitonElectricID).FirstOrDefault(); ViewBag.PortInfomaitonElectric = db.PortInfomaitonElectrics.ToList().Where(p => p.IsPublic && p.ID == PortInfomaitonElectricID); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ManHinh manHinh = db.ManHinhs.Find(id); if (manHinh == null) { return(HttpNotFound()); } return(View(manHinh)); }
public int AddManHinhs(string qMaMH, string qTenMH) { ManHinh manHinhs = qlhh.ManHinhs.Where(t => t.MaMH == qMaMH).FirstOrDefault(); if (manHinhs == null) { ManHinh mh = new ManHinh(); mh.MaMH = qMaMH; mh.TenMH = qTenMH; qlhh.ManHinhs.InsertOnSubmit(mh); qlhh.SubmitChanges(); return(1); } else { return(0); } }
public void ThemmanHinh(string mamanhinh, string tenmanhinh) { ManHinh mh = new ManHinh(); mh.MaManHinh = mamanhinh; mh.TenManHinh = tenmanhinh; qlcf.ManHinhs.InsertOnSubmit(mh); foreach (NhomNhanVien tk in qlcf.NhomNhanViens) { PhanQuyen phanquyen = new PhanQuyen(); phanquyen.MaManHinh = mamanhinh; phanquyen.MaNhomNV = tk.MaNhomNV; phanquyen.CoQuyen = true; qlcf.PhanQuyens.InsertOnSubmit(phanquyen); } qlcf.SubmitChanges(); }
public void xoaManHinh(string mamanhinh) { if (kiemtraMaManHinh(mamanhinh)) { MessageBox.Show("Mã màn hình không tồn tại."); return; } ManHinh manhinh = db.ManHinhs.Where(a => a.MaManHinh == mamanhinh).FirstOrDefault(); if (manhinh != null) { db.ManHinhs.DeleteOnSubmit(manhinh); xoaManHinhVaXoaTrongPhanQuyen(mamanhinh); db.SubmitChanges(); MessageBox.Show("Xoá thành công màn hình '" + mamanhinh + "'"); return; } else { return; } }
public void themManHinh(string mamanhinh, string tenmanhinh) { if (!kiemtraMaManHinh(mamanhinh)) { MessageBox.Show("Mã màn hình đã tồn tại."); return; } if (string.IsNullOrEmpty(mamanhinh) || string.IsNullOrEmpty(tenmanhinh)) { MessageBox.Show("Vui lòng nhập đầy đủ dữ liệu."); return; } ManHinh mh = new ManHinh(); mh.MaManHinh = mamanhinh; mh.TenManHinh = tenmanhinh; db.ManHinhs.InsertOnSubmit(mh); themMaManHinhVaoPhanQuyen(mamanhinh); MessageBox.Show("Thêm thành công."); db.SubmitChanges(); }
private void cbbtenmanhinh_SelectedIndexChanged(object sender, EventArgs e) { ManHinh mh = new ManHinh(); dataGridView1.DataSource = mh.loaddataG(cbbtenmanhinh.Text); }