public void clear() { //无关信息隐藏 Panel_PR.Visible = false; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; GridView_PR.EditIndex = -1; GridView_PR.SelectedIndex = -1; UpdatePanel_PR.Update(); UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); GridView_Doc.SelectedIndex = -1; TextBox_DocType.Text = ""; TextBox_ApplySN.Text = ""; TextBox_ApplyTime1.Text = ""; TextBox_ApplyTime2.Text = ""; TextBox_AppMan.Text = ""; TextBox_ChagenType.Text = ""; TextBox_DocSN.Text = ""; TextBox_PRName.Text = ""; TextBox_State.Text = ""; TextBox_VersionNum.Text = ""; label_GridPageState.Text = "默认数据源"; string condition = " and 1=1"; GridView_Doc.DataSource = cmpr.S_ProcessRoute_Doc(condition); GridView_Doc.DataBind(); UpdatePanel_Doc.Update(); }
protected void GridView_Doc_PageIndexChanging(object sender, GridViewPageEventArgs e) //工艺文件表分页 { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; GridView_Doc.SelectedIndex = -1; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_Doc.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; } } else { newPageIndex = e.NewPageIndex; } newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_Doc.PageCount ? GridView_Doc.PageCount - 1 : newPageIndex; GridView_Doc.PageIndex = newPageIndex; GridView_Doc.PageIndex = newPageIndex; if (label_GridPageState.Text == "默认数据源") { string condition = " and 1=1"; GridView_Doc.DataSource = cmpr.S_ProcessRoute_Doc(condition); GridView_Doc.DataBind(); UpdatePanel_Doc.Update(); } if (label_GridPageState.Text == "检索数据源") { dataBind(); } Panel_PR.Visible = false; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; GridView_PR.EditIndex = -1; GridView_PR.SelectedIndex = -1; UpdatePanel_PR.Update(); UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); GridView_Doc.SelectedIndex = -1; UpdatePanel_Doc.Update(); }
protected void Button_Submit_PR_Click(object sender, EventArgs e) { if (TextBox_AddOrEditPRName.Text == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('工艺路线名称不能为空!')", true); return; } if (label_AddOrEdit.Text == "新增") { DataSet ds = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text)); DataRow[] rows = ds.Tables[0].Select("PR_Name='" + TextBox_AddOrEditPRName.Text + "'"); if (rows.Length > 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已存在该工艺路线名称!请重新填写')", true); return; } cminfo.CDA_ID = new Guid(label_cdaid.Text); cminfo.PR_Special = DropDownList_Special.SelectedItem.Text; cminfo.PR_WritePeople = Session["UserName"].ToString(); cminfo.PR_Name = TextBox_AddOrEditPRName.Text; cmpr.I_ProcessRoute(cminfo); Panel_AddOrEditPR.Visible = false; UpdatePanel_AddOrEditPR.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('新增成功!')", true); GridView_PR.DataSource = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text)); GridView_PR.DataBind(); UpdatePanel_PR.Update(); } if (label_AddOrEdit.Text == "编辑") { DataSet ds = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text)); DataRow[] rows = ds.Tables[0].Select("PR_Name='" + TextBox_AddOrEditPRName.Text + "'"); if (rows.Length > 0 && TextBox_AddOrEditPRName.Text != Label_PRName.Text) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已存在该工艺路线名称!请重新填写')", true); return; } cminfo.PR_ID = new Guid(Label_PRID.Text); cminfo.PR_Special = DropDownList_Special.SelectedItem.Text; cminfo.PR_WritePeople = Session["UserName"].ToString(); cminfo.PR_Name = TextBox_AddOrEditPRName.Text; cmpr.U_ProcessRoute(cminfo); Panel_AddOrEditPR.Visible = false; UpdatePanel_AddOrEditPR.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('编辑成功!')", true); GridView_PR.DataSource = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text)); GridView_PR.DataBind(); UpdatePanel_PR.Update(); } }
protected void GridView_PR_PageIndexChanging(object sender, GridViewPageEventArgs e) //工艺路线表分页 { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; GridView_PR.SelectedIndex = -1; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_PR.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; } } else { newPageIndex = e.NewPageIndex; } newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_PR.PageCount ? GridView_PR.PageCount - 1 : newPageIndex; GridView_PR.PageIndex = newPageIndex; GridView_PR.PageIndex = newPageIndex; GridView_PR.DataSource = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text.Trim())); GridView_PR.DataBind(); Panel_PR.Visible = true; UpdatePanel_PR.Update(); GridView_PR.SelectedIndex = -1; GridView_Craft.SelectedIndex = -1; GridView_CraftMgt.SelectedIndex = -1; //无关信息隐藏 // this.Panel_PR.Visible = false; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; // UpdatePanel_PR.Update(); UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); }
protected void Btn_ClosePR_Click(object sender, EventArgs e)//关闭工艺路线表及其子页面 { //无关信息隐藏 Panel_PR.Visible = false; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; GridView_PR.EditIndex = -1; GridView_PR.SelectedIndex = -1; UpdatePanel_PR.Update(); UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); }
protected void Btn_Search_Click(object sender, EventArgs e)//点击检索,检索工艺文件表 { label_GridPageState.Text = "检索数据源"; //无关信息隐藏 Panel_PR.Visible = false; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; GridView_PR.EditIndex = -1; GridView_PR.SelectedIndex = -1; UpdatePanel_PR.Update(); UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); dataBind(); }
protected void GridView_Doc_RowCommand(object sender, GridViewCommandEventArgs e) //工艺文件链接按钮事件 { if (e.CommandName == "Detail") //查看详情 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_Doc.SelectedIndex = row.RowIndex; Panel_CraftMgt.Visible = false; UpdatePanel_CraftMgt.Update(); string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); Guid cdaid = new Guid(al[0]); label_cdaid.Text = al[0]; Label_CDAstate.Text = al[1]; GridView_PR.DataSource = cmpr.S_ProcessRoute(cdaid); GridView_PR.DataBind(); Panel_PR.Visible = true; UpdatePanel_PR.Update(); GridView_PR.SelectedIndex = -1; Panel_AddOrEditPR.Visible = false; UpdatePanel_AddOrEditPR.Update(); Panel_Craft.Visible = false; UpdatePanel_Craft.Update(); } }
protected void GridView_PR_RowCommand(object sender, GridViewCommandEventArgs e) //工艺路线表中的链接按钮事件 { if (e.CommandName == "CraftMgt000") //工艺路线所属工序管理 { Panel_CraftMgt.Visible = true; GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_PR.SelectedIndex = row.RowIndex; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); string id = al[0]; Label_prnamecheck.Text = al[1]; Guid prid = new Guid(id); Label_PRID.Text = id; GridView_CraftMgt.DataSource = cmpr.S_ProcessRoute_PRDetail(prid); GridView_CraftMgt.DataBind(); GridView_CraftMgt.SelectedIndex = -1; Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = true; Panel_Craft.Visible = false; UpdatePanel_AddOrEditPR.Update(); UpdatePanel_Craft.Update(); DropDownList1.DataSource = ppl.S_PR_Name(); DropDownList1.DataTextField = "PR_Name"; DropDownList1.DataValueField = "PR_ID"; DropDownList1.DataBind(); DataSet ds3 = cmpr.S_ProcessRoute_PRDetail(prid); DataTable dt3 = ds3.Tables[0]; if (dt3.Rows.Count != 0) { Button_copy.Attributes.Add("OnClick", "return confirm('工艺路线中已存在部分工序,是否仍然复制插入?')"); } else { Button_copy.Attributes.Remove("OnClick"); Button_copy.Attributes.Add("OnClick", "return confirm('工艺路线中尚无工序,将会复制所选工艺路线中的工序,确定吗?')"); } UpdatePanel_CraftMgt.Update(); } if (e.CommandName == "Edit_PR")//编辑工艺路线 { //无关信息隐藏 // this.Panel_PR.Visible = false; // this.Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; // GridView_PR.EditIndex = -1; // GridView_PR.SelectedIndex = -1; // UpdatePanel_PR.Update(); // UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_PR.SelectedIndex = row.RowIndex; label_AddOrEdit.Text = "编辑"; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); Label_PRID.Text = al[0]; Guid prid = new Guid(al[0]); Label_PRName.Text = al[1]; TextBox_AddOrEditPRName.Text = al[1]; DropDownList_Special.SelectedValue = al[2]; Panel_AddOrEditPR.Visible = true; UpdatePanel_AddOrEditPR.Update(); } if (e.CommandName == "Delete_PR") //删除工艺路线 { //无关信息隐藏 // this.Panel_PR.Visible = false; // this.Panel_AddOrEditPR.Visible = false; Panel_CraftMgt.Visible = false; Panel_Craft.Visible = false; GridView_CraftMgt.EditIndex = -1; GridView_CraftMgt.SelectedIndex = -1; // GridView_PR.EditIndex = -1; // GridView_PR.SelectedIndex = -1; // UpdatePanel_PR.Update(); // UpdatePanel_AddOrEditPR.Update(); UpdatePanel_CraftMgt.Update(); UpdatePanel_Craft.Update(); GridView_PR.SelectedIndex = -1; GridView_PR.EditIndex = -1; string prid = e.CommandArgument.ToString(); cminfo.PR_ID = new Guid(prid); cmpr.D_ProcessRoute(cminfo); GridView_PR.DataSource = cmpr.S_ProcessRoute(new Guid(label_cdaid.Text.Trim())); GridView_PR.DataBind(); Panel_PR.Visible = true; UpdatePanel_PR.Update(); } }