private void m_btnSave_Click(object sender, EventArgs e)
 {
     if (this.ComposantPhysiqueEdite == null)
     {
         CFormAlerte.Afficher(I.T("No symbol to save|30378"));
     }
     else
     {
         SaveFileDialog dlg = new SaveFileDialog();
         dlg.Filter = I.T("3D object (*.3D)|*.3D|All files (*.*)|*.*|30376");
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             string         strNomFichier = dlg.FileName;
             CResultAErreur result        = CSerializerObjetInFile.SaveToFile(ComposantPhysiqueEdite, C2iComposant3D.c_idFichier, strNomFichier);
             if (!result)
             {
                 CFormAlerte.Afficher(result);
             }
             else
             {
                 CFormAlerte.Afficher(I.T("Save successful|30377"));
             }
         }
     }
 }
Пример #2
0
        private void m_btnSaveSession_Click(object sender, EventArgs e)
        {
            CConfigMappagesSmartImport config = null;
            DataTable      tableSource        = null;
            CResultAErreur res = PrepareImport(ref config, ref tableSource);

            if (!res)
            {
                CFormAlerte.Afficher(res.Erreur);
                return;
            }
            m_sessionImport.ConfigMappage = config;
            m_sessionImport.TableSource   = tableSource;
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Import session(*.futimpses)|*.futimpses|All files|*.*|20148");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                m_lblImportSession.Text = dlg.FileName;
                CResultAErreur result = CSerializerObjetInFile.SaveToFile(m_sessionImport, "IMPORT_SESSION", dlg.FileName);
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                    return;
                }
            }
            return;
        }
        private void m_btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("3D objet (*.3D)|*.3D|All files (*.*)|*.*|30376");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (CFormAlerte.Afficher(I.T("The current symbol will be replaced. Continue ?|30079"),
                                         EFormAlerteType.Question) == DialogResult.No)
                {
                    return;
                }
                C2iComposant3D newComposantPhysique = new C2iComposant3DConteneurDock();

                CResultAErreur result = CSerializerObjetInFile.ReadFromFile(newComposantPhysique, C2iComposant3D.c_idFichier, dlg.FileName);
                if (!result)
                {
                    CFormAlerte.Afficher(result);
                }
                else
                {
                    ComposantPhysiqueEdite = newComposantPhysique;
                }
            }
        }
Пример #4
0
        private void CFormMain_Load(object sender, EventArgs e)
        {
            using (CMemoryDb contexteMemoire = new CMemoryDb())
            {
                CResultAErreur result = CSerializerObjetInFile.ReadFromFile(
                    contexteMemoire, "TIMOS_INVENTORY_DATA", "c:\\partage\\timos\\TimosData.dat");

                if (!result)
                {
                    return;
                }

                /*m_txtSelectTypeEquipement.InitAvecFiltreDeBase(
                 *  contexteMemoire,
                 *  typeof(CTypeEquipement),
                 *  "Libelle",
                 *  null,
                 *  new CFiltreMemoryDb(CTypeEquipement.c_champLibelle + " LIKE @1"),
                 *  true);
                 *
                 * CTypeEquipement typeEquip = new CTypeEquipement(contexteMemoire);
                 * if (typeEquip.ReadIfExist("10225"))
                 * {
                 *  string strLabel = typeEquip.Libelle;
                 *  //m_txtSelectTypeEquipement.SelectedObject = typeEquip;
                 * }*/
            }
        }
Пример #5
0
        private void m_btnSaveConfig_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Paste map file|*.2iPasteMap|20825");
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            CMapColToColSerializable map = new CMapColToColSerializable();

            foreach (KeyValuePair <DataColumn, string> kv in m_dicMaps)
            {
                if (kv.Value != null)
                {
                    map[kv.Key.ColumnName] = kv.Value;
                }
            }
            CResultAErreur result = CSerializerObjetInFile.SaveToFile(map, CMapColToColSerializable.c_fileSgn, dlg.FileName);

            if (!result)
            {
                CFormAlerte.Afficher(result.Erreur);
            }
        }
Пример #6
0
        private void m_btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("Action (*.2iAction)|*.2iAction|All files (*.*)|*.*|20867");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (CFormAlerte.Afficher(I.T("Action data will be replaced, continue|20866"),
                                         EFormAlerteType.Question) == DialogResult.No)
                {
                    return;
                }
                CActionSaver   saver  = new CActionSaver();
                CResultAErreur result = CSerializerObjetInFile.ReadFromFile(saver, CActionSur2iLink.c_idFichier, dlg.FileName);
                if (!result)
                {
                    CFormAlerte.Afficher(result);
                }
                else
                {
                    m_actionFinale = saver.Action;
                    SelectTypeAction(m_actionFinale != null ?
                                     m_actionFinale.GetType() :
                                     null);
                    UpdateVisuel();
                }
            }
        }
