Exemplo n.º 1
0
    protected void BindList()
    {
        string strMonitorID = new TBaseItemInfoLogic().Details(this.Request["selBagID"].ToString()).MONITOR_ID;

        TBaseItemInfoVo objItem = new TBaseItemInfoVo();

        objItem.IS_DEL       = "0";
        objItem.IS_SUB       = "1";
        objItem.HAS_SUB_ITEM = "0";
        objItem.MONITOR_ID   = strMonitorID;
        List <TBaseItemInfoVo> lstItem = new TBaseItemInfoLogic().SelectByObject(objItem, 0, 0);

        lstItem.Sort(delegate(TBaseItemInfoVo a, TBaseItemInfoVo b) { return(a.ORDER_NUM.CompareTo(b.ORDER_NUM)); });

        this.ListBox1.DataSource     = lstItem;
        this.ListBox1.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox1.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox1.DataBind();

        TBaseItemSubItemVo objSubItem = new TBaseItemSubItemVo();

        objSubItem.IS_DEL         = "0";
        objSubItem.PARENT_ITEM_ID = this.Request["selBagID"].ToString();
        List <TBaseItemSubItemVo> lstSubItem = new TBaseItemSubItemLogic().SelectByObject(objSubItem, 0, 0);

        string strSubItemIDs = "";

        for (int i = 0; i < lstSubItem.Count; i++)
        {
            strSubItemIDs += "," + lstSubItem[i].ITEM_ID;
        }
        strSubItemIDs = strSubItemIDs + ",";

        for (int i = lstItem.Count - 1; i >= 0; i--)
        {
            if (!strSubItemIDs.Contains(lstItem[i].ID))
            {
                lstItem.RemoveAt(i);
            }
        }

        this.ListBox2.DataSource     = lstItem;
        this.ListBox2.DataValueField = TBaseItemInfoVo.ID_FIELD;
        this.ListBox2.DataTextField  = TBaseItemInfoVo.ITEM_NAME_FIELD;
        this.ListBox2.DataBind();

        for (int i = 0; i < ListBox2.Items.Count; i++)
        {
            ListItem item = ListBox2.Items[i];
            ListBox1.Items.Remove(item);
        }
    }
Exemplo n.º 2
0
    public static string SaveDataItem(string strBagID, string strSelItem_IDs)
    {
        bool isSuccess = true;

        string[] arrSelItemId = strSelItem_IDs.Split(',');

        TBaseItemSubItemVo objSubItemSet = new TBaseItemSubItemVo();

        objSubItemSet.IS_DEL = "1";
        TBaseItemSubItemVo objSubItemWhere = new TBaseItemSubItemVo();

        objSubItemWhere.IS_DEL         = "0";
        objSubItemWhere.PARENT_ITEM_ID = strBagID;
        if (new TBaseItemSubItemLogic().Edit(objSubItemSet, objSubItemWhere))
        {
            new PageBase().WriteLog("删除项目包中监测项目", "", new PageBase().LogInfo.UserInfo.USER_NAME + "删除项目包父项目" + strBagID + "成功");
        }

        for (int i = 0; i < arrSelItemId.Length; i++)
        {
            TBaseItemSubItemVo objSubItem = new TBaseItemSubItemVo();
            objSubItem.ID             = GetSerialNumber("t_base_item_sub_item_id");
            objSubItem.IS_DEL         = "0";
            objSubItem.ITEM_ID        = arrSelItemId[i];
            objSubItem.PARENT_ITEM_ID = strBagID;

            isSuccess = new TBaseItemSubItemLogic().Create(objSubItem);
        }

        if (isSuccess)
        {
            new PageBase().WriteLog("新增项目包监测项目", "", new PageBase().LogInfo.UserInfo.USER_NAME + "新增项目包监测项目" + arrSelItemId[0].ToString() + "成功");
            return("1");
        }
        else
        {
            return("0");
        }
    }