public ProductModel GetProductDetailByProductId(int productId)
 {
     using (_context = new HSSNInventoryEntities())
     {
         try
         {
             var data = _context.Products.Where(b => b.ProductId == productId).Select(a => new ProductModel()
             {
                 ProductId        = a.ProductId,
                 BrandId          = a.BrandId,
                 CreatedBy        = a.CreatedBy,
                 CreatedDate      = a.CreatedDate,
                 ExerciseDuty     = a.ExerciseDuty,
                 FlavourId        = a.FlavourId,
                 IsVat            = a.IsVat,
                 ModifiedBy       = a.ModifiedBy,
                 ModifiedDate     = a.ModifiedDate,
                 PacketPerCartoon = a.PacketPerCartoon
             }).FirstOrDefault();
             return(data);
         }
         catch (Exception)
         {
             return(new ProductModel());
         }
     }
 }
Beispiel #2
0
 public List <IssueMaterialDetailModel> GetallIssuematerialdetail(int issuematerialid)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = (from a in _context.BillOfMaterials
                         join b in _context.IssueMaterials on a.BillOfMaterialId equals b.BillOfMaterialId
                         join c in _context.BillOfMaterialDetails on a.BillOfMaterialId equals
                         c.BillOfMaterialDetailId
                         join d in _context.ProductionMaterials on c.ProductMaterialId equals d.ProductionMaterialId
                         join e in _context.IssueProductMaterialDetails on b.IssueProductMaterilId equals e.IssueProductMaterialId
                         where b.IssueProductMaterilId == issuematerialid
                         select new IssueMaterialDetailModel
             {
                 IssueProductMaterialDetailId = e.IssueProductMaterialDetailId,
                 IssueProductMaterialId = b.IssueProductMaterilId,
                 ProductMaterialId = d.ProductionMaterialId,
                 OrderedQty = a.BatchQuantity,
                 Issuedcode = (int)b.Issuedcode,
                 MaterialName = d.MaterialName,
                 IssuedQty = e.IssuedQty,
                 ReturnQty = e.ReturnQty,
             }).ToList();
             return(data);
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Beispiel #3
0
        public bool EditIssueproductionDetail(List <IssueMaterialDetailModel> modellist, int Issueproductionmaterialid)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    foreach (var issueproductiondetail in modellist)
                    {
                        var model = new IssueProductMaterialDetail()
                        {
                            IssueProductMaterialDetailId = issueproductiondetail.IssueProductMaterialDetailId,
                            IssueProductMaterialId       = Issueproductionmaterialid,
                            ProductMaterialId            = issueproductiondetail.ProductMaterialId,
                            OrderedQty = issueproductiondetail.OrderedQty,
                            ReturnQty  = issueproductiondetail.ReturnQty,
                            IssuedQty  = issueproductiondetail.IssuedQty,
                        };
                        _context.Entry(model).State = EntityState.Modified;
                        _context.SaveChanges();
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Beispiel #4
0
        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;
            }
        }
Beispiel #5
0
 public int saveIssuematerial(IssueMaterialModel Model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = new IssueMaterial()
             {
                 Issuedcode       = Model.Issuedcode,
                 Issuedby         = Model.Issuedby,
                 BillOfMaterialId = Model.BillOfMaterialId,
                 IssueDateTime    = Model.IssueDateTime,
                 ReturnBy         = Model.ReturnBy,
                 ReturnDatetimer  = Model.ReturnDatetimer,
                 IssueReceivedBy  = Model.IssueReceivedBy,
                 ReturnReceivedBy = Model.ReturnReceivedBy,
                 IssueRemarks     = Model.IssueRemarks,
                 ReturnRemarks    = Model.ReturnRemarks,
             };
             _context.Entry(data).State = EntityState.Added;
             _context.SaveChanges();
             return(data.IssueProductMaterilId);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 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;
     }
 }
