Example #1
0
        private void OnBind(int index, string as_where)
        {
            ListView list = FindViewById<ListView>(Resource.Id.Replenishment_items);
            TextView page = FindViewById<TextView>(Resource.Id.Replenishment_Page);

            DataTable ldt = new DataTable();
            int count = 0;
            string sql = @"SELECT
                                goodsno.goo_code,
                                goodsno.goo_no,
                                goodsno.Goo_Type,
                                goodsno.Goo_Mate,
                                goodsno.goo_name,
                                oldsaleprice.price,
                                goodsno.Spec,
                                goodsno.Content,
                                goodsno.Goo_unit,
                                '正常' as getdetail_memo,
                                oldsaleprice.saledate 
                                FROM goodsno, oldsaleprice
                                WHERE
                                goodsno.goo_code = oldsaleprice.goo_code
                                and oldsaleprice.cus_code = '" + SysVisitor.cus_code + "'";
            if (!string.IsNullOrEmpty(as_where))
            {
                sql += " and goodsno.goo_no like '%" + as_where + "%'";
                sql += " or goodsno.goo_name like '%" + as_where + "%'";
                sql += " or goodsno.Content like '%" + as_where + "%'";
                sql += " or oldsaleprice.price like '%" + as_where + "%'";
            }
            if (!string.IsNullOrEmpty(SysVisitor.gooTypeCode))
            {
                sql += " and goodsno.Goo_Type = '" + SysVisitor.gooTypeCode + "'";
            }
            ldt = SqliteHelper.ExecuteDataTable(sql, pageSize, pageIndex, ref count);
            if (count % 10 == 0)
                pageCount = count / 10;
            else
                pageCount = count / 10 + 1;
            page.Text = pageIndex + "/" + pageCount;
            System.Collections.Hashtable hash = Shopping.GetHash(true);
            DataTable ldt_give = ChangeHashtable.HashtableToDataTable(hash, "goo_code", "num");
            if (ldt_give.Rows.Count > 0)
            {
                for (int i = 0; i < ldt_give.Rows.Count; i++)
                {
                    string[] ls_list = SysVisitor.DataTableColumnsToList(ldt, "goo_code");
                    int location = 0;
                    bool istrue = ls_list.Contains(ldt_give.Rows[i]["goo_code"]);
                    foreach (string str in ls_list)
                    {
                        if (str == ldt_give.Rows[i]["goo_code"].ToString())
                            break;
                        location++;
                    }
                    if (istrue)
                    {
                        DataRow newRow = ldt.NewRow();
                        foreach (DataColumn aDataColumn in ldt.Columns)
                        {
                            newRow[aDataColumn.ColumnName] = ldt.Rows[location][aDataColumn.ColumnName];
                        }
                        newRow["getdetail_memo"] = "买赠";
                        newRow["price"] = "0.00";
                        ldt.Rows.InsertAt(newRow, location + 1);
                    }
                }
            }
            string aa = baseclass.Json.DataTableToJson(ldt);
            aa += "";

            TextView money = FindViewById<TextView>(Resource.Id.Replenishment_goo_money);

            ReplenishmentAdapter listItemAdapter = new ReplenishmentAdapter(this, ldt, money, pageIndex);
            list.Adapter = listItemAdapter;
        }
Example #2
0
        private void OnBind(int index, string as_where)
        {
            ListView list = FindViewById<ListView>(Resource.Id.Replenishment_items);
            TextView page = FindViewById<TextView>(Resource.Id.Replenishment_Page);

            DataTable ldt = new DataTable();
            int count = 0;
            string sql = @"SELECT
                                goodsno.goo_code,
                                goodsno.goo_no,
                                goodsno.Goo_Type,
                                goodsno.Goo_Mate,
                                goodsno.goo_name,
                                oldsaleprice.price,
                                goodsno.Spec,
                                goodsno.Content,
                                goodsno.Goo_unit,
                                IFNULL(getdetail_memo, '正常') as getdetail_memo,
                                oldsaleprice.saledate 
                                FROM goodsno, oldsaleprice
                                WHERE
                                goodsno.goo_code = oldsaleprice.goo_code
                                and oldsaleprice.cus_code = '" + SysVisitor.cus_code + "'";
            if (!string.IsNullOrEmpty(as_where))
            {
                sql += "where goodsno.goo_no like '%" + as_where + "%'";
                sql += "or goodsno.goo_name like '%" + as_where + "%'";
                sql += "or goodsno.Goo_Type like '%" + as_where + "%'";
                sql += "or goodsno.Goo_Mate like '%" + as_where + "%'";
            }
            ldt = SqliteHelper.ExecuteDataTable(sql, pageSize, pageIndex, ref count);
            if (count % 10 == 0)
                pageCount = count / 10;
            else
                pageCount = count / 10 + 1;
            page.Text = pageIndex + "/" + pageCount;

            ReplenishmentAdapter listItemAdapter = new ReplenishmentAdapter(this, ldt);
            list.Adapter = listItemAdapter;
        }