public MStockitem GetModel(int ItemNo) { if (ClStockitem != null && ClStockitem.Any() && ClStockitem.Where(i => i.ItemNo.Equals(ItemNo)).Any()) { return(ClStockitem.Where(i => i.ItemNo.Equals(ItemNo)).FirstOrDefault()); } return(null); }
public MStockitem GetModel(string ItemName) { if (ClStockitem != null && ClStockitem.Any() && ClStockitem.Where(i => i.ItemName.ToLower().Equals(ItemName.ToLower())).Any()) { return(ClStockitem.Where(i => i.ItemName.Equals(ItemName.ToLower())).FirstOrDefault()); } return(null); }
private void Button_Click(object sender, RoutedEventArgs e) { Keyboard.ClearFocus(); if (ClStockitem != null && ClStockitem.Where(i => i.IsChanged).Any()) { if (ClStockitem.Where(i => i.IsChanged && string.IsNullOrEmpty(i.ItemName)).Any()) { MessageBox.Show("Item name shouldn't be empty for the changed rows "); return; } CallCustomEvent(sender, e, "UpdateStock", ClStockitem); } else { MessageBox.Show("Nothing to update"); } }
private void AddItemButtonClick(object sender, RoutedEventArgs e) { //var CurrentRowCount = McDataGrid.Items.Count; if (ClStockitem != null && ClStockitem.Any() && ClStockitem.Where(i => string.IsNullOrEmpty(i.ItemName)).Any()) { MessageBox.Show("Please insert valid data in the last column then procced to add new ones"); return; } else if (ClStockitem != null && ClStockitem.Count == 0) { MessageBox.Show("Please insert valid data in first columns then procced to add new ones"); return; } else { Keyboard.ClearFocus(); } //if(CurrentRowCount.Equals(McDataGrid.Items.Count)) //{ // MessageBox.Show("Please insert valid data in the last column then procced to add new ones"); // return; //} }