Beispiel #7
0
 public int EditGoodReceivedNote(GoodReceivedNoteModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var editModel = _context.GoodReceivedNotes.FirstOrDefault(a => a.GoodReceivedNoteId == model.GoodReceivedNoteId);
             if (editModel != null)
             {
                 editModel.GoodReceivedBy   = model.GoodRecievedBy;
                 editModel.GoodReceivedDate = model.GoodReceivedDate;
                 editModel.CreatedBy        = model.CreatedBy;
                 editModel.CreatedDate      = model.CreatedDate;
             }
             _context.Entry(editModel).State = EntityState.Modified;
             _context.SaveChanges();
             return(model.GoodReceivedNoteId);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(0);
     }
 }
Beispiel #8
0
        public MODEL.ProductionMaterialModel Update(MODEL.ProductionMaterialModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var editModel = _context.ProductionMaterials.FirstOrDefault(a => a.ProductionMaterialId == model.ProductionMaterialId);

                    if (editModel != null)
                    {
                        editModel.MaterialName        = model.MaterialName;
                        editModel.Description         = model.Description;
                        editModel.UnitOfMeasurementId = model.UnitOfMeasurementId;
                        editModel.Description         = model.Description;
                    }

                    _context.Entry(editModel).State = EntityState.Modified;
                    _context.SaveChanges();

                    return(model);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new ProductionMaterialModel());
            }
        }
        public int saveData(FinanceDispatchModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var addModel = new FinanceDispatch()
                    {
                        DispatchOrderId = model.DispatchOrderId,
                        EntryDate       = model.EntryDate,
                        CreatedDate     = model.CreatedDate,
                        CreatedBy       = model.CreatedBy,
                    };
                    _context.Entry(addModel).State = EntityState.Added;
                    _context.SaveChanges();
                    model.FinanceDispatchId = addModel.FinanceDispatchId;

                    return(model.FinanceDispatchId);
                }
            }
            catch (Exception e)
            {
                //Console.WriteLine(e);
                return(0);
            }
        }
 public List <UserProfileModel> GetProfileByOrganisationId(int organistionId)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data =
                 _context.UserProfiles.Where(a => a.OrganisationId == organistionId)
                 .Select(b => new UserProfileModel()
             {
                 ProfileId   = b.ProfileId,
                 ProfileName = b.ProfileName,
                 ProfileDesc = b.ProfileDesc,
                 CreatedDate = b.CreatedDate,
                 CreatedBy   = b.CreatedBy
             }).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine();
         throw ex;
     }
 }
 public int saveUserProfileDetail(UserProfileDetailModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = new UserProfileDetail()
             {
                 ProfileId    = model.ProfileId,
                 ModuleId     = model.ModuleId,
                 CreateStatus = model.CreateStatus,
                 EditStatus   = model.EditStatus,
                 DeleteStatus = model.DeleteStatus,
                 PrintStatus  = model.PrintStatus,
                 ViewStatus   = model.ViewStatus
             };
             _context.Entry(data).State = EntityState.Added;
             _context.SaveChanges();
             return(data.ProfileDetailId);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool SaveUserProfileDetaile(List <UserProfileDetailModel> modellist)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             foreach (var userProfileDetailModel in modellist)
             {
                 var model = new UserProfileDetail()
                 {
                     ProfileId    = userProfileDetailModel.ProfileId,
                     ModuleId     = userProfileDetailModel.ModuleId,
                     CreateStatus = userProfileDetailModel.CreateStatus,
                     EditStatus   = userProfileDetailModel.EditStatus,
                     DeleteStatus = userProfileDetailModel.DeleteStatus,
                     PrintStatus  = userProfileDetailModel.PrintStatus,
                     ViewStatus   = userProfileDetailModel.ViewStatus,
                 };
                 _context.Entry(model).State = EntityState.Added;
             }
             _context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Beispiel #13
0
        public bool Update(DealerModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var editModel = _context.Dealers.FirstOrDefault(a => a.DealerId == model.DealerId);

                    if (editModel != null)
                    {
                        editModel.DealerName     = model.DealerName;
                        editModel.DealerAddress  = model.DealerAddress;
                        editModel.DelearIncharge = model.DelearIncharge;
                        editModel.PhoneNo        = model.PhoneNo;
                        editModel.MobileNo       = model.MobileNo;
                        editModel.Email          = model.Email;
                        editModel.RegionId       = model.RegionId;
                    }

                    _context.Entry(editModel).State = EntityState.Modified;
                    _context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Beispiel #14
0
        public DealerModel Save(DealerModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var addModel = new Dealer()
                    {
                        DealerName     = model.DealerName,
                        DealerAddress  = model.DealerAddress,
                        PhoneNo        = model.PhoneNo,
                        MobileNo       = model.MobileNo,
                        Email          = model.Email,
                        DelearIncharge = model.DealerAddress,
                        RegionId       = model.RegionId
                    };
                    _context.Entry(addModel).State = EntityState.Added;
                    _context.SaveChanges();
                    model.DealerId = addModel.DealerId;

                    return(model);
                }
            }
            catch (Exception e)
            {
                //Console.WriteLine(e);
                return(new DealerModel());
            }
        }
 public List <BillOFMaterialModel> GetAllData()
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = _context.BillOfMaterials.Select(a => new BillOFMaterialModel()
             {
                 BillOfMaterialId   = a.BillOfMaterialId,
                 BillOfmaterialCode = a.BillOfmaterialCode,
                 ProductId          = a.ProductId,
                 BatchQuantity      = a.BatchQuantity,
                 CartoonQuantity    = a.CartoonQuantity,
                 IsIssued           = a.IsIssued,
                 PreparedBy         = a.PreparedBy,
                 PreparedDate       = a.PreparedDate,
             }).ToList();
             return(data);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
        public bool EditData(MODEL.FinanceDispatchModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var data =
                        _context.FinanceDispatches.FirstOrDefault(a => a.FinanceDispatchId == model.FinanceDispatchId);

                    data.DispatchOrderId = model.DispatchOrderId;
                    data.EntryDate       = model.EntryDate;
                    data.CreatedDate     = model.CreatedDate;
                    data.CreatedBy       = model.CreatedBy;


                    _context.Entry(data).State = EntityState.Modified;
                    _context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception e)
            {
                //Console.WriteLine(e);
                return(false);
            }
        }
 public List <MODEL.BillOfMaterialModel> GetAllNormTemplateByProductID(int productid, int batchquantity, int cartoonquantity)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = (from a in _context.Products
                         join b in _context.ProductNormTemplates on a.ProductId equals b.ProductId
                         join c in _context.ProductNormTemplateDetails on b.ProductNormTemplateId equals
                         c.ProductNormTemplateId
                         join d in _context.ProductionMaterials on c.ProductionMaterialId equals d.ProductionMaterialId
                         join e in _context.SubProducts on c.SubProductId equals e.SubProductId
                         where a.ProductId == productid
                         select new BillOfMaterialModel()
             {
                 ProductMaterialId = d.ProductionMaterialId,
                 ProductId = a.ProductId,
                 SubProductId = e.SubProductId,
                 subProductName = e.SubProductName,
                 ProductMaterialName = d.MaterialName,
                 BatchQuantity = c.BatchQuantity * batchquantity,
                 CartoonQuantity = c.CartoonQuantity * cartoonquantity,
             }).ToList();
             return(data);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        public bool Update(MODEL.WareHouseModel model)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    var editModel = _context.WareHouses.FirstOrDefault(a => a.WareHouseId == model.WareHouseId);

                    if (editModel != null)
                    {
                        editModel.WareHouseName = model.WareHouseName;
                        editModel.WareHouseType = model.WareHouseType;
                        editModel.Description   = model.Description;
                    }

                    _context.Entry(editModel).State = EntityState.Modified;
                    _context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
        public bool SaveBillofMaterialDetail(List <BillofMaterialDetailModel> modellist, int billofmaterialid)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    foreach (var BOMDetail in modellist)
                    {
                        var model = new BillOfMaterialDetail()
                        {
                            BillOfMaterialId      = billofmaterialid,
                            ProductMaterialId     = BOMDetail.ProductMaterialId,
                            UnitOfMeasurement     = BOMDetail.UnitOfMeasuremetn,
                            ManufacturedProductId = BOMDetail.ManufacturedProductId,
                            Quantity = BOMDetail.Quantity,
                        };

                        _context.Entry(model).State = EntityState.Added;
                    }
                    _context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);

                throw;
            }
        }
 public JobOrderModel GetAllDataById(int JobOrderNo)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data =
                 _context.JobOrders.Where(a => a.JobOrderNumber == JobOrderNo)
                 .Select(a => new JobOrderModel()
             {
                 JobOrderId   = a.JobOrderId,
                 DealerId     = a.DealerId,
                 JobOrderDate = a.JobOrderDate,
                 Description  = a.Description,
                 PreparedBy   = a.PreparedBy,
                 IsApproved   = a.IsApproved,
                 ApprovedBy   = a.ApprovedBy,
                 ModifiedBy   = a.ModifiedBy,
                 ModifiedDate = a.ModifiedDate,
             }).FirstOrDefault();
             return(data);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(new JobOrderModel());
     }
 }
