Exemplo n.º 1
0
 virtual public void GetChanges(System.Data.DataRowState rowStates)
 {
     if (_dataTable != null)
     {
         this.DataTable = _dataTable.GetChanges(rowStates);
     }
 }
Exemplo n.º 2
0
        public override CResultAErreur SaveAll(CContexteSauvegardeObjetsDonnees contexteSauvegarde, System.Data.DataRowState etatsAPrendreEnCompte)
        {
            ArrayList listeFichiersToDelete        = null;
            ArrayList listeFichiersToValide        = null;
            ArrayList listeFichiersANePasSupprimer = null;

            GetListesPourValidation(ref listeFichiersToDelete,
                                    ref listeFichiersToValide,
                                    ref listeFichiersANePasSupprimer);

            CResultAErreur result = CResultAErreur.True;

            m_commitEventHandlerNote = new OnCommitTransEventHandler(OnCommitTrans);
            DataTable table = contexteSauvegarde.ContexteDonnee.Tables[GetNomTable()];

            if (table != null)
            {
                foreach (DataRow row in table.Rows)
                {
                    if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added)
                    {
                        if (!CDocumentGED.IsControleDocumentsALaSauvegardeDesactive(contexteSauvegarde.ContexteDonnee))
                        //si désactivation des ids auto, on est dans un processus
                        //de synchronisation, donc , pas de contrôle de document
                        {
                            CDocumentGED       doc          = new CDocumentGED(row);
                            CReferenceDocument newReference = doc.ReferenceDoc;
                            bool bRefAsChange = true;
                            if (row.RowState == DataRowState.Modified)
                            {
                                doc.VersionToReturn = DataRowVersion.Original;
                                CReferenceDocument oldRef = doc.ReferenceDoc;
                                bRefAsChange = false;
                                if ((newReference == null) != (oldRef == null))
                                {
                                    bRefAsChange = true;
                                }
                                if (oldRef != null && !oldRef.Equals(newReference))
                                {
                                    listeFichiersToDelete.Add(oldRef);
                                    bRefAsChange = true;
                                }
                                doc.VersionToReturn = DataRowVersion.Current;
                            }
                            if (bRefAsChange)
                            {
                                result = PreValideDocument(newReference);
                            }
                            if (!result)
                            {
                                return(result);
                            }
                            if (bRefAsChange)
                            {
                                listeFichiersToValide.Add(doc.ReferenceDoc);
                            }
                            listeFichiersANePasSupprimer.Add(doc.ReferenceDoc);
                            listeFichiersToDelete.Remove(doc.ReferenceDoc);//Il ne faut pas le supprimer !
                        }
                    }
                    if (row.RowState == DataRowState.Deleted)
                    {
                        CDocumentGED doc = new CDocumentGED(row);
                        doc.VersionToReturn = DataRowVersion.Original;
                        string strRefString = doc.ReferenceString;
                        if (!listeFichiersToValide.Contains(doc.ReferenceDoc) &&
                            !listeFichiersANePasSupprimer.Contains(doc.ReferenceDoc))
                        {
                            listeFichiersToDelete.Add(doc.ReferenceDoc);
                        }
                        doc.VersionToReturn = DataRowVersion.Current;
                    }
                }
            }
            IDatabaseConnexion con = CSc2iDataServer.GetInstance().GetDatabaseConnexion(IdSession, GetType());

            if (con != null)
            {
                con.OnCommitTrans += m_commitEventHandlerNote;
            }
            result = base.SaveAll(contexteSauvegarde, etatsAPrendreEnCompte);
            return(result);
        }
Exemplo n.º 3
0
        /// //////////////////////////////////////////////////
        public override CResultAErreur SaveAll(CContexteSauvegardeObjetsDonnees contexteSauvegarde, System.Data.DataRowState etatsAPrendreEnCompte)
        {
            DataTable      table     = contexteSauvegarde.ContexteDonnee.Tables[GetNomTable()];
            List <DataRow> rowsAdded = new List <DataRow>();

            if (table != null)
            {
                foreach (DataRow row in new ArrayList(table.Rows))
                {
                    if (row.RowState == DataRowState.Added || (row.RowState == DataRowState.Modified && !row[CSc2iDataConst.c_champIsDeleted].Equals(true)))
                    {
                        rowsAdded.Add(row);
                    }
                    if (row.RowState == DataRowState.Deleted || (row.RowState == DataRowState.Modified && row[CSc2iDataConst.c_champIsDeleted].Equals(true)))
                    {
                        //TESTDBKEYTODO
                        CDonneeNotificationBesoinIntervention notif = new CDonneeNotificationBesoinIntervention(
                            IdSession,
                            CDbKey.CreateFromStringValue((string)row[CBesoinInterventionProcess.c_champKeyUtilisateur,
                                                                     DataRowVersion.Original]),
                            (int)row[CBesoinInterventionProcess.c_champId,
                                     DataRowVersion.Original],
                            (string)row[CBesoinInterventionProcess.c_champLibelle,
                                        DataRowVersion.Original],
                            true);
                        CEnvoyeurNotification.EnvoieNotifications(new IDonneeNotification[] { notif });
                    }
                }
            }
            CResultAErreur result = base.SaveAll(contexteSauvegarde, etatsAPrendreEnCompte);

            if (result)
            {
                foreach (DataRow row in rowsAdded)
                {
                    //TESTDBKEYTODO
                    CDonneeNotificationBesoinIntervention notif = new CDonneeNotificationBesoinIntervention(
                        IdSession,
                        CDbKey.CreateFromStringValue((string)row[CBesoinInterventionProcess.c_champKeyUtilisateur]),
                        (int)row[CBesoinInterventionProcess.c_champId],
                        (string)row[CBesoinInterventionProcess.c_champLibelle],
                        false);
                    CEnvoyeurNotification.EnvoieNotifications(new IDonneeNotification[] { notif });
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 public void ResetRowState()
 {
     rowState = DataRowState.Unchanged;
 }