public void TestCapNhatKho() { DoAnWeb.KhoXe lx = new KhoXe(); DoAnWeb.Areas.Admin.Controllers.ProductsController ctrl = new DoAnWeb.Areas.Admin.Controllers.ProductsController(); string result = ctrl.CapNhatKho(lx); Assert.AreNotEqual("Success", result); }
public void CapNhatKhoXe(string machiec, string maxe) { KhoXe x = new KhoXe(); x.MaChiec = machiec; x.MaXe = maxe; xe.CapNhatKhoXe(x); }
public void ThemXeVaoKho(string machiec, string maxe, string tinhTrang) { KhoXe x = new KhoXe(); x.MaChiec = machiec; x.MaXe = maxe; x.DaBan = tinhTrang; xe.ThemXeVaoKho(x); }
public static void Sua(ArrayList arrayList) { KhoXe ob = Find(arrayList); Console.WriteLine("Nhập tên xe"); ob.Tenxe = Nhap.NhapString(); Console.WriteLine("Nhập mã loại"); ob.Maloai = Nhap.NhapString(); Console.WriteLine("Nhập số lượng nhập về"); ob.Slnhapve = Nhap.NhapInt(); Console.WriteLine("Nhập số lượng hiện có"); ob.Slhienco = Nhap.NhapInt(); }
public static KhoXe Find(ArrayList arrayList) { KhoXe kq = null; Console.WriteLine("Nhập mã xe: "); string tk = Nhap.NhapString(); foreach (KhoXe ob in arrayList) { if (tk == ob.Maxe.ToString()) { kq = ob; } } return(kq); }
public List <KhoXe> LayKhoXe() { List <KhoXe> listKhoXe = new List <KhoXe>(); var lstKhoXe = db.spKhoXe_SelectAll().ToList(); foreach (var n in lstKhoXe) { KhoXe e = new KhoXe() { MaChiec = n.MaChiec, MaXe = n.MaXe, DaBan = n.DaBan }; listKhoXe.Add(e); } return(listKhoXe); }
public string CapNhatKho(KhoXe KhoXe) { try { KhoXe data = daw.KhoXes.Where(x => x.IdKhoXe == KhoXe.IdKhoXe).FirstOrDefault(); NguoiDung nd = daw.NguoiDungs.Where(x => x.TenNguoiDung == "admin" && x.IsDeleted == false).FirstOrDefault(); data.TenKho = KhoXe.TenKho; data.DiaChi = KhoXe.DiaChi; daw.KhoXes.Attach(data); daw.Entry(data).State = EntityState.Modified; daw.SaveChanges(); return("Success"); } catch (Exception) { throw; return(""); } }
//phần cập nhật kho public ActionResult CapNhatKho(string IdKho) { string url = Request.Url.AbsoluteUri; string[] ArrayUrl = url.Split('/'); int count = ArrayUrl.Length; if (IdKho == null) { IdKho = ArrayUrl[count - 1]; } Guid IdKhoCapNhat = new Guid(IdKho); KhoXe KhoUpdate = daw.KhoXes.Where(x => x.IdKhoXe == IdKhoCapNhat && x.IsDeleted == false).FirstOrDefault(); if (KhoUpdate != null) { ViewBag.KhoUpdate = KhoUpdate; } return(View()); }
public JsonResult ThemKhoXe(KhoXe khoXe) { string message = ""; var checkKhoXe = daw.KhoXes.Where(x => x.TenKho.Trim().ToUpper() == khoXe.TenKho.Trim().ToUpper()).FirstOrDefault(); if (checkKhoXe != null) { message = "Kho xe này đã có trong dữ liệu"; } else { khoXe.IdKhoXe = Guid.NewGuid(); khoXe.IsDeleted = false; khoXe.TinhTrang = true; daw.KhoXes.Add(khoXe); daw.SaveChanges(); message = "Success"; } return(new JsonResult { Data = message, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public void CapNhatKhoXe(KhoXe khoxe) { db.spKhoXe_Update(khoxe.MaChiec, khoxe.MaXe); }
public void ThemXeVaoKho(KhoXe khoxe) { db.spKhoXe_Insert(khoxe.MaChiec, khoxe.MaXe, khoxe.DaBan); }
public static void HienThi(KhoXe ob) { Console.WriteLine("|{0,-20}|{1,-20}|{2,-20}|{3,-20}|{4,-20}|", ob.Maxe, ob.Tenxe, ob.Maloai, ob.Slnhapve, ob.Slhienco); }