コード例 #1
0
        public static bool DeleteImportFichier(int CodeImport)
        {
            try
            {
                using (galadbEntities context = new galadbEntities())
                {
                    PARAMETRAGEIMPORT import = context.PARAMETRAGEIMPORT.FirstOrDefault(c => c.CODE == CodeImport);
                    if (import != null)
                    {
                        List <IMPORTCOLONNE> lstcolon = context.IMPORTCOLONNE.Where(c => c.ID_PARAMETRAGE == CodeImport).ToList();

                        foreach (IMPORTCOLONNE colon in lstcolon)
                        {
                            context.IMPORTCOLONNE.Remove(colon);
                            context.SaveChanges();
                        }


                        context.PARAMETRAGEIMPORT.Remove(import);
                        context.SaveChanges();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                };
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
コード例 #2
0
        public static int MAJImportFichier(Galatee.Structure.aImportFichier leParametrage)
        {
            try
            {
                using (galadbEntities context = new galadbEntities())
                {
                    PARAMETRAGEIMPORT import = context.PARAMETRAGEIMPORT.FirstOrDefault(c => c.CODE == leParametrage.CODE);

                    if (import != null)
                    {
                        PARAMETRAGEIMPORT _limport = Entities.ConvertObject <PARAMETRAGEIMPORT, Galatee.Structure.aImportFichier>(leParametrage);
                        Entities.UpdateEntity <PARAMETRAGEIMPORT>(_limport);

                        return(_limport.CODE);
                    }
                    else
                    {
                        PARAMETRAGEIMPORT _limport = Entities.ConvertObject <PARAMETRAGEIMPORT, Galatee.Structure.aImportFichier>(leParametrage);
                        Entities.InsertEntity <PARAMETRAGEIMPORT>(_limport);

                        return(_limport.CODE);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }