Пример #1
0
    protected void Btn_AddPT_Click(object sender, EventArgs e)
    {
        DropDownList_BOM.DataSource     = ppl.S_BOM_Name();
        DropDownList_BOM.DataTextField  = "BOM_Name";
        DropDownList_BOM.DataValueField = "BOM_ID";
        DropDownList_BOM.DataBind();
        DropDownList_BOM.Items.Insert(0, new ListItem("请选择", ""));

        DropDownList_PR.DataSource     = ppl.S_PR_Name();
        DropDownList_PR.DataTextField  = "PR_Name";
        DropDownList_PR.DataValueField = "PR_ID";
        DropDownList_PR.DataBind();
        DropDownList_PR.Items.Insert(0, new ListItem("请选择", ""));

        Label_submitState.Text             = "新增";
        Panel_AddPT.Visible                = true;
        Txt_PT.Text                        = "";
        DropDownList_BOM.SelectedIndex     = 0;
        DropDownList_PR.SelectedIndex      = 0;
        DropDownList_Special.SelectedIndex = 0;

        UpdatePanel_AddPT.Update();
    }
Пример #2
0
    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Check_Parameter")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView2.SelectedIndex = row.RowIndex;

            //无关信息隐藏

            Panel_AddPS.Visible          = false;
            Panel_AddPT.Visible          = false;
            Panel_CheckParameter.Visible = false;


            UpdatePanel_AddPS.Update();
            UpdatePanel_AddPT.Update();
            UpdatePanel_CheckParameter.Update();



            GridView_Parameter.SelectedIndex = -1;

            string[] al   = e.CommandArgument.ToString().Split(new char[] { ',' });
            string   prid = al[0];
            Label_PRID.Text = prid;
            string ptname = al[1];
            string ptid   = al[2];
            Label_PTP.Text          = ptname;
            Label_PT_ID.Text        = ptid;
            Panel_Parameter.Visible = true;
            if (prid == "")
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('该产品尚未制定工艺路线!')", true);
                return;
            }
            Guid guid_id = new Guid(prid);
            GridView_Parameter.DataSource = ppl.S_ProType_ProcessRoute(guid_id);
            GridView_Parameter.DataBind();
            UpdatePanel_Parameter.Update();
        }
        if (e.CommandName == "Delete_PT")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView2.SelectedIndex = row.RowIndex;
            GridView2.SelectedIndex = -1;

            //无关信息隐藏

            Panel_AddPS.Visible          = false;
            Panel_AddPT.Visible          = false;
            Panel_Parameter.Visible      = false;
            Panel_CheckParameter.Visible = false;

            UpdatePanel_Parameter.Update();
            UpdatePanel_AddPS.Update();
            UpdatePanel_AddPT.Update();
            UpdatePanel_CheckParameter.Update();

            string id      = e.CommandArgument.ToString();
            Guid   guid_id = new Guid(id);
            ppl.D_ProType(guid_id);
            string condition;
            string psid    = " PS_ID='" + Label_PS.Text.Trim() + "'";
            string pt_name = Txt_PT_Search.Text.Trim() == "" ? "1=1" : "PT_Name like '%" + Txt_PT_Search.Text.Trim() + "%'";
            condition            = psid + " and " + pt_name;
            GridView2.DataSource = ppl.S_ProSeries_ProType(condition);
            GridView2.DataBind();
            UpdatePanel_PT.Update();
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true);
        }
        if (e.CommandName == "Edit_PT")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView2.SelectedIndex = row.RowIndex;

            //无关信息隐藏

            Panel_AddPS.Visible = false;
            // this.Panel_AddPT.Visible = false;
            Panel_Parameter.Visible      = false;
            Panel_CheckParameter.Visible = false;

            UpdatePanel_Parameter.Update();
            UpdatePanel_AddPS.Update();
            // this.UpdatePanel_AddPT.Update();
            UpdatePanel_CheckParameter.Update();

            DropDownList_BOM.DataSource     = ppl.S_BOM_Name();
            DropDownList_BOM.DataTextField  = "BOM_Name";
            DropDownList_BOM.DataValueField = "BOM_ID";
            DropDownList_BOM.DataBind();
            DropDownList_BOM.Items.Insert(0, new ListItem("请选择", ""));

            DropDownList_PR.DataSource     = ppl.S_PR_Name();
            DropDownList_PR.DataTextField  = "PR_Name";
            DropDownList_PR.DataValueField = "PR_ID";
            DropDownList_PR.DataBind();
            DropDownList_PR.Items.Insert(0, new ListItem("请选择", ""));


            string[] a         = e.CommandArgument.ToString().Split(new char[] { ',' });
            string   ptname    = a[0];
            string   ptspecial = a[1];
            string   prid      = a[2];
            string   bomid     = a[3];
            Label_PT_ID.Text = a[4];

            Txt_PT.Text       = ptname;
            Label_ptname.Text = ptname;
            DropDownList_Special.SelectedValue = ptspecial;

            DropDownList_PR.Items.FindByValue(prid.ToString().Trim()).Selected   = true;
            DropDownList_BOM.Items.FindByValue(bomid.ToString().Trim()).Selected = true;
            Label_submitState.Text = "编辑";
            Panel_AddPT.Visible    = true;

            UpdatePanel_AddPT.Update();
        }
    }