Exemple #1
0
    public void databind_detail()
    {
        string condition;

        condition = this.DropDownList1.SelectedItem.Text.Trim() == "所有工序" ? " and 1=1 " : " and PBC_Name like '%" + this.DropDownList1.SelectedItem.Text.Trim() + "%'";
        GridView_Parameter.DataSource = ppl.S_ErrorPhenomenonOptionDetail(this.Label1.Text.Trim(), condition);
        GridView_Parameter.DataBind();
        UpdatePanel_Parameter.Update();
    }
Exemple #2
0
    public void databind_detail()
    {
        string condition;

        condition = DropDownList1.SelectedItem.Text.Trim() == "所有工序" ? " and 1=1 " : " and PBC_Name like '%" + DropDownList1.SelectedItem.Text.Trim() + "%'";
        GridView_Parameter.DataSource = OverTimeOption.S_OverTimeOptionDetail(Label1.Text.Trim(), condition);
        GridView_Parameter.DataBind();
        UpdatePanel_Parameter.Update();
    }
    protected void GridView_Parameter_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        { // when click the "GO" Button
            TextBox     txtNewPageIndex = null;
            GridViewRow pagerRow        = GridView_Parameter.BottomPagerRow;


            if (null != pagerRow)
            {
                txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox");   // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex && txtNewPageIndex.Text != "")
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {  // when click the first, last, previous and next Button
            newPageIndex = e.NewPageIndex;
        }

        // check to prevent form the NewPageIndex out of the range


        GridView_Parameter.DataSource = ppl.S_ProType_ProcessRoute(new Guid(Label_PRID.Text));
        GridView_Parameter.DataBind();
        UpdatePanel_Parameter.Update();

        //绑定数据源

        //bindgridview1();
        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= GridView_Parameter.PageCount ? GridView_Parameter.PageCount - 1 : newPageIndex;

        // specify the NewPageIndex
        GridView_Parameter.PageIndex = newPageIndex;

        GridView_Parameter.PageIndex = newPageIndex;
        GridView_Parameter.DataBind();
    }
Exemple #4
0
        private void BindParameterData(int cateid)
        {
            DataTable dt         = pBll.GetList("cateid = " + cateid + " and paratype=" + (int)CategoryParameterType.检索属性).Tables[0];
            DataTable ValueTable = pvBll.GetList(" productid = " + ProductID).Tables[0];

            Hashtable vtable = new Hashtable();

            foreach (DataRow row in ValueTable.Rows)
            {
                vtable.Add(Convert.ToInt32(row["paraid"]), row["paravalue"]);
            }

            GridView_Parameter.DataSource = dt;
            GridView_Parameter.DataBind();

            for (int i = 0; i < GridView_Parameter.Rows.Count; i++)
            {
                RadioButtonList ValueList     = ((RadioButtonList)GridView_Parameter.Rows[i].Cells[1].FindControl("RadioList_ParameterValue"));
                string          SelectedValue = String.Empty;

                if (vtable[Convert.ToInt32(dt.Rows[i]["paraid"])] != null)
                {
                    SelectedValue = vtable[Convert.ToInt32(dt.Rows[i]["paraid"])].ToString();
                }
                string[] Values = dt.Rows[i]["paravalues"].ToString().Split(',');

                for (int j = 0; j < Values.Length; j++)
                {
                    ListItem item = new ListItem();

                    item.Text  = Values[j];
                    item.Value = j.ToString();

                    if (item.Text == SelectedValue)
                    {
                        item.Selected = true;
                    }

                    ValueList.Items.Add(item);
                }
            }
        }
        private void BindParameterData()
        {
            DataTable dt = pBll.GetList("cateid = " + CategoryID + " and paratype=" + (int)CategoryParameterType.检索属性).Tables[0];

            GridView_Parameter.DataSource = dt;
            GridView_Parameter.DataBind();

            for (int i = 0; i < GridView_Parameter.Rows.Count; i++)
            {
                RadioButtonList ValueList = ((RadioButtonList)GridView_Parameter.Rows[i].Cells[1].FindControl("RadioList_ParameterValue"));
                string[]        Values    = dt.Rows[i]["paravalues"].ToString().Split(',');
                for (int j = 0; j < Values.Length; j++)
                {
                    ListItem item = new ListItem();

                    item.Text  = Values[j];
                    item.Value = j.ToString();

                    ValueList.Items.Add(item);
                }
            }
        }
    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();
        }
    }