示例#1
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);
         }
     }
 }
示例#2
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);
         }
     }
 }
示例#3
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);
         }
     }
 }
示例#4
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);
         }
     }
 }