Пример #7
0
        //----------------------------------------------------------------
        public static CResultAErreur SaveConfig(CMemoryDb db)
        {
            string         StrFile = GetHotelConfigPath();
            CResultAErreur result  = CSerializerObjetInFile.SaveToFile(db, "DATA_HOTEL_CONFIG", StrFile);

            return(result);
        }
Пример #8
0
        //---------------------------------------------------------------
        private void m_btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Easy query|*.esq|All files|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CEasyQuery     query = m_editeur.ObjetEdite as CEasyQuery;
                CResultAErreur res   = CSerializerObjetInFile.ReadFromFile(query, "QUERY", dlg.FileName);
                if (!res)
                {
                    CEasyQueryAvecSource qas  = new CEasyQueryAvecSource();
                    CResultAErreur       res2 = CSerializerObjetInFile.ReadFromFile(qas, "QUERYWITHSOURCE", dlg.FileName);
                    if (res2)
                    {
                        m_bSaveWithSource = true;
                        query             = qas.GetEasyQuerySansSource();
                        res = CResultAErreur.True;
                    }
                }
                else
                {
                    m_bSaveWithSource = false;
                }
                if (!res)
                {
                    CFormAlerte.Afficher(res.Erreur);
                }
                Init(query);
                /*m_editeur.ObjetEdite = query;*/
                m_editeur.Refresh();
            }
        }
Пример #9
0
        private void m_btnOpenConfig_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Paste map file|*.2iPasteMap|20825");
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            CMapColToColSerializable map    = new CMapColToColSerializable();
            CResultAErreur           result = CSerializerObjetInFile.ReadFromFile(map, CMapColToColSerializable.c_fileSgn, dlg.FileName);

            if (!result)
            {
                CFormAlerte.Afficher(result.Erreur);
                return;
            }
            if (m_tableToMap != null)
            {
                foreach (KeyValuePair <string, string> kv in map)
                {
                    DataColumn col = m_tableToMap.Columns[kv.Key];
                    if (col != null)
                    {
                        m_dicMaps[col] = kv.Value;
                    }
                }
            }
            UpdatePanelMappage();
        }
Пример #10
0
 //-------------------------------------------------
 public static CReleveDb GetInventaireDatas()
 {
     if (m_dbReleve != null)
     {
         return(m_dbReleve);
     }
     m_dbReleve = new CReleveDb(m_dbTimos);
     if (File.Exists(GetNomFichierSurvey()))
     {
         /*try
          * {
          *  m_dbReleve.ReadXml(GetNomFichierSurvey(), System.Data.XmlReadMode.Auto);
          * }
          * catch (Exception e)
          * {
          *  CResultAErreur result = CResultAErreur.True;
          *  result.EmpileErreur(new CErreurException(e));
          *  result.EmpileErreur(I.T("Can not read data|20007"));
          *  CFormAlerte.Afficher(result.Erreur);
          *  m_dbTimos = new CMemoryDb();
          * }
          */
         DateTime       dt     = DateTime.Now;
         CResultAErreur result = CSerializerObjetInFile.ReadFromFile(m_dbReleve, c_cleFichierInventaire, GetNomFichierSurvey());
         TimeSpan       sp     = DateTime.Now - dt;
         System.Console.WriteLine("Read survey : " + sp.TotalMilliseconds);
         if (!result)
         {
             result.EmpileErreur(I.T("Can not read data|20007"));
             CFormAlerte.Afficher(result.Erreur);
             m_dbReleve = new CReleveDb(m_dbTimos);
         }
     }
     return(m_dbReleve);
 }
Пример #11
0
        //---------------------------------------------------------
        public CResultAErreur SaveHelp(CHelpData help)
        {
            CResultAErreur result       = CResultAErreur.True;
            string         strFileTitle = GetFileTitle(help);     // >> Créé une instance au niveau de l'index

            if (!help.HasData)
            {
                try
                {
                    if (File.Exists(RepertoireDeBase + strFileTitle))
                    {
                        File.Delete(RepertoireDeBase + strFileTitle);
                        m_tableAides.Remove(help.HelpKey);
                    }
                }
                catch
                {
                }
                return(result);
            }


            //S'assure que le chemin du fichier existe
            string strFichier = RepertoireDeBase + strFileTitle;

            m_tableAides[help.HelpKey] = help;
            SaveFichierIndex();

            return(CSerializerObjetInFile.SaveToFile(help, c_cleFichier, strFichier));
        }
