コード例 #1
0
 public void AddRange(CashIncomeCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as CashIncomeInfo);
     }
 }
コード例 #2
0
        public static CashIncomeCollection GetCashInCome(List<QueryElement> list)
        {
            CashIncomeCollection coll = new CashIncomeCollection();
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" {0} ", "select * from cashincome where 1=1");
            if (list.Count > 0)
            {
                MySqlParameter[] pars = new MySqlParameter[list.Count];
                for (int i = 0; i < list.Count; i++)
                {
                    QueryElement query = list[i];

                    if (query.QueryElementType == MySqlDbType.DateTime)
                    {
                        sb.AppendFormat("{0} {1} {2} @{3} ", query.QueryLogic, query.Queryname, query.QueryOperation, query.Queryname+i);
                        pars[i] = new MySqlParameter("@" + query.Queryname+i, query.QueryElementType);
                    }
                    else
                    {
                        sb.AppendFormat("{0} {1} {2} @{3} ", query.QueryLogic, query.Queryname, query.QueryOperation, query.Queryname);
                        pars[i] = new MySqlParameter("@" + query.Queryname, query.QueryElementType);
                    }
                    
                    if (query.QueryOperation.Equals("like"))
                    {
                        pars[i].Value = "%" + query.Queryvalue + "%";
                    }
                    else
                    {
                        pars[i].Value = query.Queryvalue;
                    }
                }
                using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString(), pars))
                {
                    while (reader.Read())
                    {
                        coll.Add(new CashIncomeInfo(reader));
                    }
                }
            }
            else
            {
                using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString()))
                {
                    while (reader.Read())
                    {
                        coll.Add(new CashIncomeInfo(reader));
                    }
                }
            }
            return coll;
        }
コード例 #3
0
        public CashIncomeCollection Pagination(int pageIndex, int pageSize)
        {
            if (InnerList.Count == 0)
            {
                return(null);
            }

            int start = pageSize * (pageIndex - 1);
            int end   = start + pageSize - 1;

            if (end > InnerList.Count - 1)
            {
                end = InnerList.Count - 1;
            }

            CashIncomeCollection pages = new CashIncomeCollection();

            for (int i = start; i <= end; i++)
            {
                pages.Add(InnerList[i] as CashIncomeInfo);
            }

            return(pages);
        }
コード例 #4
0
 public CashIncomeCollectionEnumerator(CashIncomeCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }
コード例 #5
0
        public CashIncomeCollection Pagination(int pageIndex, int pageSize)
        {
            if (InnerList.Count == 0)
                return null;

            int start = pageSize * (pageIndex - 1);
            int end = start + pageSize - 1;

            if (end > InnerList.Count - 1)
                end = InnerList.Count - 1;

            CashIncomeCollection pages = new CashIncomeCollection();

            for (int i = start; i <= end; i++)
            {
                pages.Add(InnerList[i] as CashIncomeInfo);
            }

            return pages;
        }
コード例 #6
0
 public void AddRange(CashIncomeCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as CashIncomeInfo);
     }
 }
コード例 #7
0
 public CashIncomeCollectionEnumerator(CashIncomeCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }