public ScFilterElement(ScFilterElement scFilter)
 {
     Field = scFilter.Field;
     Value = scFilter.Value;
     Oper  = scFilter.Oper;
     Opr   = scFilter.Opr;
 }
        public DBFilter GetPassOffenseEffFilter(ScFilterList scFilterList)
        {
            DBFilter EffFilter = new DBFilter();

            foreach (ScAFilter scFilter in scFilterList.ScFilters)
            {
                if (scFilter.ReportScType != 20 || !(scFilter.Name.EndsWith("-PASSEFF-O")))
                {
                    continue;
                }

                for (int i = 0; i < scFilter.Elements.Count; i++)
                {
                    ScFilterElement element = scFilter.Elements[i];

                    Webb.Data.DBCondition condition = new Webb.Data.DBCondition();

                    condition.ColumnName = element.Field;

                    condition.Value = element.Value;

                    condition.FilterType = GetFilterOper(element.Oper);

                    condition.FollowedOperand = this.GetFilterOpr(element.Opr);

                    if (i == scFilter.Elements.Count - 1)
                    {
                        condition.FollowedOperand = FilterOperands.Or;
                    }

                    condition.IgnoreCase = true;

                    EffFilter.Add(condition);
                }

                EffFilter.PlayAfter = scFilter.PlayAfter == 1;
            }

            EffFilter.IsCustomFilter = true;   //2010-11-1 12:11:46@Simon Add this Code

            EffFilter.Name = "PassOffenseEFF"; //2009-4-29 12:11:46@Simon Add this Code

            return(EffFilter);
        }
        public bool ReadOldFiltersFromDisk(string strFileName)
        {
            bool bSuccess = true;

            if (!File.Exists(strFileName))
            {
                return(false);
            }

            FileStream fs = File.Open(strFileName, FileMode.Open, FileAccess.Read, FileShare.Read);

            String str = string.Empty, dev = string.Empty;

            int len = 0, count = 0;

            char c = char.MinValue;

            //Opening bracket
            c = (char)fs.ReadByte();

            if (c != '[')
            {
                bSuccess = false;

                goto EXIT;
            }

            //Read filer name - "ScfilterList"
            str = AdvFilterUtilities.ReadString(fs, false, false);
            if (string.Compare(AdvFilterUtilities.FilterName, str) != 0)
            {
                bSuccess = false;

                goto EXIT;
            }

            //Read version
            dev = AdvFilterUtilities.ReadString(fs, false, false);
            if (string.Compare(dev, AdvFilterUtilities.FilterRev02) < 0)
            {
                bSuccess = false;

                goto EXIT;
            }

            //Read filters
            ScAFilter       aFilter   = null;
            ScFilterElement anElement = null;

            count = AdvFilterUtilities.ReadShort(fs);

            for (int i = 0; i < count; i++)
            {
                aFilter = new ScAFilter();

                aFilter.Name = AdvFilterUtilities.ReadString(fs, false, false);                 //filter name

                aFilter.ReportScType = fs.ReadByte();                                           //type      //10--Efficiency

                fs.Position++;

                if (string.Compare(dev, AdvFilterUtilities.FilterRev03) < 0)                            //Scouting filter Ver.3 have play after feature
                {
                    aFilter.PlayAfter = 0;
                }
                else
                {
                    aFilter.PlayAfter = fs.ReadByte();

                    fs.Position++;
                }

                len = fs.ReadByte();                    //count of elements

                fs.Position++;

                for (int j = 0; j < len; j++)
                {
                    anElement = new ScFilterElement();

                    anElement.Type = fs.ReadByte();                             //element's type

                    fs.Position += 3;

                    anElement.Field = AdvFilterUtilities.ReadString(fs, false, false);                          //element's field

                    fs.Position += 2;

                    anElement.Value = AdvFilterUtilities.ReadString(fs, false, false); //element's value

                    anElement.Oper = fs.ReadByte();                                    //element's oper

                    fs.Position++;

                    anElement.Opr = fs.ReadByte();                              //element's opr

                    fs.Position++;

                    aFilter.Elements.Add(anElement);
                }

                this.ScFilters.Add(aFilter);
            }

EXIT:
            {
                fs.Close();

                return(bSuccess);
            }
        }
        public bool ReadFromDisk(string strFileName)
        {
            bool bSuccess = true;

            if (!File.Exists(strFileName))
            {
                return(false);
            }

            FileStream fs = File.Open(strFileName, FileMode.Open, FileAccess.Read, FileShare.Read);

            String str = string.Empty;

            int len = 0, count = 0;

            //read version
            str = AdvFilterUtilities.ReadString(fs, true, true);

            if (String.Compare(str, AdvFilterUtilities.FilterRev01) > 0)                //check filter list version
            {
                fs.Close();

                bSuccess = false;

                goto EXIT;
            }

            //			//read count of filters
            count = AdvFilterUtilities.ReadShort(fs);

            //read filters
            ScAFilter       aFilter = null;
            ScFilterElement anElement = null;

            for (int i = 0; i < count; i++)
            {
                aFilter = new ScAFilter();

                aFilter.Name = AdvFilterUtilities.ReadString(fs, true, true);

                len = AdvFilterUtilities.ReadInt32(fs);

                for (int j = 0; j < len; j++)
                {
                    aFilter.Types.Add(AdvFilterUtilities.ReadString(fs, true, true));
                }

                len = AdvFilterUtilities.ReadInt32(fs);

                for (int j = 0; j < len; j++)
                {
                    anElement = new ScFilterElement();

                    anElement.Field = AdvFilterUtilities.ReadString(fs, true, true);

                    anElement.Value = AdvFilterUtilities.ReadString(fs, true, true);

                    anElement.Oper = AdvFilterUtilities.ReadInt32(fs);

                    anElement.Opr = AdvFilterUtilities.ReadInt32(fs);

                    aFilter.Elements.Add(anElement);
                }
                this.ScFilters.Add(aFilter);
            }

EXIT:
            {
                fs.Close();

                return(bSuccess);
            }
        }
 public void Remove(ScFilterElement i_Obj)
 {
     this.InnerList.Remove(i_Obj);
 }
 public void Insert(int index, ScFilterElement i_Object)
 {
     this.InnerList.Insert(index, i_Object);
 }
 //Methods
 public int Add(ScFilterElement i_Object)
 {
     return(this.InnerList.Add(i_Object));
 }