public static List <Connection.Model.TblBarcode> ReturnAllGoods() { using (var context = new Connection.Model.BarcodeEntity()) { return(context.TblBarcode.AsNoTracking().ToList()); } }
public static bool CheckForRepetitive(string CodeS, int ID) { using (var context = new Connection.Model.BarcodeEntity()) { try { return(context.TblBarcode.Any(a => a.Barcode2.ToLower() == CodeS.ToLower() && a.GoodsID == ID)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }
public static bool CheckForRepetitive(string naka, int ID) { using (var context = new Connection.Model.BarcodeEntity()) { try { return(context.TblInventory.Any(a => (a.Name == naka) && a.Shka != ID)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }
public static string ReadByBarcode(string naka, int ID) { using (var context = new Connection.Model.BarcodeEntity()) { try { return(context.TblInventory.FirstOrDefault(a => (a.Name == naka) && a.Shka != ID).Name); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(string.Empty); } } }
public static bool Delete(int ID) { using (var context = new Connection.Model.BarcodeEntity()) { try { context.TblBarcode.Remove(context.TblBarcode.Find(ID)); context.SaveChanges(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }
public static bool Create(Connection.Model.TblBarcode AllGoodsInstance) { using (var context = new Connection.Model.BarcodeEntity()) { try { context.TblBarcode.Add(AllGoodsInstance); context.SaveChanges(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }
public static bool Update(Connection.Model.TblInventory ObjectName) { using (var context = new Connection.Model.BarcodeEntity()) { try { var Ins = context.TblInventory.Where(a => a.Shka == ObjectName.Shka).FirstOrDefault(); Ins.Name = ObjectName.Name; context.SaveChanges(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }
public static List <Connection.Services.GoodsService> ReturnAllGoodsByService(int ID) { using (var context = new Connection.Model.BarcodeEntity()) { return((from read in context.TblBarcode join read2 in context.TblInventory on read.GoodsID equals read2.Shka where read.GoodsID == ID select new Connection.Services.GoodsService { GoodsBarcode1 = read.Barcode1, GoodsBarcode2 = read.Barcode2, GoodsID = read.GoodsID, GoodsName = read2.Name, Total = string.Empty, RowID = read.RowID, }).ToList()); } }
public static bool Delete(int ID) { using (var context = new Connection.Model.BarcodeEntity()) { try { if (context.TblBarcode.Any(a => a.GoodsID == ID)) { System.Windows.Forms.MessageBox.Show("براي اين كالا باركد تعريف شده است، ابتدا باركدها را حذف نماييد"); return(false); } context.TblInventory.Remove(context.TblInventory.Find(ID)); context.SaveChanges(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return(false); } } }