Beispiel #21
0
 public int SaveGoodReceivedNote(MODEL.GoodReceivedNoteModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = new GoodReceivedNote()
             {
                 JobOrderId       = model.JobOrdeId,
                 GoodReceivedDate = model.GoodReceivedDate,
                 GoodReceivedBy   = model.GoodRecievedBy,
                 CreatedBy        = model.CreatedBy,
                 CreatedDate      = model.CreatedDate,
                 ModifiedBy       = model.ModifiedBy,
                 ModifiedDate     = model.ModifiedDate,
             };
             _context.Entry(data).State = EntityState.Added;
             _context.SaveChanges();
             return(data.GoodReceivedNoteId);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         throw;
     }
 }
 public int editJobOrder(JobOrderModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var editModel = _context.JobOrders.FirstOrDefault(a => a.JobOrderId == model.JobOrderId);
             if (editModel != null)
             {
                 //editModel.DealerId = model.DealerId;
                 //editModel.JobOrderDate = model.JobOrderDate;
                 //editModel.Description = model.Description;
                 //editModel.PreparedBy = model.PreparedBy;
                 editModel.IsApproved = model.IsApproved;
                 editModel.ApprovedBy = model.ApprovedBy;
                 //editModel.ModifiedDate = model.ModifiedDate;
                 //editModel.ApprovedDate = model.ApprovedDate;
             }
             _context.Entry(editModel).State = EntityState.Modified;
             _context.SaveChanges();
             return(model.JobOrderId);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(0);
     }
 }