Пример #12
0
        public CHelpData GetHelp(string strCle)
        {
            CResultAErreur result = CResultAErreur.True;
            CHelpData      help   = null;

            if (m_tableAides.Contains(strCle))
            {
                return((CHelpData)m_tableAides[strCle]);
            }


            string strFile = RepertoireDeBase + GetFileTitle(strCle);

            if (!File.Exists(strFile))
            {
                return(null);
            }


            help                 = new CHelpData();
            help.HelpKey         = strCle;
            m_tableAides[strCle] = help;
            result               = CSerializerObjetInFile.ReadFromFile(help, c_cleFichier, strFile);

            return(help);
        }
Пример #13
0
        private void m_btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "External explorer file|*.extExp|All files|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                DateTime       dt      = DateTime.Now;
                CRepertoire    dossier = new CRepertoire();
                CResultAErreur result  = CSerializerObjetInFile.ReadFromFile(dossier,
                                                                             "EXTERNAL_EXPLORER",
                                                                             dlg.FileName);
                TimeSpan sp = DateTime.Now - dt;

                if (result)
                {
                    m_dossierRacine = dossier;
                    FillTree();
                }
                else
                {
                    MessageBox.Show(result.Erreur.ToString());
                }
            }
        }
Пример #14
0
        private void m_btnSave_Click(object sender, EventArgs e)
        {
            if (m_arbre.Nodes.Count == 0)
            {
                return;
            }
            CRepertoire dossier = m_arbre.Nodes[0].Tag as CRepertoire;

            if (dossier != null)
            {
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Filter = "External explorer file|*.extExp|All files|*.*";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    CResultAErreur result = CSerializerObjetInFile.SaveToFile(dossier,
                                                                              "EXTERNAL_EXPLORER",
                                                                              dlg.FileName
                                                                              );
                    if (result)
                    {
                        MessageBox.Show("Save ok");
                    }
                    else
                    {
                        MessageBox.Show(result.Erreur.ToString());
                    }
                }
            }
        }
Пример #15
0
        //-------------------------------------------------
        public CResultAErreur SaveFile(string strNomFichier)
        {
            CResultAErreur result = CResultAErreur.True;

            result = CSerializerObjetInFile.SaveToFile(this, "CONFIG_PLANNING", strNomFichier);
            if (result)
            {
                m_strNomFichier = strNomFichier;
            }
            return(result);
        }
Пример #16
0
        //-------------------------------
        public static CResultAErreur Load(string strFichier)
        {
            CProjetMib     projet = new CProjetMib();
            CResultAErreur result = CSerializerObjetInFile.ReadFromFile(projet, "MIBPRJ", strFichier);

            if (result)
            {
                m_defaultInstance = projet;
            }
            return(result);
        }
Пример #17
0
        //------------------------------------------------------------
        private void SaveWithoutSources()
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "Easy query|*.esq|All files|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CEasyQuery query = m_editeur.ObjetEdite as CEasyQuery;
                CSerializerObjetInFile.SaveToFile(query, "QUERY", dlg.FileName);
                m_bSaveWithSource = false;
            }
        }
Пример #18
0
        //--------------------------------------
        public static CResultAErreur Load(string strFichier)
        {
            CBaseTypesAlarmes baseTemp = new CBaseTypesAlarmes();
            CResultAErreur    result   = CSerializerObjetInFile.ReadFromFile(baseTemp, c_strCleFichier, strFichier);

            if (result)
            {
                m_instance = baseTemp;
                CCurentBaseTypesAlarmes.SetCurrentBase(m_instance);
            }
            return(result);
        }
Пример #19
0
        //---------------------------------------------------
        public CSourceAideFichier(string strRepertoire)
        {
            m_strRepertoire = strRepertoire;

            if (File.Exists(RepertoireDeBase + c_strFichierIndex))
            {
                CSerializerObjetInFile.ReadFromFile(m_index, c_cleFichierIndex, RepertoireDeBase + c_strFichierIndex);
            }
            if (File.Exists(RepertoireDeBase + c_strFichiersMenu))
            {
                //CSerializerObjetInFile.ReadFromFile(m_menu, c_cleFichiersMenu, RepertoireDeBase + c_strFichiersMenu);
            }
        }
Пример #20
0
        //-------------------------------------------------
        public static void SetDbInventaire(CReleveDb db)
        {
            m_dbReleve = db;
            db.AcceptChanges();
            DateTime dt = DateTime.Now;

            CSerializerObjetInFile.SaveToFile(m_dbReleve, c_cleFichierInventaire, GetNomFichierSurvey());
            //m_dbReleve.WriteXml(GetNomFichierSurvey(), System.Data.XmlWriteMode.WriteSchema);
            db.AcceptChanges();
            TimeSpan sp = DateTime.Now - dt;

            System.Console.WriteLine("Save dbSurvey : " + sp.TotalMilliseconds);
        }
