public List <NCC> TimNCC(NCC ncc) { List <NCC> list = nccDAL.GetData(); List <NCC> kq = new List <NCC>(); if (ncc.maNCC == null && ncc.tenNCC == null) { kq = list; } if (ncc.tenNCC != null && ncc.maNCC == null) { for (int i = 0; i < list.Count; ++i) { if (list[i].tenNCC.IndexOf(ncc.tenNCC) >= 0) { kq.Add(new NCC(list[i])); } } } else if (ncc.tenNCC == null && ncc.maNCC != null) { for (int i = 0; i < list.Count; ++i) { if (list[i].maNCC == ncc.maNCC) { kq.Add(new NCC(list[i])); } } } else { kq = null; } return(kq); }
private void btDel_Click(object sender, EventArgs e) { if (this.dataNCCs.SelectedRows.Count <= 0) { return; } NCC nCC = NCCController.getNCC(this.dataNCCs.SelectedRows[0].Cells[0].Value.ToString()); NCCController.DeleteNCC(nCC); /////Hien thi datagridview BindingSource source = new BindingSource(); source.DataSource = NCCController.getListNCCs(); this.dataNCCs.DataSource = source; /* * try * { * this.dataitem.Rows.RemoveAt(this.dataitem.CurrentCell.RowIndex); * } * catch * { * MessageBox.Show("Hay chon dong can xoa"); * } */ }
public IHttpActionResult PutNCC(string id, NCC nCC) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCC.MA_NHA_CUNG_CAP) { return(BadRequest()); } db.Entry(nCC).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NCCExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public List <NCC> TimNhaCC(NCC nc) { List <NCC> list = NCCDA.GetData(); List <NCC> KQ = new List <NCC>(); //Tìm theo mã if (nc.mancc != 0 && nc.tenncc == null && nc.diachi == null && nc.sdt == null) { for (int i = 0; i < list.Count; ++i) { if (list[i].mancc == nc.mancc) { KQ.Add(new NCC(list[i])); } } } else if (nc.mancc == 0 && nc.tenncc != null) { for (int i = 0; i < list.Count; i++) { if (list[i].tenncc == nc.tenncc) { KQ.Add(new NCC(list[i])); } } } else { KQ = null; } return(KQ); }
private void btnThem_Click(object sender, EventArgs e) { if (txtMaNCC.Text == "") { MessageBox.Show("Mã NCC không được để trống !"); } else if (txtTenNCC.Text == "") { MessageBox.Show("Tên NCC không được để trống !"); } else if (txtDiaChi.Text == "") { MessageBox.Show(" Địa chỉ không được để trống !"); } else if (txtSDT.Text == "") { MessageBox.Show("Số điện thoại không được để trống !"); } else { NCC ncc = new NCC(txtMaNCC.Text, txtTenNCC.Text, txtDiaChi.Text, txtSDT.Text); if (bus_ncc.Them(ncc)) { MessageBox.Show("Thêm rồi !"); } else { MessageBox.Show("Nhập lỗi !"); } } frmNCCcs_Load(sender, e); }
public IHttpActionResult PostNCC(NCC nCC) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NCCs.Add(nCC); try { db.SaveChanges(); } catch (DbUpdateException) { if (NCCExists(nCC.MA_NHA_CUNG_CAP)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nCC.MA_NHA_CUNG_CAP }, nCC)); }
public async Task <IActionResult> PutNCC(int id, NCC nCC) { if (id != nCC.ID) { return(BadRequest()); } _context.Entry(nCC).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCCExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void xoa() { Console.Clear(); Console.WriteLine("XOA THONG TIN NHA CUNG CAP "); List <NCC> list = spDLL.GetAllNCC(); string ma; Console.Write("Nhap ma hoa don ban can xoa:"); ma = Console.ReadLine(); int i = 0; for (i = 0; i < list.Count; ++i) { if (list[i].Mancc == ma) { break; } } if (i < list.Count) { NCC b = new NCC(list[i]); spDLL.xoancc(b); } else { Console.WriteLine("Khong ton tai nha cung cap nay"); } }
public async Task <IActionResult> Edit(int id, [Bind("ID,TenNCC,DiaChi,TrangThai")] NCC nCC) { if (id != nCC.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nCC); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCCExists(nCC.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nCC)); }
public async Task <ActionResult <NCC> > PostNCC(NCC nCC) { _context.NCC.Add(nCC); await _context.SaveChangesAsync(); return(CreatedAtAction("GetNCC", new { id = nCC.ID }, nCC)); }
public void Xoa() { Console.Clear(); Console.WriteLine("XÓA THÔNG TIN NHÀ CUNG CẤP"); List <NCC> list = nhacc.XemDSNhaCC(); int mancc; Console.Write("Nhập mã nhà cung cấp cần xóa:"); mancc = int.Parse(Console.ReadLine()); int i = 0; for (i = 0; i < list.Count; ++i) { if (list[i].mancc == mancc) { break; } } if (i < list.Count) { NCC nv = new NCC(list[i]); nhacc.XoaNhaCC(mancc); } else { Console.WriteLine("Không tồn tại mã nhà cung cấp này"); } }
public void Insert(NCC ncc) { int mancc = CongCu.TachSo(maNCC) + 1; StreamWriter sw = File.AppendText(txtfile); sw.WriteLine("NCC" + mancc + "\t" + ncc.tenNCC + "\t" + ncc.diaChi + "\t" + ncc.soDT); sw.Close(); }
public static int Delete_NCC(NCC a) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@mancc", a.MaNCC), }; return(DataProvider.ExecuteNonQuery("Delete_NCC", para)); }
public ActionResult DeleteConfirmed(string id) { NCC nCC = db.NCCs.Find(id); db.NCCs.Remove(nCC); db.SaveChanges(); return(RedirectToAction("Index")); }
public static int xoa_NCC(NCC a) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@maNCC", a.MaNCC), }; return(Dataprovider.ExecuteNonQuery("xoa_NCC", para)); }
public ActionResult ThemMoiNCC(NCC ncc) { if (ModelState.IsValid) { data.NCCs.InsertOnSubmit(ncc); data.SubmitChanges(); } return(RedirectToAction("NhaCC")); }
public ActionResult EditNCC(NCC ncc) { if (ModelState.IsValid) { UpdateModel(ncc); data.SubmitChanges(); } return(RedirectToAction("NhaCC")); }
//Chèn một bản ghi nhà cung cấp vào tệp public void themNCC(NCC ncc) { string mancc = DateTime.Now.ToString("ss"); StreamWriter fwrite = File.AppendText(txtfile); fwrite.WriteLine(); fwrite.Write(mancc + "#" + ncc.Tenncc + "#" + ncc.Diachi + "#" + ncc.Sdt); fwrite.Close(); }
//Chèn một bản ghi nhà cung cấp vào tệp public void Insert(NCC nc) { int manc = nc.mancc + 1; StreamWriter fwrite = File.AppendText(txtfile2); fwrite.WriteLine(); fwrite.Write(manc + "\t" + nc.tenncc + "\t" + nc.diachi + "\t" + nc.sdt); fwrite.Close(); }
public ActionResult Edit([Bind(Include = "MaNCC,TenNCC,DiaChi,DienThoai,TKNH,Email")] NCC nCC) { if (ModelState.IsValid) { db.Entry(nCC).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nCC)); }
public void SuaNCC(NCC ncc) { if (KT_MaNCC(ncc.maNCC) == true) { nccDAL.Update(ncc); } else { throw new Exception("Không tồn tại mã này."); } }
public ActionResult Create([Bind(Include = "MaNCC,TenNCC,DiaChi,DienThoai,TKNH,Email")] NCC nCC) { if (ModelState.IsValid) { db.NCCs.Add(nCC); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nCC)); }
public void themncc(NCC ncc) { if (ncc.Tenncc != "") { lhncc.themNCC(ncc); } else { throw new Exception("Du lieu sai"); } }
public async Task <IActionResult> Create([Bind("ID,TenNCC,DiaChi,TrangThai")] NCC nCC) { if (ModelState.IsValid) { _context.Add(nCC); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nCC)); }
public IHttpActionResult GetNCC(string id) { NCC nCC = db.NCCs.Find(id); if (nCC == null) { return(NotFound()); } return(Ok(nCC)); }
public void ThemNhaCC(NCC nc) { if (nc.tenncc != "" && nc.diachi != "") { NCCDA.Insert(nc); } else { throw new Exception("Du lieu sai!"); } }
public void SuaNhaCC(NCC nc) { if (KiemTra(nc.mancc) == true) { NCCDA.Update(nc); } else { throw new Exception("Không tồn tại mã này."); } }
public ActionResult EditNCC(int id) { NCC ncc = data.NCCs.SingleOrDefault(n => n.MANCC == id); ViewBag.MANCC = ncc.MANCC; if (ncc == null) { Response.StatusCode = 404; return(null); } return(View(ncc)); }
public static int them_NCC(NCC a) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@maNCC", a.MaNCC), new SqlParameter("@tenNCC", a.TenNCC), new SqlParameter("@diaChi", a.DiaChi), new SqlParameter("@SDT", a.SoDT), new SqlParameter("@email", a.Email), }; return(Dataprovider.ExecuteNonQuery("them_NCC", para)); }
public static int Update_NCC(NCC a) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@mancc", a.MaNCC), new SqlParameter("@tenncc", a.TenNCC), new SqlParameter("@diachincc", a.DiaChi), new SqlParameter("@sdtncc", a.SDT), new SqlParameter("@email", a.Email), }; return(DataProvider.ExecuteNonQuery("Update_NCC", para)); }
public void OutputResults(NCC.NCCAction action = NCC.NCCAction.Nothing) { if (action == NCCAction.Nothing) action = NC.App.Opstate.Action; switch (action) // these are the actions available from the command line only { case NCCAction.HVCalibration: if (ctrlHVCalib != null) { collog.TraceInformation("Producing HV Calib results output file"); ctrlHVCalib.GenerateReport(); } break; case NCCAction.Assay: collog.TraceInformation("Producing Assay results output file"); ReportMangler rm = new ReportMangler(ctrllog); rm.GenerateReports(CurState.Measurement); NC.App.DB.AddResultsFileNames(CurState.Measurement); break; } }
public void Construct(RawAnalyzerHandler.AnalysesCompleted f, RawAnalyzerHandler.NeutronOutOfSequenceErrorEvent f2, RawAnalyzerHandler.BlockCountMismatchErrorEvent f3, double theTicSizeInSeconds, NCC.CancelStopAbort csa) { handler = new RawAnalyzerHandler(theTicSizeInSeconds:theTicSizeInSeconds,logger:logger); handler.OnAnalysesCompleted += f; handler.OnNeutronOutOfSequenceErrorEvent += f2; handler.OnBlockCountMismatchErrorEvent += f3; handler.csa = csa; }