Beispiel #23
0
 public GoodReceivedNoteModel  GetAllDataBYId(int Joborderid)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data =
                 _context.GoodReceivedNotes.Where(a => a.JobOrderId == Joborderid)
                 .Select(a => new GoodReceivedNoteModel()
             {
                 GoodReceivedNoteId = a.GoodReceivedNoteId,
                 GoodReceivedDate   = a.GoodReceivedDate,
                 GoodRecievedBy     = a.GoodReceivedBy,
                 CreatedBy          = a.CreatedBy,
                 CreatedDate        = a.CreatedDate,
                 ModifiedBy         = a.ModifiedBy,
                 ModifiedDate       = a.ModifiedDate,
             }).FirstOrDefault();
             return(data);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(new GoodReceivedNoteModel());
     }
 }
 public int saveJobOrder(MODEL.JobOrderModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = new JobOrder()
             {
                 JobOrderNumber = model.JobOrderNumber,
                 JobOrderId     = model.JobOrderId,
                 JobOrderDate   = model.JobOrderDate,
                 DealerId       = model.DealerId,
                 Description    = model.Description,
                 PreparedBy     = model.PreparedBy,
                 IsApproved     = model.IsApproved,
                 ApprovedBy     = model.ApprovedBy,
                 ModifiedBy     = model.ModifiedBy,
                 ModifiedDate   = model.ModifiedDate,
             };
             _context.Entry(data).State = EntityState.Added;
             _context.SaveChanges();
             return(data.JobOrderId);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         throw;
     }
 }
