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);
        }
示例#2
0
        private void BindIncomeListDataGrid(List <QueryElement> list)
        {
            CashIncomeCollection coll = CashIncomeMethods.GetCashIncome(list);

            this.IncomeListDataGrid.DataSource = coll;
            this.IncomeListDataGrid.DataBind();
            for (int i = 0; i < coll.Count; i++)
            {
                CashIncomeInfo cashInfo = coll[i];
                CardInfo       cardInfo = CardMethods.GetCardByCardNumber(cashInfo.CardNumber, cashInfo.OwnerId);
                string         bank     = StaticRescourse.DisplayBank(cardInfo.BankId);
                this.IncomeListDataGrid.Items[i].Cells[1].Text = StaticRescourse.DisplayIncomeStatus(cashInfo.Status);
                this.IncomeListDataGrid.Items[i].Cells[4].Text = StaticRescourse.DisplayIncomeType(cashInfo.IncomeType);
                this.IncomeListDataGrid.Items[i].Cells[6].Text = StaticRescourse.DisplayMode(cashInfo.Mode);
                this.IncomeListDataGrid.Items[i].Cells[7].Text = StaticRescourse.DisplayRate(cashInfo.Rate);
                this.IncomeListDataGrid.Items[i].Cells[8].Text = cashInfo.DepositDate.ToString("yyyy-MM-dd");
                if (cashInfo.AutoSave == 1)
                {
                    this.IncomeListDataGrid.Items[i].Cells[12].Text = "是";
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[12].Text = "否";
                }
                if (HelperCommon.CompareAccordToRequired(cashInfo.BDate))
                {
                    this.IncomeListDataGrid.Items[i].Cells[9].Text = cashInfo.BDate.ToString("yyyy-MM-dd");
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[9].Text = string.Empty;
                }
                if (HelperCommon.CompareAccordToRequired(cashInfo.EDate))
                {
                    this.IncomeListDataGrid.Items[i].Cells[10].Text = cashInfo.EDate.ToString("yyyy-MM-dd");
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[10].Text = string.Empty;
                }

                this.IncomeListDataGrid.Items[i].Cells[13].Text = StaticRescourse.DisplayIncomeDepositMode(cashInfo.DepositMode);
            }
        }