Exemple #1
0
        private void AssignCommunication(Entities.Communication communication)
        {
            cboFolders.DataSource = Connexion.Instance().Dossier.ToList();
            cboFolders.Text       = communication.Dossier_ID;

            var referents = SelectReferents();

            cboReferent.DataSource    = referents.ToList();
            cboReferent.Text          = referents.FirstOrDefault((x) => x.Referent_ID == (communication.Referent_ID))?.Referent_ID;
            cboInterlocuteur.Text     = communication.Interlocuteur;
            cboMotif.Text             = communication.Motif;
            cboTypeCommunication.Text = communication.Type;

            var intervenant = Connexion.Instance().Intervenant.FirstOrDefault((x) => x.intervenant_id == communication.IdIntervenant);

            if (intervenant == null)
            {
                cboEmployes.Text = communication.Intervenant;
            }
            else
            {
                cboEmployes.Text = intervenant.nom;
            }
            CurrentEntity  = communication;
            rtxtNotes.Text = communication.Note;

            if (communication.DateEven.HasValue)
            {
                dtpDateEvent.CustomFormat = "yyyy/MM/dd";
                dtpDateEvent.Value        = communication.DateEven.Value;
            }
            else
            {
                dtpDateEvent.Value        = Helper.CurrentDateTime().Date;
                dtpDateEvent.CustomFormat = " ";
            }

            if (communication.DateComm.HasValue)
            {
                dtpDateCommunication.CustomFormat = "yyyy/MM/dd";
                dtpDateCommunication.Value        = communication.DateComm.Value;
            }
            else
            {
                dtpDateCommunication.Value        = Helper.CurrentDateTime().Date;
                dtpDateCommunication.CustomFormat = " ";
            }

            if (communication.Heure.HasValue)
            {
                dtpHours.CustomFormat = "HH:mm:ss";
                dtpHours.Value        = Convert.ToDateTime(communication.Heure.Value.ToString());
            }
            else
            {
                dtpHours.Value        = Helper.CurrentDateTime();
                dtpHours.CustomFormat = " ";
            }
        }
Exemple #2
0
        private void CommunicationAdded(object sender, Entities.Communication e)
        {
            if (((Entities.Dossier)bsData.Current).Dossier_ID.Equals(e.Dossier_ID))
            {
                //Connexion.connexionActionsCommunication.ObjectContextUpdater();

                bsDataCommunication.DataSource = Connexion.Instance().Communication.Where(x => x.Dossier_ID.Equals(e.Dossier_ID)).OrderByDescending(c => c.DateComm).ThenByDescending(o => o.Heure).ToList();
            }
        }
Exemple #3
0
        /// <summary>
        /// Sauvegarde le suivi présent
        /// </summary>
        private Boolean Save()
        {
            DialogResult result;

            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();

            try
            {
                if (CurrentEntity != null)
                {
                    //Connexion.connexionActionsCommunication.ObjectContextUpdater();
                    this.CurrentEntity = Connexion.Instance().Communication.FirstOrDefault(x => x.Communication_ID == CurrentEntity.Communication_ID);
                    AssignValues();
                    var sucess = connexionActions.Update(CurrentEntity);
                    OnCommunicationUpdated(new EventArgs());

                    return(sucess);
                }

                if (((Entities.Dossier)cboFolders.SelectedItem) == null)
                {
                    result = MessageBox.Show("Vous devez sélectionner un dossier pour pouvoir sauvegarder la communication",
                                             "Attention",
                                             MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);

                    if (result == DialogResult.Cancel)
                    {
                        m_SkipSave = true;
                        Close();
                    }
                    m_SkipSave = false;
                    return(false);
                }

                CurrentEntity = new Entities.Communication();
                AssignValues();
                connexionActions.Add(CurrentEntity);
                bindingNavigator1.Enabled = true;
                bsData.DataSource         = Connexion.Instance().Communication.OrderBy(x => x.Communication_ID).ThenBy(o => o.Heure).ToList();
                OnCommunicationAdded(new EventArgs());
                return(true);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                Application.DoEvents();
            }
        }
Exemple #4
0
 /// <summary>
 /// Permet de vider tous les contrôles
 /// </summary>
 private void Clean()
 {
     cboEmployes.SelectedValue  = -1;
     cboFolders.SelectedValue   = -1;
     cboReferent.SelectedIndex  = -1;
     cboReferent.Text           = "";
     cboMotif.Text              = "";
     cboInterlocuteur.Text      = "";
     cboTypeCommunication.Text  = "";
     dtpDateCommunication.Value = DateTime.Now.Date;
     dtpDateEvent.Value         = DateTime.Now.Date;
     dtpHours.Value             = Helper.CurrentDateTime();
     rtxtNotes.Text             = "";
     CurrentEntity              = null;
     cboFolders.Enabled         = true;
     bindingNavigator1.Enabled  = false;
     initialize = false;
 }
Exemple #5
0
 public Communication(Entities.Communication communication) : this()
 {
     CurrentEntity = communication;
     AssignCommunication(CurrentEntity);
 }
Exemple #6
0
 private void bindingNavigatorMovePreviousItem_Click(object sender, EventArgs e)
 {
     CurrentEntity = (Entities.Communication)bsData.Current;
     AssignCommunication(CurrentEntity);
 }