예제 #1
0
 public static List <Connection.Model.TblBarcode> ReturnAllGoods()
 {
     using (var context = new Connection.Model.BarcodeEntity())
     {
         return(context.TblBarcode.AsNoTracking().ToList());
     }
 }
예제 #2
0
 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);
         }
     }
 }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 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);
         }
     }
 }
예제 #6
0
 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);
         }
     }
 }
예제 #7
0
 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);
         }
     }
 }
예제 #8
0
 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());
     }
 }
예제 #9
0
 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);
         }
     }
 }