public frmItemCalendar(Ecole infoEcole) { InitializeComponent(); _infoEcole = infoEcole; _dateSelected = infoEcole.StartDate; p_modeDuplicate = false; }
public frmItemCalendar(Ecole infoEcole, DateTime dateSelected) { InitializeComponent(); _infoEcole = infoEcole; _dateSelected = dateSelected; p_modeDuplicate = false; }
public frmItemCalendar(Ecole infoEcole, bool modeDuplicate) { InitializeComponent(); _infoEcole = (Ecole)infoEcole.Clone() ; _dateSelected = infoEcole.StartDate; p_modeDuplicate = true; }
public frmInfo(Ecole infoEcole) { InitializeComponent(); _infoEcole = infoEcole; }
/// <summary> /// Ajouter une école depuis le fichier CSV /// </summary> /// <param name="tabData"></param> public int UpdateEcoleFromCSVFile(Ecole tabData) { int _nbAdd = 0; if (p_listEcole == null) { p_listEcole = new List<Ecole>(); } foreach (Ecole _ecole in p_listEcole) { if (_ecole.IdEcole == tabData.IdEcole) { // Mise à jour des informations _ecole.Libelle = tabData.Libelle; _ecole.Adresse = tabData.Adresse; _ecole.CodePostal = tabData.CodePostal; _ecole.Telephone = tabData.Telephone; _ecole.Ville = tabData.Ville; return _nbAdd; } } _nbAdd++; p_listEcole.Add(tabData); return _nbAdd; // MAPPING // tabData[0] }
/// <summary> /// Ajouter une école depuis le fichier CSV /// </summary> /// <param name="tabData"></param> public int AddEcoleFromCSVFile(Ecole tabData) { if (p_listEcole == null) { p_listEcole = new List<Ecole>(); } p_listEcole.Add(tabData); return 1; // MAPPING // tabData[0] }
private void affecteCouleur(Ecole _infoEcole, ref ListViewItem itemEcole) { itemEcole.UseItemStyleForSubItems = false; if (_infoEcole.isSchedule) { if (_infoEcole.Confirme) { itemEcole.SubItems[0].BackColor = Color.FromArgb(255, 175, 255, 170); itemEcole.SubItems[0].ForeColor = Color.FromArgb(255, 175, 255, 170); } else { itemEcole.SubItems[0].BackColor = Color.FromArgb(255, 255, 223, 66); itemEcole.SubItems[0].ForeColor = Color.FromArgb(255, 255, 223, 66); } } else { itemEcole.SubItems[0].BackColor = Color.FromArgb(255, 255, 104, 102); itemEcole.SubItems[0].ForeColor = Color.FromArgb(255, 255, 104, 102); } }
/// <summary> /// Ajout d'un Item dans la ListView /// </summary> /// <param name="itemEcole">object Ecole</param> public void addItem(Ecole itemEcole) { string colDate; if (!itemEcole.isSchedule) { colDate = ""; } else { colDate = itemEcole.StartDate.ToString("dd-MM-yyyy"); } string namePhoto; if (String.IsNullOrEmpty(itemEcole.Photographe)) { namePhoto = ""; } else { namePhoto = p_param.GetNamePhotoGrapheFromId(itemEcole.Photographe); } ListViewItem item = new ListViewItem(new[] { itemEcole.getFlag(), itemEcole.Libelle, itemEcole.Ville, colDate, namePhoto, itemEcole.IdEcole }); item.Name = itemEcole.IdEcole; item.ToolTipText = itemEcole.Libelle; this.affecteCouleur(itemEcole, ref item); lstToSchedule.Items.Add(item); }
/// <summary> /// Mise à jour du Control Calendar /// </summary> /// <param name="itemEcole"></param> public void updateCalendar(Ecole itemEcole, bool withShow) { StringBuilder _infoText = new StringBuilder(); if (itemEcole.isSchedule) { // On vérifie que le CalendarItem existe for (int i = 0; i < _itemsCalendar.Count; i++) { if ((string)_itemsCalendar[i].Tag == itemEcole.IdEcole) { _itemsCalendar[i].ApplyColor(Color.FromName(p_param.GetCoulorFromId(itemEcole.Photographe))); _itemsCalendar[i].StartDate = itemEcole.StartDate; _itemsCalendar[i].EndDate = itemEcole.EndDate; _infoText.AppendLine(itemEcole.Libelle); _itemsCalendar[i].Text = _infoText.ToString(); if (itemEcole.Confirme) { _itemsCalendar[i].Image = imgList.Images[0]; _itemsCalendar[i].ImageAlign = CalendarItemImageAlign.South; } else { _itemsCalendar[i].Image = null; } if (withShow) { this.setViewRangeFromDate(itemEcole.StartDate); } PlaceItems(); return; } } _infoText.AppendLine(itemEcole.Libelle); _infoText.AppendLine("Ville : " + itemEcole.Ville); _infoText.AppendLine("Photographe : " + p_param.GetNamePhotoGrapheFromId(itemEcole.Photographe)); CalendarItem cal = new CalendarItem(objCalendar, itemEcole.StartDate, itemEcole.EndDate, _infoText.ToString()); if (withShow) { this.setViewRangeFromDate(itemEcole.StartDate); } cal.ApplyColor(Color.FromName(p_param.GetCoulorFromId(itemEcole.Photographe))); cal.Tag = itemEcole.IdEcole; if (itemEcole.Confirme) { cal.Image = imgList.Images[0]; cal.ImageAlign = CalendarItemImageAlign.South; } else { cal.Image = null; } _itemsCalendar.Add(cal); PlaceItems(); } }
/// <summary> /// Mise à jour des infos sur l'école /// </summary> /// <param name="ecoleUpdated">objet Ecole modifiée</param> public void updateInfoEcole(Ecole ecoleUpdated) { p_isModified = true; // on flag un mise à jour for (int i = 0; i < p_listEcole.Count; i++) { if (p_listEcole[i].IdEcole == ecoleUpdated.IdEcole) { p_listEcole[i].StartDate = ecoleUpdated.StartDate; p_listEcole[i].EndDate = ecoleUpdated.EndDate; p_listEcole[i].Photographe = ecoleUpdated.Photographe; p_listEcole[i].isSchedule = ecoleUpdated.isSchedule; p_listEcole[i].Confirme = ecoleUpdated.Confirme; } } ListViewItem itemEcole = lstToSchedule.Items[ecoleUpdated.IdEcole]; if (!ecoleUpdated.isSchedule) { itemEcole.SubItems[3].Text = ""; } else { itemEcole.SubItems[3].Text = ecoleUpdated.StartDate.ToString("dd-MM-yyyy"); } itemEcole.SubItems[0].Text = ecoleUpdated.getFlag(); this.affecteCouleur(ecoleUpdated, ref itemEcole); if (ecoleUpdated.Photographe == "") { itemEcole.SubItems[4].Text = ""; } else { itemEcole.SubItems[4].Text = p_param.GetNamePhotoGrapheFromId(ecoleUpdated.Photographe); } this.displayNbSchedule(); }
/// <summary> /// Ajouter une école depuis le fichier CSV /// </summary> /// <param name="tabData"></param> public void AddEcole(Ecole tabData) { if (p_listEcole == null) { p_listEcole = new List<Ecole>(); } p_listEcole.Add(tabData); ListViewItem _tempLst = lstToSchedule.TopItem; this.addItem(tabData); lvwColumnSorter.SortColumn = p_numColSort; lvwColumnSorter.Order = p_sortOrder; lstToSchedule.Sort(); //lstToSchedule.RedrawItems(lstToSchedule.SelectedItems[0].Index, lstToSchedule.Items.Count - 1, true); lstToSchedule.TopItem = _tempLst; }
public void addEntry(Ecole _infoEcole) { p_isModified = true; p_listEcole.Add(_infoEcole); this.displayNbSchedule(); }
/// <summary> /// Evénément déclencher lors d'un clic sur l'ajout d'une entrée /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddEntry_Click(object sender, EventArgs e) { Ecole _newEcole = new Ecole(); //int _idMax = Tools.getMaxId(p_listEcole); //_newEcole.IdEcole = _idMax.ToString(); frmAddEntry frmAjout = new frmAddEntry(_newEcole); frmAjout.Owner = this; frmAjout.Show(); }
/// <summary> /// Importer le fichier Client /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConvert_Click(object sender, EventArgs e) { if (!chkUpdate.Checked) { StringBuilder _message = new StringBuilder(); _message.AppendLine("Attention la mise à jour n'est pas activée."); _message.AppendLine("La planification complète sera supprimée."); _message.Append("Voulez-vous continuer ?"); DialogResult _choix = MessageBox.Show(_message.ToString(), "Attention", MessageBoxButtons.YesNo,MessageBoxIcon.Warning); if (_choix == System.Windows.Forms.DialogResult.No) { return; } } // Lecture ligne à ligne StreamReader srFile = new StreamReader(strClientFileName, Encoding.Default); int numLigne = 0; string strBuffer = "a"; if (!chkUpdate.Checked) { frm.resetAll(); } else { frm.resetControls(); } char[] _separator = new char[] { }; switch (p_typeFichier) { case TypeFichier.CSVFile: _separator = new char[] { ';' }; break; case TypeFichier.TXTFile: _separator = new char[] { '\t' }; break; } int _nbAdd = 0; lblRapport.Text = "Import en cours..."; while (strBuffer != null) { strBuffer = srFile.ReadLine(); if (strBuffer == null) { break; } else { string[] tabData = strBuffer.Split(_separator); if (tabData[0] != String.Empty && !tabData[0].Contains("Code")) { numLigne++; Ecole _lineEcole = new Ecole(); _lineEcole.IdEcole = tabData[0]; _lineEcole.Libelle = getSchoolName(tabData[20]); _lineEcole.CodePostal = tabData[22]; _lineEcole.Adresse = tabData[21]; _lineEcole.Ville = tabData[23]; _lineEcole.Telephone = tabData[17]; _lineEcole.initEcole(); if (!chkUpdate.Checked) { _nbAdd += frm.AddEcoleFromCSVFile(_lineEcole); } else { _nbAdd += frm.UpdateEcoleFromCSVFile(_lineEcole); } progressBar1.Value = numLigne; } } } int _nbModify = numLigne - _nbAdd; lblRapport.Text = String.Format("Import terminé.\rNombre d'écoles ajoutées : {0}\rNombre d'écoles modifiées : {1}", _nbAdd.ToString(), _nbModify.ToString()); frm.traiterListEcole(); if (MessageBox.Show("Voulez-vous importer les contacts ?", "Importer les contacts", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { this.tbImport.SelectedIndex = 1; this.showFiledialog(); } }
public frmAddEntry(Ecole _infoEcole) { InitializeComponent(); p_infoEcole = _infoEcole; }