Ejemplo n.º 1
0
        protected void List1_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            //ASPxListBox jhdmList = sender as ASPxListBox;

            string sql = " select distinct b.PLAN_CODE||'--'||b.PLAN_SO AS PLAN_CODE,b.PLAN_SEQ,  b.PLAN_QTY,b.BEGIN_DATE from DATA_PLAN b "
                         + " where b.BEGIN_DATE>=to_date('" + DTPicker1.Date.ToString("yyyy/MM/dd") + "','yyyy-MM-dd') and b.BEGIN_DATE<=to_date('" + DTPicker2.Date.ToString("yyyy/MM/dd") + "','yyyy-MM-dd') ";

            if (txtPCode.Text.Trim() != "")
            {
                sql += " AND b.PLINE_CODE = '" + txtPCode.Value.ToString() + "' ";
            }
            if (txtSO.Text.Trim() != "")
            {
                sql += " AND b.PLAN_SO = UPPER('" + txtSO.Text.Trim() + "') ";
            }
            sql += " ORDER BY PLAN_CODE ";

            DataTable dt = dc.GetTable(sql);

            //jhdmList.DataSource = dt;
            //jhdmList.DataBind();
            List1.DataSource = dt;
            List1.DataBind();

            //DataTable dt1 = new DataTable();
            //dt1.Columns.Add("PLAN_CODE");
            ////items取不到值,为什么
            //if (listJhdm.Items.Count != 0 && listJhdm.Items != null)
            //{
            //    for (int i = 0; i < listJhdm.Items.Count; i++)
            //    {
            //        dt1.Rows.Add(listJhdm.Items[i].ToString());
            //    }
            //}
            //if (List1.SelectedItems.Count != 0 && List1.SelectedItems != null)
            //{
            //    for (int i = 0; i < List1.SelectedItems.Count; i++)
            //    {
            //        dt1.Rows.Add(List1.SelectedItems[i].ToString());
            //    }
            //}
            //listJhdm.DataSource = dt1;
            //listJhdm.DataBind();
            //DataTable dt2 = new DataTable();
            //dt2.Columns.Add("PLAN_CODE");
            //string selectedItems = "";
            //for (int i = 0; i < List1.SelectedItems.Count; i++)
            //{
            //    //contains判断的是字符串是否在字符串中,需先把items拼接起来
            //    selectedItems += List1.SelectedItems[i].ToString();
            //}
            //for (int i = 0; i < List1.Items.Count; i++)
            //{
            //    Boolean flag = selectedItems.Contains(List1.Items[i].ToString());
            //    if (!selectedItems.Contains(List1.Items[i].ToString()))
            //    {
            //        dt2.Rows.Add(List1.Items[i].ToString());
            //    }
            //}
            //List1.DataSource = dt2;
            //List1.DataBind();
            //因为取不到前台的items,所以换方法
            //string[] items = e.Parameter.ToString().Split("@".ToCharArray());
            //if (items.Length == 0 || items == null)
            //{
            //    return;
            //}
            //string items1 = items[0];
            //string[] leftItems = items1.Split("&".ToCharArray());
            //string items2 = items[1];
            //string[] rightItems = items2.Split("&".ToCharArray());
            //string items3 = items[2];
            //string[] rightSelectedItems = items3.Split("&".ToCharArray());
            //DataTable dt1 = new DataTable();
            //dt1.Columns.Add("PLAN_CODE");
            //for (int i = 0; i < leftItems.Length; i++)
            //{
            //    dt1.Rows.Add(leftItems[i]);
            //}
            //for (int i = 0; i < rightSelectedItems.Length; i++)
            //{
            //    dt1.Rows.Add(rightSelectedItems[i]);
            //}
            //listJhdm.DataSource = dt1;
            //listJhdm.DataBind();
            ////动态数组声明方法,必须用new
            //ArrayList rightUnselectedItems = new ArrayList();
            ////怎么取出两个数组中不同的数据,值得研究
            //for (int i = 0; i < rightItems.Length; i++)
            //{
            //    if (!rightSelectedItems.Contains(rightItems[i]))
            //    {
            //        rightUnselectedItems.Add(rightItems[i]);
            //    }
            //}
            //DataTable dt2 = new DataTable();
            //dt2.Columns.Add("PLAN_CODE");
            //if (rightUnselectedItems.Count != 0 || rightUnselectedItems != null)
            //{
            //    for (int i = 0; i < rightUnselectedItems.Count; i++)
            //    {
            //        dt2.Rows.Add(rightUnselectedItems[i]);
            //    }
            //}
            //List1.DataSource = dt2;
            //List1.DataBind();
        }