コード例 #1
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            Langue other = (Langue)obj;

            if (this.id != other.id)
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
        public override String AddContraint(String query)
        {
            try
            {
                String mot      = "francais";
                String francais = Utils.FindWord(query, mot);
                if (francais != null ? francais.Trim().Length > 0 : false)
                {
                    int idx = Utils.Occurence(francais, '.');
                    if (idx > 1)
                    {
                        query = query.Replace("WHERE", "INNER JOIN " + Dictionnaire.ToTable() + " fr ON " + Utils.FindNextWord(query, ToTable()) + "francais = fr.id WHERE");
                        idx   = francais.IndexOf(mot);
                        if (idx > -1)
                        {
                            idx   = (francais.Substring(0, idx) + "" + francais.Substring(idx, mot.Length)).Length;
                            query = query.Replace(francais, "fr" + francais.Substring(idx, francais.Length - idx));
                        }
                    }
                }

                mot = "langue";
                String langue = Utils.FindWord(query, mot);
                if (langue != null ? langue.Trim().Length > 0 : false)
                {
                    int idx = Utils.Occurence(langue, '.');
                    if (idx > 1)
                    {
                        query = query.Replace("WHERE", "INNER JOIN " + Langue.ToTable() + " lang ON " + Utils.FindNextWord(query, ToTable()) + "langue = lang.id WHERE");
                        idx   = langue.IndexOf(mot);
                        if (idx > -1)
                        {
                            idx   = (langue.Substring(0, idx) + "" + langue.Substring(idx, mot.Length)).Length;
                            query = query.Replace(langue, "lang" + langue.Substring(idx, langue.Length - idx));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Messages.Exception("Dictionnaire (AddContraint) ", ex);
            }
            return(query);
        }