public int SaveBillofMaterial(BillOFMaterialModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = new BillOfMaterial()
             {
                 BillOfMaterialId   = model.BillOfMaterialId,
                 BillOfmaterialCode = model.BillOfmaterialCode,
                 ProductId          = model.ProductId,
                 BatchQuantity      = model.BatchQuantity,
                 CartoonQuantity    = model.CartoonQuantity,
                 IsIssued           = model.IsIssued,
                 PreparedBy         = model.PreparedBy,
                 PreparedDate       = model.PreparedDate,
             };
             _context.Entry(data).State = EntityState.Added;
             _context.SaveChanges();
             return(data.BillOfMaterialId);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var model = new BillOFMaterialModel()
            {
                BillOfmaterialCode = txtMaterialCode.Text,
                ProductId          = (int)CmbProduct.SelectedValue,
                BatchQuantity      = Convert.ToInt32(txtbatchquantity.Text),
                CartoonQuantity    = Convert.ToInt32(txtCartoonquantity.Text),
            };
            int BillId   = _billOfMaterial.SaveBillofMaterial(model);
            var griddata = datafnuc();

            _billOfMaterial.SaveBillofMaterialDetail(griddata, BillId);
        }