/// <summary>
 /// Constructeur du formulaire
 /// </summary>
 /// <param name="infoEcole"></param>
 /// <param name="mailType"></param>
 /// <param name="_applClass"></param>
 public frmSendMail(Ecole infoEcole, MailType mailType, ApplClass _applClass)
 {
     InitializeComponent();
     _infoEcole = infoEcole;
     _mailType = mailType;
     p_applClass = _applClass;
 }
 /// <summary>
 /// Constructeur de la classe GOogleFct
 /// </summary>
 /// <param name="_applClass"></param>
 public GoogleFct(ApplClass _applClass)
 {
     p_applClass = _applClass;
     p_isActivated = p_applClass.Param.IsGoogleActivate;
     p_googleAccount = p_applClass.Param.GoogleAccount;
     p_privateKey = p_applClass.Param.PrivateKey;
 }
        /// <summary>
        /// Constructeur du Formulaire
        /// </summary>
        /// <param name="_applClass"></param>
        public aPropos(ApplClass _applClass)
        {
            int len;
            p_applClass = _applClass;
            InitializeComponent();
            string _textActiv;
            if (p_applClass.InfoReg.ModeTrial) { _textActiv = "Version d'évaluation."; }
            else { _textActiv = "Version activée."; }

            for (int i = 0; i < p_applClass.InfoReg.ComputerID.Length && i < 25; i += 5)
            {
                _Boxes[i / 5] = new FilterTextBox();
                len = (i + 5) > p_applClass.InfoReg.ComputerID.Length ? p_applClass.InfoReg.ComputerID.Length - i : 5;
                _Boxes[i / 5].Text = p_applClass.InfoReg.ComputerID.Substring(i, len);
            }

            this.Text = String.Format("À propos de {0}", AssemblyAccess.AssemblyTitle);
            this.labelProductName.Text = AssemblyAccess.AssemblyProduct;
            this.labelVersion.Text = String.Format("Version {0}", AssemblyAccess.AssemblyVersion);
            this.labelCopyright.Text = AssemblyAccess.AssemblyCopyright;
            this.labelCompanyName.Text = AssemblyAccess.AssemblyCompany;
            this.textBoxDescription.Text = AssemblyAccess.AssemblyDescription + Environment.NewLine + Environment.NewLine;
            this.textBoxDescription.Text += "Activation ID : " + Environment.NewLine + GetBoxes + Environment.NewLine + Environment.NewLine;
            if (p_applClass.InfoReg.ModeTrial) { this.textBoxDescription.Text += _textActiv + Environment.NewLine; }
            if (p_applClass.InfoReg.RegType.Equals(RegistrationType.Full)) {this.textBoxDescription.Text += "Version complète" + Environment.NewLine;}
            if (!p_applClass.InfoReg.ModeTrial) { btnActivate.Visible = false; }
        }
 /// <summary>
 /// Constructeur de la classe de reporting Excel
 /// </summary>
 /// <param name="_applClass"></param>
 public clsReport(ApplClass _applClass)
 {
     Log.Debug("Création de la classe Report.");
     p_appClass = _applClass;
     p_fileStream = new FileStream(Path.Combine(ClassOutils.GetPathStart, "Templates", "ListeEcolesPlanifies_Templates.xls"), FileMode.Open, FileAccess.Read);
     // On charge le classeur complet
     p_templateWorkbook = new HSSFWorkbook(p_fileStream);
 }
 /// <summary>
 /// Contructeur du formulaire
 /// </summary>
 public frmParam(ApplClass _applClass, int defaultTab)
 {
     p_applClass = _applClass;
     InitializeComponent();
     this.Width = 500;
     p_numTab = defaultTab;
     p_updateSchool = false;
 }
 /// <summary>
 /// Constructeur du Formulaire
 /// </summary>
 /// <param name="_lisEcoles"></param>
 /// <param name="_saison"></param>
 public frmMailing(ApplClass _applClass, SchoolCollection _lisEcoles, string _saison)
 {
     p_listEcoles = _lisEcoles;
     p_saisonEnCours = _saison;
     InitializeComponent();
     lvwColumnSorter = new ListViewColumnSorter();
     this.lstMailingSchool.ListViewItemSorter = lvwColumnSorter;
     cmbNbDest.SelectedIndex = 4;
     p_applClass = _applClass;
 }
 /// <summary>
 /// Génére une liste Excel
 /// </summary>
 /// <param name="_applClass"></param>
 /// <param name="_listEcole"></param>
 /// <param name="_labelPeriode"></param>
 /// <param name="_fileName"></param>
 public static void generateReport(ApplClass _applClass, SchoolCollection _listEcole, string _labelPeriode, string _fileName)
 {
     Log.Debug("Gérénation du Reporting");
     try
     {
         clsReport _reportCls = new clsReport(_applClass);
         _reportCls.NumRow = 1;
         _reportCls.createReport(_listEcole, _labelPeriode, "Liste");
         // Sauvegarde du fichier EXCEL
         _reportCls.saveExcel(_fileName);
     }
     catch (Exception _exc)
     {
         Log.Error("Erreur lors de la création du rapport.", _exc);
         System.Windows.Forms.MessageBox.Show("Une erreur est survenue lors de la création du rapport.\r\nMessage : " + _exc.Message, "Anomalie !", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.RightAlign);
     }
 }
 /// <summary>
 /// Contructeur du formulaire
 /// </summary>
 public frmParam(ApplClass _applClass) : this(_applClass, 0)
 { }
        /// <summary>
        /// Constructeur de l'application
        /// </summary>
        public frmAppli(InfoRegistration _infoReg)
        {
            p_applClass = new ApplClass();
            p_applClass.InfoReg = _infoReg;
            p_fileSchool = new SchoolFileFormat();
            p_listEcole = new SchoolCollection();

            InitializeComponent();

            // Créer une instance d'une méthode de trie de la colonne ListView et l'attribuer
            // au contrôle ListView.
            lvwColumnSorter = new SchoolCollectionSorter();
            this.lstToSchedule.ListViewItemSorter = lvwColumnSorter;
            this.lstToSchedule.ContextMenuStrip = contextMenuStrip1;
        }
 /// <summary>
 /// Constructeur du formulaire
 /// </summary>
 public frmSynchro(ApplClass _applClass)
 {
     p_applClass = _applClass;
     InitializeComponent();
 }
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="_applClass"></param>
 public frmPayBoxFiles(ApplClass _applClass)
 {
     p_listPixFirstFiles = new Dictionary<string, string>();
     p_applClass = _applClass;
     InitializeComponent();
 }
        /// <summary>
        /// Substitution ds champs variables
        /// </summary>
        /// <param name="_textModel"></param>
        /// <returns></returns>
        public static string doSubstitute(ApplClass _applClass, Ecole _infoEcole, string _textModel)
        {
            string _returnText = _textModel ?? String.Empty;
            // On fait la substitution des variables :
            // 1. {NOM_ECOLE}
            _returnText = _returnText.Replace("{NOM_ECOLE}", _infoEcole.Libelle);
            // 2. {NOM_CONTACT}
            _returnText = _returnText.Replace("{NOM_CONTACT}", _infoEcole.Contact.Titre + " " + _infoEcole.Contact.Nom);
            // 3. {DATE1}
            _returnText = _returnText.Replace("{DATE1}", _infoEcole._planifEnCours.StartDate.ToString("dd/MM/yyyy à HH:mm"));
            // 4. {DATE2}
            _returnText = _returnText.Replace("{DATE2}", _infoEcole._planifEnCours.EndDate.ToString("dd/MM/yyyy à HH:mm"));
            // 5. {PHOTO}
            _returnText = _returnText.Replace("{PHOTO}", _applClass.Param.GetNamePhotoGrapheFromId(_infoEcole._planifEnCours.IdPhotographe));

            return _returnText;
        }
 public frmReporting(ApplClass _applClass)
 {
     p_applClass = _applClass;
     InitializeComponent();
 }
        /// <summary>
        /// Chargement du Formulaire
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmItemCalendar_Load(object sender, EventArgs e)
        {
            _oldPhotographe = "";
            lblErreur.Text = "";
            frm = (frmAppli)this.Owner;
            p_applClass = frm.GetApplClass();

            if (cmbPhotographe.Items.Count == 0)
            {
                for (int i = 0; i < p_applClass.Param.ListPhotographe.Count; i++)
                {
                    cmbPhotographe.Items.Add(p_applClass.Param.ListPhotographe[i].Nom);
                    if (_infoEcole._planifEnCours != null)
                    {
                        if (_infoEcole._planifEnCours.IdPhotographe == p_applClass.Param.ListPhotographe[i].IdPhotographe) { cmbPhotographe.SelectedIndex = i; }
                    }
                }
            }
            if (_infoEcole._planifEnCours != null)
            {
                btnDeletePDV.Enabled = true;
                if (_infoEcole._planifEnCours.StartDate == DateTime.MinValue)
                {
                    p_tsheureDebut = new TimeSpan(08, 00, 0);
                    p_dateDebut = new DateTime(_dateSelected.Year, _dateSelected.Month, _dateSelected.Day);
                    p_dateDebut = p_dateDebut.Date + p_tsheureDebut;
                    p_tsheureFin = new TimeSpan(17, 00, 0);
                    p_dateFin = new DateTime(_dateSelected.Year, _dateSelected.Month, _dateSelected.Day);
                    p_dateFin = p_dateDebut.Date + p_tsheureFin;
                }
                else
                {
                    p_tsheureDebut = new TimeSpan(_infoEcole._planifEnCours.StartDate.Hour, _infoEcole._planifEnCours.StartDate.Minute, _infoEcole._planifEnCours.StartDate.Second);
                    p_dateDebut = _infoEcole._planifEnCours.StartDate;
                    p_tsheureFin = new TimeSpan(_infoEcole._planifEnCours.EndDate.Hour, _infoEcole._planifEnCours.EndDate.Minute, _infoEcole._planifEnCours.EndDate.Second);
                    p_dateFin = _infoEcole._planifEnCours.EndDate;
                    chkConfirm.Checked = _infoEcole._planifEnCours.Confirme;
                }
            }
            else
            {
                btnDeletePDV.Enabled = false;
                p_tsheureDebut = new TimeSpan(08, 00, 0);
                p_dateDebut = new DateTime(_dateSelected.Year, _dateSelected.Month, _dateSelected.Day);
                p_dateDebut = p_dateDebut.Date + p_tsheureDebut;
                p_tsheureFin = new TimeSpan(17, 00, 0);
                p_dateFin = new DateTime(_dateSelected.Year, _dateSelected.Month, _dateSelected.Day);
                p_dateFin = p_dateDebut.Date + p_tsheureFin;
            }
            dateDebutPicker.Value = p_dateDebut;
            dateFinPicker.Value = p_dateFin;
            txtHeureDebut.Text = p_tsheureDebut.ToString();
            txtHeureFin.Text = p_tsheureFin.ToString();

            dateDebutPicker.MinDate = p_applClass.Param.GetPeriode(frm._saison).StartDate;
            dateDebutPicker.MaxDate = p_applClass.Param.GetPeriode(frm._saison).EndDate;

            // Disponibilité
            chkDay1.Checked = _infoEcole.getDispo(1);
            chkDay2.Checked = _infoEcole.getDispo(2);
            chkDay3.Checked = _infoEcole.getDispo(3);
            chkDay4.Checked = _infoEcole.getDispo(4);
            chkDay5.Checked = _infoEcole.getDispo(5);

            // Contrôle si la journée entière est planifiée
            if (p_tsheureDebut.Equals(new TimeSpan(08, 00, 00)) && p_tsheureFin.Equals(new TimeSpan(17, 00, 00)))
            {
                chkFullDay.Checked = true;
                txtHeureDebut.Enabled = false;
                txtHeureFin.Enabled = false;
            }
            else
            {
                chkFullDay.Checked = false;
                txtHeureDebut.Enabled = true;
                txtHeureFin.Enabled = true;
            }
            txtCode.Text = _infoEcole.IdEcole;
            txtLibelle.Text = _infoEcole.Libelle;
            txtAdresse.Text = _infoEcole.Adresse;
            txtCP.Text = _infoEcole.CodePostal;
            txtVille.Text = _infoEcole.Ville;
            txtTelephone.Text = _infoEcole.Telephone;

            if (p_modeDuplicate)
            {
                txtCode.Enabled = true;
                txtCode.Mask = "00000000L";
            }
            // Informations sur le contact
            if (_infoEcole.Contact != null)
            {
                lstTitre.SelectedItem = _infoEcole.Contact.TitreCTC;
                txtNomContact.Text = String.Format("{0}", _infoEcole.Contact.NomCTC);
                txtFonction.Text = _infoEcole.Contact.FonctionCTC;
                mskTelContact.Text = _infoEcole.Contact.TelephoneCTC;
                mskPortContact.Text = _infoEcole.Contact.PortableCTC;
                mskFaxContact.Text = _infoEcole.Contact.FaxCTC;
                txtEmail.Text = _infoEcole.Contact.EmailCTC;
                rchComplements.Text = _infoEcole.Contact.ComplementsCTC;
            }
            txtPrivateInfo.Text = _infoEcole.PrivateInfo;
            txtNbClass.Text = _infoEcole.NbClasses;
            txtEffectif.Text = _infoEcole.Effectif;
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesMaternelle)) { txtNbMaternelle.Text = _infoEcole.NbClassesMaternelle; }
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesElementaire)) { txtNbElementaire.Text = _infoEcole.NbClassesElementaire; }
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesCollege)) { txtNbCollege.Text = _infoEcole.NbClassesCollege; }
            if (_infoEcole.TypSecteur == "0") { typSecteur.SelectedIndex = 0; }
            else { typSecteur.SelectedIndex = 1; }

            this.calculPrixRevient();

            // Informations sur les autres planifications
            grid2.BorderStyle = BorderStyle.FixedSingle;
            grid2.ColumnsCount = 4;
            grid2.FixedRows = 1;
            grid2.Rows.Insert(0);
            grid2.Selection.FocusStyle = FocusStyle.None;
            grid2.SelectionMode = GridSelectionMode.Row;
            grid2[0, 0] = new SourceGrid.Cells.ColumnHeader("Saison");
            grid2[0, 1] = new SourceGrid.Cells.ColumnHeader("Du");
            grid2[0, 2] = new SourceGrid.Cells.ColumnHeader("Au");
            grid2[0, 3] = new SourceGrid.Cells.ColumnHeader("Photographe");
            grid2.Columns.SetWidth(0, 100);
            grid2.Columns.SetWidth(1, 120);
            grid2.Columns.SetWidth(2, 120);
            grid2.Columns.SetWidth(3, 100);
            this.loadLstPlanif();
        }
        /// <summary>
        ///     Default Constructor for SQLiteDatabase Class.
        /// </summary>
        public SQLiteDatabase(ApplClass _applClass)
        {
            p_applClass = _applClass;
            string _dir = System.IO.Path.Combine(ClassOutils.GetPathStart, "Data");
            if (!System.IO.Directory.Exists(_dir)) { System.IO.Directory.CreateDirectory(_dir); }
            p_databaseDirectory = System.IO.Path.Combine(ClassOutils.GetPathStart, "Data", "DBPlanning.db");
            if (!System.IO.File.Exists(p_databaseDirectory)) { this.createDataBase(); }

            dbConnection = String.Format("Data Source={0}", p_databaseDirectory);
        }