Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         coll = cardDal.getCard(" User_Id= 1");
         if (coll.Count > 0)
         {
         }
     }
 }
 private void BindDataGrid(List<QueryElement> list)
 {
     cardColl = CardMethods.GetCard(list);
     this.CardListDataGrid.DataSource = cardColl;
     this.CardListDataGrid.DataBind();
     for (int i = 0; i < cardColl.Count; i++)
     {
         this.CardListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayAccountType(cardColl[i].AccountType);
         this.CardListDataGrid.Items[i].Cells[3].Text = StaticRescourse.DisplayBank(cardColl[i].BankId);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 动态条件查询卡号
        /// </summary>
        /// <param name="strFields">条件字段</param>
        /// <param name="strValues">条件值</param>
        /// <returns></returns>
        public static CardCollection GetCard(List<QueryElement> list)
        {
            CardCollection coll = new CardCollection();
            StringBuilder sb = new StringBuilder();

            sb.Append(" select card.*,a.name as ownerName,b.name as userName from card left join user a on card.ownerId=a.id left join user b on card.userId = b.id 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 CardInfo(reader));
                    }
                }
            }
            else
            {
                using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString()))
                {
                    while (reader.Read())
                    {
                        coll.Add(new CardInfo(reader));
                    }
                }
            }
            return coll;
        }
Esempio n. 4
0
 public static CardCollection GetCardByUserId(int userId)
 {
     CardCollection coll = new CardCollection();
     StringBuilder sb = new StringBuilder();
     sb.Append(" select card.*,a.name as ownerName,b.name as userName from card left join user a on card.ownerId=a.id left join user b on card.userId = b.id where card.UserId=@UserId ");
     MySqlParameter par = new MySqlParameter("@UserId", MySqlDbType.Int32);
     par.Value = userId;
     using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString(), par))
     {
         while (reader.Read())
         {
             coll .Add(new CardInfo(reader));
         }
     }
     return coll;
 }
Esempio n. 5
0
        public CardCollection 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;
            }

            CardCollection pages = new CardCollection();

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

            return(pages);
        }
Esempio n. 6
0
 public CardCollectionEnumerator(CardCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }
 public CardCollectionEnumerator(CardCollection mappings)
 {
     enumerator = ((IEnumerable)mappings).GetEnumerator();
 }
        public CardCollection 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;

            CardCollection pages = new CardCollection();

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

            return pages;
        }
 public void AddRange(CardCollection value)
 {
     for (int i = 0; (i < value.Count); i++)
     {
         this.Add(value.List[i] as CardInfo);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 初始化卡号(新增)
        /// </summary>
        private void InitializeDropIncomeCardNumber()
        {
            CardCollection cardcoll = new CardCollection();
            List<QueryElement> list = new List<QueryElement>();
            cardcoll = CardMethods.GetCard(list);
            List<DropItem> card = new List<DropItem>();
            card.Add(new DropItem { ValueField = "", DisplayField = " " });

            for (int i = 0; i < cardcoll.Count; i++)
            {
                CardInfo cardInfo = cardcoll[i];
                string bank = StaticRescourse.DisplayBank(cardInfo.BankId);
                card.Add(new DropItem { ValueField = cardInfo.Id.ToString(), DisplayField = cardInfo.CardNumber+" "+bank});// +" "+bank 
            }
            this.dropIncomeAddCardNumber.DataSource = card;
            Helper.SetDropDownList(this.dropIncomeAddCardNumber);
            this.dropIncomeAddCardNumber.SelectedValue = string.Empty;
        }
Esempio n. 11
0
        /// <summary>
        /// 初始化卡号(新增)
        /// </summary>
        private void InitializeDropExpensesDropControl()
        {

            List<CardHelper> cardNumberList = new List<CardHelper>();
            List<CardHelper> cxList = new List<CardHelper>();

            CardCollection cardcoll = new CardCollection();      //返回的卡的collection
            cardcoll = CardMethods.GetCard(new List<QueryElement>());
            
            List<DropItem> card = new List<DropItem>();
            card.Add(new DropItem { ValueField = "", DisplayField = " " });

            for (int i = 0; i < cardcoll.Count; i++)
            {
                CardInfo info = cardcoll[i];
                cardNumberList.Add(new CardHelper { CardId = info.Id, BankId = info.BankId, CardNumber = info.CardNumber });
            }
            cxList.AddRange(cardNumberList.OrderBy(x=>x.CardNumber));
            cardNumberList.Clear();
            for (int i = 0; i < cxList.Count;i++ )
            {
                if (i == 0 || cxList[i].CardNumber != cxList[i - 1].CardNumber)
                {
                    cardNumberList.Add(new CardHelper { CardId = cxList[i].CardId, BankId = cxList[i].BankId, CardNumber = cxList[i].CardNumber });
                }
            }

            for (int i = 0; i < cardNumberList.Count; i++)
            {
                var cardInfo = cardNumberList[i];
                string bank = StaticRescourse.DisplayBank(cardInfo.BankId);
                card.Add(new DropItem { ValueField = cardInfo.CardId.ToString(), DisplayField = cardInfo.CardNumber + " " + bank });// +" "+bank 
            }
                this.dropExpensesAddCardNumber.DataSource = card;
            Helper.SetDropDownList(this.dropExpensesAddCardNumber);

            this.dropExpensesAddSpendMode.DataSource = StaticRescourse.GetSpendMode();
            Helper.SetDropDownList(this.dropExpensesAddSpendMode);

            this.dropExpensesAddSpendType.DataSource = StaticRescourse.GetSpendType();
            Helper.SetDropDownList(this.dropExpensesAddSpendType);
        }