public List <Shelve> GetShelves(string warehouseId, string sku) { List <Shelve> shelves = new List <Shelve>(); using (ERPContext context = new ERPContext(m_connectionString)) { var q = from ebayShelve in context.EbayShelve where ebayShelve.Sku.StartsWith(sku) where ebayShelve.WarehouseId == warehouseId where ebayShelve.Active == "Y" orderby ebayShelve.Sku, ebayShelve.ShelveId, ebayShelve.ShipmentId, ebayShelve.BoxId select ebayShelve; foreach (var row in q) { Shelve shelve = new Shelve(); shelve.SKU = row.Sku; shelve.ShelveId = row.ShelveId; shelve.ShipmentId = row.ShipmentId; shelve.BoxId = row.BoxId; shelves.Add(shelve); } } return(shelves); }
private void Count_Click(object sender, RoutedEventArgs e) { var adress = AdressTextBox.Text; if (string.IsNullOrEmpty(adress)) { MessageBox.Show("Error! Adress is a required field", "Adress error", MessageBoxButton.OK, MessageBoxImage.Error); return; } bool isExist = libraries.Any(value => value.Adress == adress); if (!isExist) { MessageBox.Show("Error! There is no such a library", "Adress error", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { int sum = 0; Library library = libraries.ToList().Where(_library => _library.Adress == adress).FirstOrDefault(); foreach (Shelve shelve in shelves) { Shelve current_shelve = library.ShelvesInLibrary.Find(_shelve => _shelve.Id == shelve.Id); if (current_shelve != null && current_shelve.BooksOnShelve != null) { sum += current_shelve.BooksOnShelve.Count; } } List <string> list = new List <string>(); list.Add(sum.ToString()); countBox.ItemsSource = list; } }
public ActionResult CreateShelve(string name) { Shelve shelveToAdd = new Shelve() { Id = Guid.NewGuid(), Name = name }; _shelveService.AddEntity(shelveToAdd); return(Ok(shelveToAdd)); }
private void save_Click(object sender, EventArgs e) { Shelve shelve = new Shelve { ShelveId = RandomString.RandString(15), ShelveName = txtShelve_Name.Text.Trim() }; db.InsertShelve(Collection, shelve); ClearText(); frmLoad(); }
public string Post([FromBody] Shelve shelve) { Shelve shelve1 = new Shelve { Name = shelve.Name, DateCreate = shelve.DateCreate, iduser = shelve.iduser }; contaxt1.Shelves.Add(shelve1); contaxt1.SaveChanges(); return("its Okey !!"); }
public string Put(int id, [FromBody] Shelve shelve) { var xxx = contaxt1.Shelves.Find(id); if (xxx == null) { return("This is not exist "); } xxx.Name = shelve.Name; xxx.DateCreate = shelve.DateCreate; xxx.iduser = shelve.iduser; contaxt1.SaveChanges(); return("Okey shod "); }
public string AddShelveToUser([FromBody] Shelve shelvee, int IdUser) { if (_contaxt.Shelves.Any(x => x.id == shelvee.id && x.iduser == IdUser)) { return("this shelf is exist "); } else { Shelve shelve1 = new Shelve { Name = shelvee.Name, iduser = IdUser, DateCreate = DateTime.Now, }; _contaxt.Shelves.Add(shelve1); _contaxt.SaveChanges(); return("register is okey !!!"); } }
public void AddEntity(Shelve entity) { _context.Shelves.Add(entity); _context.SaveChanges(); }