Пример #21
0
        //-------------------------------------------------
        public static void SetDbTimos(CMemoryDb db)
        {
            m_dbTimos = db;
            db.AcceptChanges();
            DateTime dt = DateTime.Now;

            GetInventaireDatas().TimosDb = db;
            //m_dbTimos.WriteXml(GetNomFichierTimosData(), System.Data.XmlWriteMode.WriteSchema);
            CSerializerObjetInFile.SaveToFile(m_dbTimos, c_cleFichierTimos, GetNomFichierTimosData());
            TimeSpan sp = DateTime.Now - dt;

            System.Console.WriteLine("Save dbTimos : " + sp.TotalMilliseconds);
        }
Пример #22
0
        //------------------------------------------------------------
        private void SaveWithSources()
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "Easy query|*.esq|All files|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CEasyQuery           query = m_editeur.ObjetEdite as CEasyQuery;
                CEasyQueryAvecSource qas   = CEasyQueryAvecSource.FromQuery(query);
                CSerializerObjetInFile.SaveToFile(qas, "QUERYWITHSOURCE", dlg.FileName);
                m_bSaveWithSource = true;
            }
        }
        //---------------------------------------------------------------------------------
        public CResultAErreur ReadConfig()
        {
            CResultAErreur result = CResultAErreur.True;
            CMemoryDb      db     = new CMemoryDb();

            result = CSerializerObjetInFile.ReadFromFile(db, "FUT_MEDIATION_DATA", GetConfigFileName());
            if (result)
            {
                m_database = db;
                RegisterAllTypesInDb();
            }
            return(result);
        }
        //---------------------------------------------------------------------------------
        public CResultAErreur SaveConfig()
        {
            CResultAErreur result = CResultAErreur.True;

            string strFileTmp = GetConfigFileName() + ".tmp";

            result = CSerializerObjetInFile.SaveToFile(DataBase, "FUT_MEDIATION_DATA", strFileTmp);
            if (result)
            {
                File.Delete(GetConfigFileName());
                File.Move(strFileTmp, GetConfigFileName());
            }
            return(result);
        }
        //---------------------------------------------------------------
        private void m_btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Graphical formula|*.grafexp|All files|*.*|20004");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CResultAErreur result = CSerializerObjetInFile.SaveToFile(RepresentationEditee, C2iExpressionGraphique.c_cleFichier, dlg.FileName);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
Пример #26
0
        private void m_btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "#Macro|*.FutMacro|All files|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CResultAErreur result = CSerializerObjetInFile.SaveToFile(m_macro, "MACRO", dlg.FileName);
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                }
            }
        }
        private void m_btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = I.T("Form|*.form|All files|*.*|20017");
            if (!(WndEditee is C2iWndFenetre))
            {
                CFormAlerte.Afficher(I.T("Unavailable|20018"));
                return;
            }
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CResultAErreur result = CSerializerObjetInFile.SaveToFile(WndEditee, "FORM", dlg.FileName);
            }
        }
Пример #28
0
 //---------------------------------------------------------------------------
 private void m_btnSaveConfig_Click(object sender, EventArgs e)
 {
     using (SaveFileDialog dlg = new SaveFileDialog())
     {
         dlg.Filter = I.T("Dependancies search configuration|*.depConf|All files|*.*|20011");
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             CConfigurationRechercheEntites configuration = m_configuration;
             CResultAErreur result = CSerializerObjetInFile.SaveToFile(configuration, c_cleFichier, dlg.FileName);
             if (!result)
             {
                 CFormAlerte.Afficher(result.Erreur);
             }
         }
     }
 }
Пример #29
0
        //----------------------------------------------------------------
        public static CResultAErreur ReadConfig()
        {
            string         strFile = GetHotelConfigPath();
            CResultAErreur result  = CResultAErreur.True;

            if (File.Exists(strFile))
            {
                CMemoryDb db = new CMemoryDb();
                result = CSerializerObjetInFile.ReadFromFile(db, "DATA_HOTEL_CONFIG", strFile);
                if (!result)
                {
                    return(result);
                }
                m_database = db;
                UpdateOptimizedDb();
            }
            return(result);
        }
        private void m_btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = I.T("Graphical formula|*.grafexp|All files|*.*|20004");
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                C2iExpressionGraphique rep    = new C2iExpressionGraphique();
                CResultAErreur         result = CSerializerObjetInFile.ReadFromFile(rep, C2iExpressionGraphique.c_cleFichier, dlg.FileName);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
                else
                {
                    this.Init(rep, m_fournisseurProprietes, m_objetAnalyse);
                }
            }
        }