Beispiel #25
0
 public List <MODEL.IssueMaterialDetailModel> GetAllIssueMaterialDetailByBOMID(int BOMId)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = (from a in _context.BillOfMaterials
                         join b in _context.IssueMaterials on a.BillOfMaterialId equals b.BillOfMaterialId
                         join c in _context.BillOfMaterialDetails on a.BillOfMaterialId equals
                         c.BillOfMaterialDetailId
                         join d in _context.ProductionMaterials on c.ProductMaterialId equals d.ProductionMaterialId
                         where a.BillOfMaterialId == BOMId
                         select new IssueMaterialDetailModel
             {
                 IssueProductMaterialId = b.IssueProductMaterilId,
                 ProductMaterialId = d.ProductionMaterialId,
                 OrderedQty = a.BatchQuantity,
                 Issuedcode = (int)b.Issuedcode,
                 MaterialName = d.MaterialName,
             }).ToList();
             return(data);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public List <JobOrderModel> GetAllData()
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var data = (from a in _context.JobOrders
                         join b in _context.Dealers on a.DealerId equals b.DealerId
                         select new JobOrderModel()
             {
                 JobOrderId = a.JobOrderId,
                 JobOrderNumber = a.JobOrderNumber,
                 IsApproved = a.IsApproved,
                 DealerId = b.DealerId,
                 DealerName = b.DealerName,
             }).ToList();
             return(data);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Beispiel #27
0
 public int EditIssueMaterial(IssueMaterialModel model)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             var editModel = _context.IssueMaterials.FirstOrDefault(a => a.IssueProductMaterilId == model.IssueProductMaterilId);
             if (editModel != null)
             {
                 editModel.IssueProductMaterilId = model.IssueProductMaterilId;
                 editModel.Issuedcode            = model.Issuedcode;
                 editModel.Issuedby         = model.Issuedby;
                 editModel.BillOfMaterialId = model.BillOfMaterialId;
                 editModel.IssueRemarks     = model.IssueRemarks;
             }
             _context.Entry(editModel).State = EntityState.Modified;
             _context.SaveChanges();
             return(editModel.IssueProductMaterilId);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
        public bool savejoborderdetail(List <MODEL.JobOrderDetailModel> modellist, int joborderid)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    foreach (var joborderdetail in modellist)
                    {
                        var model = new JobOrderDetail()
                        {
                            JobOrderId           = joborderid,
                            ProductionMaterialId = joborderdetail.ProductionMaterialId,
                            Quantity             = joborderdetail.Quantity,
                            PrnId = joborderdetail.PrnId,
                        };
                        _context.Entry(model).State = EntityState.Added;
                    }
                    _context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception exception)
            {
                return(false);

                throw;
            }
        }
 public bool SaveFinanceDispatchDetail(List <FinanceDispatchDetailModel> financeDispatchDetailModelsList, int FinanceDispatchid)
 {
     using (_context = new HSSNInventoryEntities())
     {
         try
         {
             foreach (var rowData in financeDispatchDetailModelsList)
             {
                 var model = new FinanceDispatchDetail()
                 {
                     FinanceDispatchId       = FinanceDispatchid,
                     ProductId               = rowData.ProductId,
                     DispatchFromWareHouseId = rowData.DispatchFromWareHouseId,
                     DispatchOrderId         = rowData.DispatchOrderId,
                     Quantity = rowData.Quantity,
                     Rate     = rowData.Rate,
                     ExcessShortageQuantity = rowData.ExcessShortageQuantity,
                     UnitOfMeasurementId    = rowData.UnitOfMeasurementId,
                 };
                 _context.Entry(model).State = EntityState.Added;
             }
             _context.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
 private bool SaveProductNormTemplateDetail(IEnumerable <ProductNormTemplateDetailModel> productNormDetails, int productNormTemplateId)
 {
     using (_context = new HSSNInventoryEntities())
     {
         try
         {
             foreach (var row in productNormDetails)
             {
                 var data = new ProductNormTemplateDetail()
                 {
                     ProductNormTemplateId = productNormTemplateId,
                     ProductionMaterialId  = row.ProductionMaterialId,
                     BatchQuantity         = row.BatchQuantity,
                     CartoonQuantity       = row.CartoonQuantity
                 };
                 _context.Entry(data).State = EntityState.Added;
             }
             _context.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
 }