public DataAccessSearch.ItemImage GetApprovedImageUrl() { context = new AddisTowerDataContext(); DataAccessSearch.Sparepart motorcycle = GetApprovedSparepart(); var selectedMotor = from p in context.ItemImages where p.MotorOrSpareId == motorcycle.Id select p; return(selectedMotor.First()); }
public void UnApproveSelected() { var selectedApproved = from p in context.Spareparts where p.Approve == true select p; if (!selectedApproved.Equals(null)) { DataAccessSearch.Sparepart sparepart = selectedApproved.First(); sparepart.Approve = false; context.SubmitChanges(); } }
public void UpdateSparepart(Guid Id, string Number, string Name, string Model, bool Approve, string Description, double Quantity) { context = new AddisTowerDataContext(); if (Approve) { UnApproveSelected(); } var selectedSparepart = from p in context.Spareparts where p.Id == Id select p; DataAccessSearch.Sparepart sparepart = selectedSparepart.First(); sparepart.Number = Number; sparepart.Name = Name; sparepart.Model = Model; sparepart.Approve = Approve; sparepart.Description = Description; sparepart.Quantity = Quantity; context.SubmitChanges(); }
public void InsertNewSparepart(Guid CategoryId, string Number, string Name, string Model, bool Approve, string Description, double Quantity) { context = new AddisTowerDataContext(); if (Approve) { UnApproveSelected(); } var sparePartEntity = new DataAccessSearch.Sparepart { Approve = Approve, CategoryId = CategoryId, Description = Description, Id = Guid.NewGuid(), Model = Model, Name = Name, Number = Number, Quantity = Quantity }; context.Spareparts.InsertOnSubmit(sparePartEntity); context.SubmitChanges(); }
partial void DeleteSparepart(Sparepart instance);
partial void UpdateSparepart(Sparepart instance);
partial void InsertSparepart(Sparepart instance);