Exemplo n.º 1
0
    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        //TBD AB角信息初始化
        for (int i = 0; i < cbl_ItemlistB.Items.Count; i++)
        {
            if (cbl_ItemlistB.Items[i].Selected)
            {
                Entity.SampleItem item = new Entity.SampleItem();
                item.TypeID      = int.Parse(drop_type_b.SelectedValue.ToString().Trim());
                item.MonitorID   = int.Parse(cbl_ItemlistB.Items[i].Value);
                item.MonitorItem = cbl_ItemlistB.Items[i].Text.Trim();
                userentity.AitemList.Add(item);
            }
        }

        //保存用户AB角
        if (userobj.SaveAB(userentity, "B", drop_type_b.SelectedValue.ToString().Trim()) == 1)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            panel_b.Visible = false;
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }
    //protected void grv_b_RowCreated(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.Header)
    //    {
    //        e.Row.Cells[3].Text = "监测项目";

    //        TableCell headerDetail = new TableCell();
    //        headerDetail.Text = "分析方法选择";
    //        headerDetail.BackColor = System.Drawing.Color.FromArgb(227, 239, 255);
    //        headerDetail.Width = 600;
    //        e.Row.Cells.Add(headerDetail);

    //    }
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        //鼠标移动到每项时颜色交替效果
    //        e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='';");
    //        e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#00ffee'");
    //        //int id = e.Row.RowIndex + 1;

    //        //e.Row.Cells[0].Text = id.ToString();

    //        //手动添加详细和删除按钮
    //        TableCell tabcDetail = new TableCell();

    //        tabcDetail.Style.Add("text-align", "center");
    //        RadioButtonList ibtnDetail = new RadioButtonList();
    //        ibtnDetail.ID = "cbl";
    //        ibtnDetail.SelectedIndex = 0;
    //        tabcDetail.Controls.Add(ibtnDetail);
    //        e.Row.Cells.Add(tabcDetail);
    //    }
    //    if (e.Row.RowType != DataControlRowType.Pager)
    //    {
    //        ////绑定数据后,隐藏4,5,6,7列
    //        e.Row.Cells[1].Visible = false;
    //        e.Row.Cells[2].Visible = false;


    //    }
    //}
    //protected void grv_b_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        if (e.Row.Cells[1].Text.Trim() != "&nbsp;")
    //        {
    //            DataTable Method = itemObj.GetMethod(e.Row.Cells[1].Text.Trim());//dtItem.Select("ClassID='" + e.Row.Cells[1].Text.Trim() + "'");
    //            RadioButtonList cbl_temp = e.Row.Cells[4].FindControl("cbl") as RadioButtonList;
    //            cbl_temp.RepeatDirection = RepeatDirection.Vertical;
    //            cbl_temp.DataSource = Method;
    //            cbl_temp.DataValueField = "id";
    //            cbl_temp.DataTextField = "Standard";
    //            cbl_temp.DataBind();
    //        }
    //    }
    //}


    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        for (int p = 0; p < Repeater_B.Items.Count; p++)
        {
            CheckBoxList cbl_ItemlistB = Repeater_B.Items[p].FindControl("cbl_ItemlistB") as CheckBoxList;
            //TBD AB角信息初始化
            for (int i = 0; i < cbl_ItemlistB.Items.Count; i++)
            {
                if (cbl_ItemlistB.Items[i].Selected)
                {
                    Entity.SampleItem item = new Entity.SampleItem();
                    item.MonitorID   = int.Parse(cbl_ItemlistB.Items[i].Value);
                    item.MonitorItem = cbl_ItemlistB.Items[i].Text.Trim();

                    userentity.AitemList.Add(item);
                }
            }
        }
        //保存用户AB角
        if (userobj.SaveAB(userentity, "B") == 1)
        {
            Repeater_B.Visible = false;
            btn_b_add.Text     = "+分析员B角设定";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }
    protected void btn_save_b_OnClick(object sender, EventArgs e)
    {
        DAl.User.Users    userobj    = new DAl.User.Users();
        Entity.User.Users userentity = new Entity.User.Users();

        userentity.UserID = txt_UserName.Text;
        for (int p = 0; p < Repeater_B.Items.Count; p++)
        {
            GridView grv_b = Repeater_B.Items[p].FindControl("grv_b") as GridView;
            //TBD AB角信息初始化
            for (int i = 0; i < grv_b.Rows.Count; i++)
            {
                CheckBox cb = grv_b.Rows[i].Cells[0].FindControl("autoid") as CheckBox;
                if (cb.Checked)
                {
                    Entity.SampleItem item = new Entity.SampleItem();
                    item.MonitorID   = int.Parse(grv_b.Rows[i].Cells[1].Text.Trim());
                    item.MonitorItem = grv_b.Rows[i].Cells[3].Text.Trim();
                    RadioButtonList cbl = grv_b.Rows[i].Cells[4].FindControl("cbl") as RadioButtonList;
                    for (int j = 0; j < cbl.Items.Count; j++)
                    {
                        if (cbl.Items[j].Selected)
                        {
                            item.Method = cbl.Items[j].Value.Trim();
                        }
                    }
                    userentity.AitemList.Add(item);
                }
            }
        }
        //保存用户AB角
        if (userobj.SaveAB(userentity, "B") == 1)
        {
            Repeater_B.Visible = false;
            btn_b_add.Text     = "+分析员B角设定";
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定成功!');", true);
            ABRoleGroup(userentity.UserID);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('B角设定失败!');", true);
        }
    }