Ejemplo n.º 1
0
        private static void ImporterChamps()
        {
            StreamReader reader   = new StreamReader("C:\\Partage\\Import Orange\\Champs controles.txt", Encoding.Default);
            string       strLigne = reader.ReadLine();

            strLigne = reader.ReadLine();
            using (CContexteDonnee contexte = new CContexteDonnee(CSessionClient.GetSessionUnique().IdSession, true, false))
            {
                while (strLigne != null)
                {
                    CRoleChampCustom roleSite            = CRoleChampCustom.GetRole(CSite.c_roleChampCustom);
                    CRoleChampCustom roleWorkBook        = CRoleChampCustom.GetRole(CDossierSuivi.c_roleChampCustom);
                    CRoleChampCustom roleCaracteristique = CRoleChampCustom.GetRole(CCaracteristiqueEntite.c_roleChampCustom);
                    string[]         datas = strLigne.Split('\t');
                    if (datas.Length >= 1)
                    {
                        CChampCustom champ = new CChampCustom(contexte);
                        if (!champ.ReadIfExists(new CFiltreData(CChampCustom.c_champNom + "=@1",
                                                                datas[0])))
                        {
                            champ.CreateNewInCurrentContexte();
                        }
                        champ.Nom = datas[0];
                        C2iTypeDonnee tp = new C2iTypeDonnee(TypeDonnee.tString);
                        if (datas.Length > 1)
                        {
                            if (datas[1].ToUpper() == "BOOL")
                            {
                                tp = new C2iTypeDonnee(TypeDonnee.tBool);
                            }
                            else if (datas[1].ToUpper() == "DATE")
                            {
                                tp = new C2iTypeDonnee(TypeDonnee.tDate);
                            }
                        }
                        champ.TypeDonneeChamp = tp;
                        champ.Categorie       = "";
                        if (datas.Length > 2)
                        {
                            champ.Categorie = datas[2];
                        }
                        CRoleChampCustom role = roleCaracteristique;
                        champ.Role = role;
                    }
                    strLigne = reader.ReadLine();
                }
                reader.Close();
                CResultAErreur result = contexte.SaveAll(true);
                if (!result)
                {
                    CFormAfficheErreur.Show(result.Erreur);
                }
            }
        }
Ejemplo n.º 2
0
        /// ////////////////////////////////////////////////////////////////////
        public CResultAErreur SerializeFiltre(C2iSerializer serializer)
        {
            InitCombos();
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            string strCodeRole = "";

            if (m_cmbRole.SelectedValue is CRoleChampCustom)
            {
                strCodeRole = ((CRoleChampCustom)m_cmbRole.SelectedValue).CodeRole;
            }
            serializer.TraiteString(ref strCodeRole);
            m_cmbRole.SelectedValue = CRoleChampCustom.GetRole(strCodeRole);
            return(result);
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------------
        private static void EditeFormulaire(Form frm, string strOnglet)
        {
            Control ctrl = frm;

            //Chope l'image du formulaire
            if (strOnglet != "")
            {
                ctrl = GetTabPage(frm, strOnglet);
            }
            bool bAvecImage = true;

            if (strOnglet != "" && ctrl == null)
            {
                if (strOnglet == c_idBas || strOnglet == c_idHaut || strOnglet == c_idGauche ||
                    strOnglet == c_idGauche)
                {
                    ctrl       = frm;
                    bAvecImage = false;
                }
            }
            if (ctrl == null)
            {
                CFormAlerte.Afficher(I.T("Impossible to find page @1|30075", strOnglet), EFormAlerteType.Erreur);
                return;
            }


            Bitmap bmp = null;

            if (bAvecImage)
            {
                bmp = CScreenCopieur.GetWindowImage(ctrl);
            }
            CFormulaire formulaire = new CFormulaire(CSc2iWin32DataClient.ContexteCourant);

            if (!formulaire.ReadIfExists(new CFiltreData(
                                             CFormulaire.c_champLibelle + "=@1",
                                             GetIdentifiantForm(frm, strOnglet))))
            {
                formulaire.CreateNew();
                formulaire.Role    = CRoleChampCustom.GetRole(CRoleFormulaireSurImpressionWin32.c_roleChampCustom);
                formulaire.Libelle = GetIdentifiantForm(frm, strOnglet);
                C2iWndFenetre wnd = formulaire.Formulaire;
                wnd.BackColor         = ctrl.BackColor;
                formulaire.Formulaire = wnd;
            }
            Type tp = null;

            if (frm is CFormEditionStdTimos)
            {
                try
                {
                    tp = ((CFormEditionStdTimos)frm).GetObjetEdite().GetType();
                }
                catch
                {
                }
            }
            if (frm is CFormListeStandardTimos)
            {
                try
                {
                    tp = ((CFormListeStandardTimos)frm).ListeObjets.TypeObjets;
                }
                catch {}
            }

            /* if (formulaire.IsNew())
             *   formulaire.TypeElementEdite = tp;*/
            List <IControleFormulaireExterne> lstControles = CEncapsuleurControleToControleFormulaireExterne.GetControlesFormulaireExterne(ctrl);

            CTimosApp.Navigateur.AffichePage(new CFormEditionFormulaireAvance(formulaire, bmp, lstControles, tp));
        }