public bool SaveGRNDetail(List <MODEL.GrnDetailModel> modellist, int GoodReceivedNoteId) { try { using (_context = new HSSNInventoryEntities()) { foreach (var grnDetail in modellist) { var model = new GrnDetail() { GoodReceivedNoteId = GoodReceivedNoteId, ProductionMaterialId = grnDetail.ProductionMaterialId, OrderQuantity = grnDetail.OrderQuantity, ReceivedQuantity = grnDetail.ReceivedQuantity, }; _context.Entry(model).State = EntityState.Added; } _context.SaveChanges(); return(true); } } catch (Exception exception) { return(false); throw; } }
public frmGRNBatch(GrnDetail detail, DataGridView dgv, bool Editable) { try { InitializeComponent(); m_CurrentGRNDetail = detail; m_ParentGridView = dgv; EnableControl = Editable; dtpExpiryDate.CustomFormat = Common.DTP_DATE_FORMAT; dtpMfgDate.CustomFormat = Common.DTP_DATE_FORMAT; //dt. 12-04-2012 Nitin has changed as per the requirement // dtpExpiryDate.Value = DateTime.Today.AddDays(1); dtpMfgDate.MaxDate = DateTime.Today; InitailizeControls(); } catch (Exception ex) { MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error); Common.LogException(ex); } }