Ejemplo n.º 1
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB trndb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    TRN localtrn = new TRN();
                    localtrn.Id                        = Guid.NewGuid();
                    localtrn.Received_Date             = Convert.IsDBNull(dr["Received Date"]) ? "" : dr["Received Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Transfer_Date             = Convert.IsDBNull(dr["Transfer Date"]) ? "" : dr["Transfer Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Transfer_From_Issue_Point = Convert.IsDBNull(dr["Transfer From Issue Point"]) ? "" : dr["Transfer From Issue Point"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Receiving_Issue_Point     = Convert.IsDBNull(dr["Receiving Issue Point"]) ? "" : dr["Receiving Issue Point"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Serial_Number             = Convert.IsDBNull(dr["Serial Number"]) ? "" : dr["Serial Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Transfer_User_Logon       = Convert.IsDBNull(dr["Transfer User Logon"]) ? "" : dr["Transfer User Logon"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localtrn.Received_User_Logon       = Convert.IsDBNull(dr["Received User Logon"]) ? "" : dr["Received User Logon"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");

                    trndb.TRNs.Add(localtrn);
                }
                trndb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                trndb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 2
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB mxqdb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    MXQ localmxq = new MXQ();
                    localmxq.Id               = Guid.NewGuid();
                    localmxq.Zone_Code        = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.Zone_Description = Convert.IsDBNull(dr["Zone Description"]) ? "" : dr["Zone Description"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.NSN              = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.Item_Name        = Convert.IsDBNull(dr["Item Name"]) ? "" : dr["Item Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.Trade_Name       = Convert.IsDBNull(dr["Trade Name"]) ? "" : dr["Trade Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.Update_Date      = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localmxq.ZQL              = Convert.IsDBNull(dr["ZQL"]) ? "0" : dr["ZQL"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    mxqdb.MXQs.Add(localmxq);
                }
                mxqdb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                mxqdb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 3
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB orddb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    ORD localord = new ORD();
                    localord.Id = Guid.NewGuid();
                    localord.Issue_Point_Code = Convert.IsDBNull(dr["Issue Point Code"]) ? "" : dr["Issue Point Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.NSN                   = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Comments        = Convert.IsDBNull(dr["Order Comments"]) ? "" : dr["Order Comments"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_QTY             = Convert.IsDBNull(dr["Order QTY"]) ? "0" : dr["Order QTY"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Date_Ordered          = Convert.IsDBNull(dr["Date Ordered"]) ? "" : dr["Date Ordered"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Request_Number  = Convert.IsDBNull(dr["Order Request Number"]) ? "" : dr["Order Request Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Ship_to_Location      = Convert.IsDBNull(dr["Ship to Location"]) ? "" : dr["Ship to Location"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Requester_Logon       = Convert.IsDBNull(dr["Requester Logon"]) ? "" : dr["Requester Logon"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Zone_Code             = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Priority        = Convert.IsDBNull(dr["Order Priority"]) ? "0" : dr["Order Priority"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Job_Order_Number      = Convert.IsDBNull(dr["Job Order Number"]) ? "" : dr["Job Order Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Shop_Code       = Convert.IsDBNull(dr["Order Shop Code"]) ? "" : dr["Order Shop Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Unit_of_Issue   = Convert.IsDBNull(dr["Order Unit of Issue"]) ? "0" : dr["Order Unit of Issue"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Work_Order_Code       = Convert.IsDBNull(dr["Work Order Code"]) ? "" : dr["Work Order Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Job_Order_Code        = Convert.IsDBNull(dr["Job Order Code"]) ? "" : dr["Job Order Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Document_Number = Convert.IsDBNull(dr["Order Document Number"]) ? "" : dr["Order Document Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Update_Date           = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Updated_By            = Convert.IsDBNull(dr["Updated By"]) ? "" : dr["Updated By"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Order_Completion_Date = Convert.IsDBNull(dr["Order Completion Date"]) ? "" : dr["Order Completion Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localord.Request_Status_Code   = Convert.IsDBNull(dr["Request Status Code"]) ? "0" : dr["Request Status Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");


                    orddb.ORDs.Add(localord);
                }
                orddb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                orddb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 4
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB auldb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    AUL localaul = new AUL();
                    localaul.Id                             = Guid.NewGuid();
                    localaul.Zone_Code                      = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Zone_Description               = Convert.IsDBNull(dr["Zone Description"]) ? "" : dr["Zone Description"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.NSN                            = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Item_Name                      = Convert.IsDBNull(dr["Item Name"]) ? "" : dr["Item Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Trade_Name                     = Convert.IsDBNull(dr["Trade Name"]) ? "" : dr["Trade Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Manufacturer_Part_Number       = Convert.IsDBNull(dr["Manufacturer Part Number"]) ? "" : dr["Manufacturer Part Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Product_MSDS_Number            = Convert.IsDBNull(dr["Product/MSDS Number"]) ? "" : dr["Product/MSDS Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.MSDS_Prep_Date                 = Convert.IsDBNull(dr["MSDS Prep Date"]) ? "" : dr["MSDS Prep Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Authorization_Expiration_Date  = Convert.IsDBNull(dr["Authorization Expiration Date"]) ? "" : dr["Authorization Expiration Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Update_Date                    = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Active                         = Convert.IsDBNull(dr["Active"]) ? "" : dr["Active"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.CAGE_Code                      = Convert.IsDBNull(dr["CAGE Code"]) ? "" : dr["CAGE Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Updated_By                     = Convert.IsDBNull(dr["Updated By"]) ? "" : dr["Updated By"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Building_Code                  = Convert.IsDBNull(dr["Building Code"]) ? "" : dr["Building Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Update_Date_2                  = Convert.IsDBNull(dr["Update Date 2"]) ? "" : dr["Update Date 2"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Unit_of_Issue                  = Convert.IsDBNull(dr["Unit of Issue"]) ? "0" : dr["Unit of Issue"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Specification_Number           = Convert.IsDBNull(dr["Specification Number"]) ? "" : dr["Specification Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localaul.Specification_Type_Grade_Class = Convert.IsDBNull(dr["Specification Type/Grade/Class"]) ? "" : dr["Specification Type/Grade/Class"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");

                    auldb.AULs.Add(localaul);
                }
                auldb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                auldb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 5
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB isudb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    ISU localisu = new ISU();
                    localisu.Id                   = Guid.NewGuid();
                    localisu.Unit_Price           = Convert.IsDBNull(dr["Unit Price"]) ? "" : dr["Unit Price"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Issue_Point_Code     = Convert.IsDBNull(dr["Issue Point Code"]) ? "" : dr["Issue Point Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Date_Out             = Convert.IsDBNull(dr["Date Out"]) ? "" : dr["Date Out"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.NSN                  = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Building_Code        = Convert.IsDBNull(dr["Building Code"]) ? "" : dr["Building Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Hazard_Code          = Convert.IsDBNull(dr["Hazard Code"]) ? "0" : dr["Hazard Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Issue_Group_Sequence = Convert.IsDBNull(dr["Issue Group Sequence"]) ? "" : dr["Issue Group Sequence"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Issue_QTY_Out        = Convert.IsDBNull(dr["Issue QTY Out"]) ? "0" : dr["Issue QTY Out"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Scale_Indicator      = Convert.IsDBNull(dr["Scale Indicator"]) ? "0" : dr["Scale Indicator"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.UoM                  = Convert.IsDBNull(dr["UoM"]) ? "0" : dr["UoM"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Item_Name            = Convert.IsDBNull(dr["Item Name"]) ? "" : dr["Item Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Memo_Note            = Convert.IsDBNull(dr["Memo/Note"]) ? "" : dr["Memo/Note"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Job_ID_Code          = Convert.IsDBNull(dr["Job ID Code"]) ? "" : dr["Job ID Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Weight_Out           = Convert.IsDBNull(dr["Weight Out (Kgrams)"]) ? "0" : dr["Weight Out (Kgrams)"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Kit_Indicator        = Convert.IsDBNull(dr["Kit Indicator"]) ? "0" : dr["Kit Indicator"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Pounds_Out_QTY       = Convert.IsDBNull(dr["Pounds Out QTY"]) ? "0" : dr["Pounds Out QTY"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Supervisor_Code      = Convert.IsDBNull(dr["Supervisor Code"]) ? "" : dr["Supervisor Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.MSDS_Printed_IND     = Convert.IsDBNull(dr["MSDS Printed IND"]) ? "0" : dr["MSDS Printed IND"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Serial_Number        = Convert.IsDBNull(dr["Serial Number"]) ? "" : dr["Serial Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Organization_Code    = Convert.IsDBNull(dr["Organization Code"]) ? "" : dr["Organization Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Product_MSDS_Number  = Convert.IsDBNull(dr["Product/MSDS Number"]) ? "0" : dr["Product/MSDS Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.ID_Number            = Convert.IsDBNull(dr["ID Number"]) ? "0" : dr["ID Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Resource_Name        = Convert.IsDBNull(dr["Resource Name"]) ? "" : dr["Resource Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Status_Out           = Convert.IsDBNull(dr["Status Out"]) ? "0" : dr["Status Out"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Trade_Name           = Convert.IsDBNull(dr["Trade Name"]) ? "" : dr["Trade Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Update_Date          = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Updated_By           = Convert.IsDBNull(dr["Updated By"]) ? "" : dr["Updated By"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Zone_Code            = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localisu.Resource_Out_Cd      = Convert.IsDBNull(dr["Resource Out Cd"]) ? "" : dr["Resource Out Cd"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");

                    isudb.ISUs.Add(localisu);
                }
                isudb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                isudb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 6
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB invdb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    INV localinv = new INV();
                    localinv.Id                         = Guid.NewGuid();
                    localinv.CAGE_Code                  = Convert.IsDBNull(dr["CAGE Code"]) ? "" : dr["CAGE Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Create_Date                = Convert.IsDBNull(dr["Create Date"]) ? "" : dr["Create Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Create_Username            = Convert.IsDBNull(dr["Create Username"]) ? "" : dr["Create Username"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Disposal_Code              = Convert.IsDBNull(dr["Disposal Code"]) ? "" : dr["Disposal Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Hazard_Code                = Convert.IsDBNull(dr["Hazard Code"]) ? "0" : dr["Hazard Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.UoM                        = Convert.IsDBNull(dr["UoM"]) ? "" : dr["UoM"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Memo                       = Convert.IsDBNull(dr["Memo"]) ? "" : dr["Memo"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Document_Number_Code       = Convert.IsDBNull(dr["Document Number Code"]) ? "" : dr["Document Number Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Expiration_Date            = Convert.IsDBNull(dr["Expiration Date"]) ? "" : dr["Expiration Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Unit_Price                 = Convert.IsDBNull(dr["Unit Price"]) ? "" : dr["Unit Price"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Lot_Batch_Number           = Convert.IsDBNull(dr["Lot/Batch Number"]) ? "" : dr["Lot/Batch Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Original_Expiration_Date   = Convert.IsDBNull(dr["Original Expiration Date"]) ? "" : dr["Original Expiration Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Original_Quantity          = Convert.IsDBNull(dr["Original Quantity"]) ? "" : dr["Original Quantity"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Original_UoM               = Convert.IsDBNull(dr["Original UoM"]) ? "" : dr["Original UoM"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Product_State_Code         = Convert.IsDBNull(dr["Product State Code"]) ? "0" : dr["Product State Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Quantity                   = Convert.IsDBNull(dr["Quantity"]) ? "" : dr["Quantity"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Status                     = Convert.IsDBNull(dr["Status"]) ? "0" : dr["Status"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Unit_of_Issue              = Convert.IsDBNull(dr["Unit of Issue"]) ? "" : dr["Unit of Issue"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Issue_Point_Code           = Convert.IsDBNull(dr["Issue Point Code"]) ? "0" : dr["Issue Point Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Item_Name                  = Convert.IsDBNull(dr["Item Name"]) ? "" : dr["Item Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Kit_Description            = Convert.IsDBNull(dr["Kit Description"]) ? "" : dr["Kit Description"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Kit_ID_Code                = Convert.IsDBNull(dr["Kit ID Code"]) ? "" : dr["Kit ID Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Kit_Indicator              = Convert.IsDBNull(dr["Kit Indicator"]) ? "0" : dr["Kit Indicator"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.PNI                        = Convert.IsDBNull(dr["PNI"]) ? "0" : dr["PNI"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Kit_Price                  = Convert.IsDBNull(dr["Kit Price"]) ? "" : dr["Kit Price"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Manufacturer_Kit_Indicator = Convert.IsDBNull(dr["Manufacturer Kit Indicator"]) ? "" : dr["Manufacturer Kit Indicator"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Manufacturer_Name          = Convert.IsDBNull(dr["Manufacturer Name"]) ? "" : dr["Manufacturer Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Manufacturer_Part_Number   = Convert.IsDBNull(dr["Manufacturer Part Number"]) ? "" : dr["Manufacturer Part Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.NSN                        = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Product_MSDS_Number        = Convert.IsDBNull(dr["Product/MSDS Number"]) ? "" : dr["Product/MSDS Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Original_Issuepoint_Code   = Convert.IsDBNull(dr["Original Issuepoint Code"]) ? "" : dr["Original Issuepoint Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Separable                  = Convert.IsDBNull(dr["Separable"]) ? "0" : dr["Separable"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Serial_Number              = Convert.IsDBNull(dr["Serial Number"]) ? "" : dr["Serial Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Shelf_Bin                  = Convert.IsDBNull(dr["Shelf/Bin"]) ? "" : dr["Shelf/Bin"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Trade_Name                 = Convert.IsDBNull(dr["Trade Name"]) ? "" : dr["Trade Name"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Update_Date                = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Updated_By                 = Convert.IsDBNull(dr["Updated By"]) ? "" : dr["Updated By"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Zone_Code                  = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Shelf_Life_Code            = Convert.IsDBNull(dr["Shelf Life Code"]) ? "" : dr["Shelf Life Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Kgrams_QTY                 = Convert.IsDBNull(dr["Kgrams QTY"]) ? "0" : dr["Kgrams QTY"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localinv.Original_Kgrams_QTY        = Convert.IsDBNull(dr["Original Kgrams QTY"]) ? "" : dr["Original Kgrams QTY"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");

                    invdb.INVs.Add(localinv);
                }
                invdb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                invdb.Dispose();
            }
            return(true);
        }
Ejemplo n.º 7
0
        public Boolean loadData(DataSet dat)
        {
            HMMSEntitiesDB NOPdb = new HMMSEntitiesDB();

            try
            {
                foreach (DataRow dr in dat.Tables[0].Rows)
                {
                    NOP localnop = new NOP();
                    localnop.Id = Guid.NewGuid();
                    localnop.Backorder_Indicator        = Convert.IsDBNull(dr["Backorder Indicator"]) ? "0" : dr["Backorder Indicator"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.CAGE_Code                  = Convert.IsDBNull(dr["CAGE Code"]) ? "" : dr["CAGE Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Credit_Card_Code           = Convert.IsDBNull(dr["Credit Card Code"]) ? "" : dr["Credit Card Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Delivery_Destination       = Convert.IsDBNull(dr["Delivery Destination"]) ? "" : dr["Delivery Destination"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Document_Date              = Convert.IsDBNull(dr["Document Date"]) ? "1900" : dr["Document Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Document_Serial_Number     = Convert.IsDBNull(dr["Document Serial Number"]) ? "" : dr["Document Serial Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Issue_Exception_Code       = Convert.IsDBNull(dr["Issue Exception Code"]) ? "" : dr["Issue Exception Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Issue_Point_Code           = Convert.IsDBNull(dr["Issue Point Code"]) ? "" : dr["Issue Point Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Job_Order_Code             = Convert.IsDBNull(dr["Job Order Code"]) ? "" : dr["Job Order Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Job_Order_Number           = Convert.IsDBNull(dr["Job Order Number"]) ? "" : dr["Job Order Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.JOCAS_Number               = Convert.IsDBNull(dr["JOCAS Number"]) ? "" : dr["JOCAS Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Manufacturer_Serial_Number = Convert.IsDBNull(dr["Manufacturer Serial Number"]) ? "" : dr["Manufacturer Serial Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.NSN                     = Convert.IsDBNull(dr["NSN"]) ? "" : dr["NSN"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Activity          = Convert.IsDBNull(dr["Order Activity"]) ? "" : dr["Order Activity"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Command_Code      = Convert.IsDBNull(dr["Order Command Code"]) ? "" : dr["Order Command Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Comments          = Convert.IsDBNull(dr["Order Comments"]) ? "" : dr["Order Comments"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Completion_Date   = Convert.IsDBNull(dr["Order Completion Date"]) ? "" : dr["Order Completion Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Demand_Code       = Convert.IsDBNull(dr["Order Demand Code"]) ? "" : dr["Order Demand Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Document_Number   = Convert.IsDBNull(dr["Order Document Number"]) ? "" : dr["Order Document Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Fund_Code         = Convert.IsDBNull(dr["Order Fund Code"]) ? "" : dr["Order Fund Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Priority          = Convert.IsDBNull(dr["Order Priority"]) ? "0" : dr["Order Priority"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_QTY               = Convert.IsDBNull(dr["Order QTY"]) ? "0" : dr["Order QTY"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Date_Ordered            = Convert.IsDBNull(dr["Date Ordered"]) ? "" : dr["Date Ordered"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Request_Number    = Convert.IsDBNull(dr["Order Request Number"]) ? "" : dr["Order Request Number"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Shop_Code         = Convert.IsDBNull(dr["Order Shop Code"]) ? "" : dr["Order Shop Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Unit_of_Issue     = Convert.IsDBNull(dr["Order Unit of Issue"]) ? "0" : dr["Order Unit of Issue"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Order_Urgency           = Convert.IsDBNull(dr["Order Urgency"]) ? "0" : dr["Order Urgency"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Projected_Delivery_Code = Convert.IsDBNull(dr["Projected Delivery Code"]) ? "" : dr["Projected Delivery Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Projected_Delivery_Date = Convert.IsDBNull(dr["Projected Delivery Date"]) ? "" : dr["Projected Delivery Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Request_Delete_Date     = Convert.IsDBNull(dr["Request Delete Date"]) ? "" : dr["Request Delete Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Request_Status_Code     = Convert.IsDBNull(dr["Request Status Code"]) ? "0" : dr["Request Status Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Requisistion_Transaction_Status_Code = Convert.IsDBNull(dr["Requisistion Transaction Status Code"]) ? "0" : dr["Requisistion Transaction Status Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Distribution_Code        = Convert.IsDBNull(dr["Distribution Code"]) ? "" : dr["Distribution Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Workorder_Number_Ship_To = Convert.IsDBNull(dr["Workorder Number/Ship To"]) ? "" : dr["Workorder Number/Ship To"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Ship_to_Location         = Convert.IsDBNull(dr["Ship to Location"]) ? "" : dr["Ship to Location"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.SRD = Convert.IsDBNull(dr["SRD"]) ? "" : dr["SRD"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Transaction_Exception_Code = Convert.IsDBNull(dr["Transaction Exception Code"]) ? "" : dr["Transaction Exception Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.To_Supply_Date             = Convert.IsDBNull(dr["To Supply Date"]) ? "" : dr["To Supply Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.TRIC                = Convert.IsDBNull(dr["TRIC"]) ? "" : dr["TRIC"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.UJC                 = Convert.IsDBNull(dr["UJC"]) ? "" : dr["UJC"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Update_Date         = Convert.IsDBNull(dr["Update Date"]) ? "" : dr["Update Date"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Updated_By          = Convert.IsDBNull(dr["Updated By"]) ? "" : dr["Updated By"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Serial_Number_Count = Convert.IsDBNull(dr["Serial Number Count"]) ? "" : dr["Serial Number Count"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Requester_Logon     = Convert.IsDBNull(dr["Requester Logon"]) ? "" : dr["Requester Logon"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Work_Order_Code     = Convert.IsDBNull(dr["Work Order Code"]) ? "" : dr["Work Order Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Work_Unit_Code      = Convert.IsDBNull(dr["Work Unit Code"]) ? "" : dr["Work Unit Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");
                    localnop.Zone_Code           = Convert.IsDBNull(dr["Zone Code"]) ? "" : dr["Zone Code"].ToString().Trim().Replace(">", "GTN").Replace("<", "ltn").Replace("$", "pct").Replace(",", ";").Replace("\n", ";").Replace("\r", ";").Replace("\"", "");

                    NOPdb.NOPs.Add(localnop);
                }
                NOPdb.SaveChanges();
            }
            catch (System.Data.Entity.Core.EntityException ee)
            {
                var msg = ee.Message;
                msg = ee.InnerException.Message;
                FileTypes.LogModel log = new FileTypes.LogModel();
                log.WriteLog("ERROR", msg);
                return(false);
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                {
                    string msg;
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        msg = "Entity of type \"{0}\" in state \"{1}\" has the following validation errors:" + eve.Entry.Entity.GetType().Name + ":" + eve.Entry.State;
                        foreach (var ve in eve.ValidationErrors)
                        {
                            msg = "- Property: \"{0}\", Error: \"{1}\"" + ve.PropertyName + ":" + ve.ErrorMessage;
                            FileTypes.LogModel log = new FileTypes.LogModel();
                            log.WriteLog("ERROR", msg);
                        }
                    }
                    return(false);
                }
            }
            finally
            {
                NOPdb.Dispose();
            }
            return(true);
        }