public void AddRange(BorrowORLoanCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as BorrowORLoanInfo);
     }
 }
Example #2
0
        public static BorrowORLoanCollection GetLoanList(List<QueryElement> list)
        {
            BorrowORLoanCollection coll = new BorrowORLoanCollection();
            StringBuilder sb = new StringBuilder();

            sb.Append(" select * from borrowing where BorrowORLoan=2 ");
            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 BorrowORLoanInfo(reader));
                    }
                }
            }
            else
            {
                using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString()))
                {
                    while (reader.Read())
                    {
                        coll.Add(new BorrowORLoanInfo(reader));
                    }
                }
            }
            return coll;
        }
        public BorrowORLoanCollection 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;
            }

            BorrowORLoanCollection pages = new BorrowORLoanCollection();

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

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

            BorrowORLoanCollection pages = new BorrowORLoanCollection();

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

            return pages;
        }
 public void AddRange(BorrowORLoanCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as BorrowORLoanInfo);
     }
 }
 public BorrowORLoanCollectionEnumerator(BorrowORLoanCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }