コード例 #1
0
 private void LoadEdit()
 {
     if (dataGridView1.RowCount > 0)
     {
         if (dataGridView1.CurrentRow == null)
         {
             dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells["GoodsBarcode"];
         }
         Instance          = (Connection.Model.TblInventory)dataGridView1.CurrentRow.DataBoundItem;
         pnlFooter.Visible = true;
         txtNakaEdit.Text  = Instance.Name;
         txtNakaEdit.Focus();
     }
 }
コード例 #2
0
 public static bool Create(Connection.Model.TblInventory AllGoodsInstance)
 {
     using (var context = new Connection.Model.BarcodeEntity())
     {
         try
         {
             context.TblInventory.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);
         }
     }
 }