Exemplo n.º 1
0
 public void AddRange(ExpensesCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as ExpensesInfo);
     }
 }
Exemplo n.º 2
0
        public static ExpensesCollection GetExpensesList(List<QueryElement> list)
        {
            ExpensesCollection coll = new ExpensesCollection();
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" {0} ", "select * from expenses 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 ExpensesInfo(reader));
                    }
                }
            }
            else
            {
                using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString()))
                {
                    while (reader.Read())
                    {
                        coll.Add(new ExpensesInfo(reader));
                    }
                }
            }
            return coll;
        }
Exemplo n.º 3
0
        public ExpensesCollection 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;
            }

            ExpensesCollection pages = new ExpensesCollection();

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

            return(pages);
        }
 public ExpensesCollectionEnumerator(ExpensesCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }
        public ExpensesCollection 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;

            ExpensesCollection pages = new ExpensesCollection();

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

            return pages;
        }
 public void AddRange(ExpensesCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as ExpensesInfo);
     }
 }
Exemplo n.º 7
0
 public ExpensesCollectionEnumerator(ExpensesCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }