Esempio n. 1
0
        public SectionFilter GetReportFilter(ScAFilter scFilter)
        {
            SectionFilter sectionFilter = new SectionFilter();

            if (scFilter == null)
            {
                return(sectionFilter);                                  //Modified at 2008-11-24 15:54:17@Scott
            }
            sectionFilter.FilterName = scFilter.Name;

            foreach (ScFilterElement element in scFilter.Elements)
            {
                Webb.Data.DBCondition condition = new Webb.Data.DBCondition();

                condition.ColumnName = element.Field;

                condition.Value = element.Value;

                condition.FilterType = this.GetFilterOper(element.Oper);

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

                condition.IgnoreCase = true;

                sectionFilter.Filter.PlayAfter = scFilter.PlayAfter == 1;

                sectionFilter.Filter.Add(condition);
            }

            sectionFilter.Filter.IsCustomFilter = false;   //2010-11-1 12:11:46@Simon Add this Code

            sectionFilter.Filter.Name = scFilter.Name;     //2009-4-29 12:11:46@Simon Add this Code

            return(sectionFilter);
        }
Esempio n. 2
0
 public ScAFilter(ScAFilter scFilter)
 {
     this.Name     = scFilter.Name;
     this.Elements = scFilter.Elements.Copy();
     this.Types.Clear();
     foreach (object type in scFilter.Types)
     {
         this.Types.Add(type);
     }
 }
Esempio n. 3
0
        public static SectionFilterCollection GetCustomFilters(ScFilterList scFilterList, SectionFilterCollection scFilters)
        {
            //2009-5-1 13:33:26@Simon Add this Code

            if (scFilters == null)
            {
                return(scFilters);
            }

            if (scFilterList == null || scFilterList.ScFilters.Count == 0)
            {
                return(scFilters);
            }

            AdvFilterConvertor convert = new AdvFilterConvertor();

            SectionFilterCollection newscfFilters = new SectionFilterCollection();

            foreach (SectionFilter scFilter in scFilters)
            {
                if (scFilter == null)
                {
                    return(scFilters);
                }

                ScAFilter scAfilter = scFilterList.GetFilter(scFilter.FilterName);

                SectionFilter secFilter = new SectionFilter();

                if (scAfilter != null && scFilter.Filter.Name != string.Empty)
                {
                    if (!scFilter.Filter.IsCustomFilter)
                    {
                        secFilter = convert.GetReportFilter(scAfilter);
                    }
                    else
                    {
                        secFilter.Apply(scFilter);
                    }
                }
                else
                {
                    secFilter.Apply(scFilter);
                }

                newscfFilters.Add(secFilter);
            }

            return(newscfFilters);
        }
Esempio n. 4
0
        public static DBFilter GetAdvFilter(ScFilterList scFilterList, DBFilter Oldfilter)
        {
            AdvFilterConvertor convert = new AdvFilterConvertor();

            if (Oldfilter == null || Oldfilter.Name == string.Empty)
            {
                return(Oldfilter);
            }

            if (scFilterList == null || scFilterList.ScFilters.Count == 0)
            {
                return(Oldfilter);
            }

            if (Oldfilter.IsCustomFilter)
            {
                return(convert.UpdateEffFilter(scFilterList, Oldfilter));
            }

            ScAFilter scAfilter = scFilterList.GetFilter(Oldfilter.Name);

            if (scAfilter == null)
            {
                return(Oldfilter);
            }


            SectionFilter scFilter = convert.GetReportFilter(scAfilter);

            if (scFilter.Filter != null)
            {
                return(scFilter.Filter.Copy());
            }



            return(Oldfilter);
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
 public void Remove(ScAFilter i_Obj)
 {
     this.InnerList.Remove(i_Obj);
 }
Esempio n. 8
0
 public void Insert(int index, ScAFilter i_Object)
 {
     this.InnerList.Insert(index, i_Object);
 }
Esempio n. 9
0
 //Methods
 public int Add(ScAFilter i_Object)
 {
     return(this.InnerList.Add(i_Object));
 }