Beispiel #1
0
    public void testSetAllSetting()
    {
        //Model.ChannelProgram mcp, Model.ElementRelation[] mer,Model.StationRelation[] msr
        Model.ChannelProgram mcp = new Model.ChannelProgram();
        mcp.CP_ID      = 170;
        mcp.DataTypeID = 1;
        mcp.TimeTypeID = 8;


        Model.ElementRelation[] mer = new Model.ElementRelation[3];

        Model.ElementRelation mer_single1 = new Model.ElementRelation();
        mer_single1.ElementID    = 1;
        mer_single1.ElementOrder = 0;

        Model.ElementRelation mer_single2 = new Model.ElementRelation();
        mer_single2.ElementID    = 3;
        mer_single2.ElementOrder = 1;

        Model.ElementRelation mer_single3 = new Model.ElementRelation();
        mer_single3.ElementID    = 7;
        mer_single3.ElementOrder = 2;

        mer[0] = mer_single1;
        mer[1] = mer_single2;
        mer[2] = mer_single3;


        Model.StationRelation[] msr = new Model.StationRelation[3];

        Model.StationRelation msr_single1 = new Model.StationRelation();
        msr_single1.SelectID     = 172;
        msr_single1.StationID    = 50774;
        msr_single1.StationOrder = 0;

        Model.StationRelation msr_single2 = new Model.StationRelation();
        msr_single2.SelectID     = 30;
        msr_single2.StationID    = 56778;
        msr_single2.StationOrder = 1;

        Model.StationRelation msr_single3 = new Model.StationRelation();
        msr_single3.SelectID     = 512;
        msr_single3.StationID    = 59432;
        msr_single3.StationOrder = 2;

        msr[0] = msr_single1;
        msr[1] = msr_single2;
        msr[2] = msr_single3;



        BLL.SettingBLL sbll    = new BLL.SettingBLL();
        String[]       display = new String[5];
        display     = sbll.setAllSetting(mcp, mer, msr);
        Label1.Text = display[0] + "/" + display[1] + "/" + display[2] + "/" + display[3] + "/" + display[4];
    }
Beispiel #2
0
    protected void bSet_Click(object sender, EventArgs e)
    {
        int elementCount = lboxDisplaySelected.Items.Count;
        int stationCount = lboxStationReal.Items.Count;

        if (trProgram.SelectedNode.Parent != null && elementCount != 0 && stationCount != 0 && ddlTimeType.SelectedValue != "选择数据时段" && ddlDataType.SelectedValue != "选择数据类型")
        {
            string[]             cpInfo = trProgram.SelectedNode.Value.Split('#');
            Model.ChannelProgram mcp    = new Model.ChannelProgram();
            mcp.CP_ID      = Convert.ToInt32(cpInfo[0]);
            mcp.DataTypeID = Convert.ToInt32(ddlDataType.SelectedValue);
            mcp.TimeTypeID = Convert.ToInt32(ddlTimeType.SelectedValue);
            trProgram.SelectedNode.Value = cpInfo[0] + "#" + ddlTimeType.SelectedValue + "#" + ddlDataType.SelectedValue;
            Model.ElementRelation[] mer = new Model.ElementRelation[elementCount];
            Model.StationRelation[] msr = new Model.StationRelation[stationCount];
            for (int i = 0; i < elementCount; i++)
            {
                Model.ElementRelation merSingle = new Model.ElementRelation();
                merSingle.ElementID    = Convert.ToInt32(lboxDisplaySelected.Items[i].Value);
                merSingle.ElementOrder = i;
                mer[i] = merSingle;
            }
            for (int i = 0; i < stationCount; i++)
            {
                Model.StationRelation msrSingle = new Model.StationRelation();
                string[] stationInfo            = lboxStationReal.Items[i].Value.Split('#');
                msrSingle.StationID    = Convert.ToInt32(stationInfo[0]);
                msrSingle.SelectID     = Convert.ToInt32(stationInfo[1]);
                msrSingle.StationOrder = i;
                msr[i] = msrSingle;
            }
            string[] setStationResult = sdbll.setAllSetting(mcp, mer, msr);
            int      resultCount      = setStationResult.Length;
            int      doneCount        = 0;
            for (int i = 0; i < resultCount; i++)
            {
                if (setStationResult[i] == "done")
                {
                    doneCount++;
                }
            }
            if (doneCount == resultCount)
            {
                Response.Write("<script>alert('设置栏目成功!');</script>");
            }
            else
            {
                Response.Write("<script>alert('设置栏目失败!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('请检查信息是否填充完整!');</script>");
        }
    }