コード例 #1
0
        public static void StockValeur(
            DataRow row,
            int idSession,
            string strChampType,
            string strChampBlob,
            string strChampString,
            object val)
        {
            if (val is IDifferencesBlob)
            {
                MemoryStream           stream     = new MemoryStream();
                BinaryWriter           writer     = new BinaryWriter(stream);
                CSerializerSaveBinaire serializer = new CSerializerSaveBinaire(writer);
                I2iSerializable        serTmp     = (I2iSerializable)val;
                CResultAErreur         result     = serializer.TraiteObject(ref serTmp);
                if (!result)
                {
                    throw new Exception(I.T("Can not serialize blob differences|192"));
                }
                row[strChampType] = typeof(IDifferencesBlob).ToString();
                CDonneeBinaireInRow donnee = new CDonneeBinaireInRow(idSession, row, strChampBlob);
                donnee.Donnees    = stream.GetBuffer();
                row[strChampBlob] = donnee;

                writer.Close();
                stream.Close();
            }
            else if (val is byte[])
            {
                CDonneeBinaireInRow donnee = new CDonneeBinaireInRow(idSession, row, strChampBlob);
                donnee.Donnees    = (byte[])val;
                row[strChampBlob] = donnee;
                row[strChampType] = typeof(byte[]).ToString();
            }
            else if (val != null && val.GetType() == typeof(CDonneeBinaireInRow))
            {
                row[strChampBlob] = val;
                row[strChampType] = typeof(byte[]).ToString();
            }
            else if (val is CObjetDonneeAIdNumerique)
            {
                row[strChampString] = ((CObjetDonneeAIdNumerique)val).Id;
                row[strChampString] = val.GetType().ToString();
            }
            else
            {
                row[strChampString] = CUtilTexte.ToUniversalString(val);
                if (val != null)
                {
                    row[strChampType] = val.GetType().ToString();
                }
                //else
                //    row[strChampType] = "";
            }
        }
コード例 #2
0
ファイル: CDifferencesTables.cs プロジェクト: ykebaili/Timos
            public CChampPourVersionLigneDeTable(DataRow row)
            {
                StringBuilder sb = new StringBuilder();

                m_strFieldKey = "";
                bool bDeleted = row.RowState == DataRowState.Deleted;

                if (bDeleted)
                {
                    row.RejectChanges();
                }

                foreach (DataColumn dc in row.Table.PrimaryKey)
                {
                    sb.Append(CUtilTexte.ToUniversalString(row[dc]).Replace("|", "\\|") + "|");
                }
                if (sb.Length == 0)
                {
                    //A VOIR SI CE CAS PEUT EXISTER ETANT DONNER
                    //QUE LE CDIFFERENCETABLE NE CONSIDERE PAS
                    //LES MAPPAGES SUR DES TABLES SANS CLE
                    foreach (DataColumn dc in row.Table.Columns)
                    {
                        sb.Append(CUtilTexte.ToUniversalString(row[dc]).Replace("|", "\\|") + "|");
                    }
                    if (sb.Length > 0)
                    {
                        m_strFieldKey = sb.ToString(0, sb.Length - 1);
                    }

                    m_strNomConvivial = I.TT(GetType(), "Row without identification|553");
                }
                else
                {
                    //m_strFieldKey = m_strFieldKey.Substring(0, m_strFieldKey.Length - 1);
                    if (sb.Length > 0)
                    {
                        m_strFieldKey = sb.ToString(0, sb.Length - 1);
                    }
                    //Ne pas traduire, Row key doit rester fixe (test en dur chez Audilog)
                    m_strNomConvivial = "Row key " + m_strFieldKey;
                }

                if (m_strFieldKey == "")
                {
                    throw new Exception(I.TT(GetType(), "CANNOT IDENTIFY ROW (empty key)|555"));
                }
                if (bDeleted)
                {
                    row.Delete();
                }
            }
コード例 #3
0
        void m_dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (m_origine == EOrigineVersion.Cible)
            {
                //AJOUT
                if (m_strLigneOrigine == "@NULL")
                {
                    e.CellStyle.BackColor          = Color.GreenYellow;
                    e.CellStyle.SelectionBackColor = Color.GreenYellow;
                }
                //MODIFICATION ?
                else
                {
                    string[] dataOriginales = m_strLigneOrigine.Split('|');
                    bool     bModifie       = false;
                    string   strVal         = "";
                    if (e.ColumnIndex - 1 < dataOriginales.Length && e.ColumnIndex - 1 >= 0)
                    {
                        strVal = dataOriginales[e.ColumnIndex - 1];
                    }
                    if (strVal == "@NULL")
                    {
                        bModifie = (e.Value != DBNull.Value);
                    }
                    else
                    {
                        bModifie = CUtilTexte.ToUniversalString(e.Value) != strVal;
                    }

                    if (bModifie)
                    {
                        e.CellStyle.SelectionBackColor = Color.PaleGoldenrod;
                        e.CellStyle.BackColor          = Color.PaleGoldenrod;
                    }
                    else
                    {
                        e.CellStyle.SelectionBackColor = Color.Transparent;
                    }
                }
            }
            else
            {
                e.CellStyle.SelectionBackColor = Color.White;
            }

            e.CellStyle.SelectionForeColor = Color.Black;
        }
コード例 #4
0
ファイル: CDifferencesTables.cs プロジェクト: ykebaili/Timos
            public string GetStringSerialisation()
            {
                StringBuilder sb        = new StringBuilder();
                string        strResult = "";

                if (m_row != null)
                {
                    foreach (DataColumn c in m_row.Table.Columns)
                    {
                        if (c.ColumnName == "ID" || c.ColumnName == CTableParametrable.c_strColTimeStamp)
                        {
                            continue;
                        }
                        object val = null;
                        if (m_row.RowState == DataRowState.Deleted)
                        {
                            val = m_row[c, DataRowVersion.Original];
                        }
                        else
                        {
                            val = m_row[c];
                        }

                        sb.Append(CUtilTexte.ToUniversalString(val).Replace("|", "\\|") + "|");
                        //strResult += CUtilTexte.ToUniversalString(val).Replace("|", "\\|") + "|";
                    }
                }
                if (sb.Length > 0)
                {
                    strResult = sb.ToString(0, sb.Length - 1);
                }
                else
                {
                    strResult = I.T("No Value|556");
                }
                return(strResult);
            }