//GridView1显示编辑 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { Panel_Name.Visible = false; UpdatePanel_Name.Update(); GridView1.EditIndex = e.NewEditIndex; BindGridView1(" and EN_Output is not null and EN_WorkTime is not null and EN_Output!=-1 and EN_WorkTime!=-1"); }
//Gridview编辑设备名称 protected void Grid_EquipName_RowUpdating(object sender, GridViewUpdateEventArgs e) { Guid eN_ID = new Guid(Grid_EquipName.DataKeys[e.RowIndex].Value.ToString()); //名称 if (((TextBox)(Grid_EquipName.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('设备名称不能为空!')", true); return; } string eN_EquipName = Convert.ToString(((TextBox)(Grid_EquipName.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString()); DataSet ds = equipNameModelL.Search_EquipNameInfo("and EN_EquipName = '" + eN_EquipName + " '"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备名称,不能重名!')", true); return; } Grid_EquipName.EditIndex = -1; eMEquipName_EMEquipModelTableInfo.EN_ID = eN_ID; eMEquipName_EMEquipModelTableInfo.EN_EquipName = eN_EquipName; equipNameModelL.Update_EquipNameInfo(eMEquipName_EMEquipModelTableInfo); BindGrid_EquipName(""); Txtname.Text = ""; UpdatePanel_Searchname.Update(); UpdatePanel_Name.Update(); }
//关闭统计数据维护 protected void Senior_DetailCLOSE_Click(object sender, EventArgs e) { Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); }
//重置按钮 protected void BtnReset_Click(object sender, EventArgs e) { Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); textname.Text = ""; UpdatePanel_Grid.Update(); panelGraph.Visible = false; UpdatepanelGraph.Update(); }
//Grid_EquipName相关 protected void Grid_EquipName_RowCommand(object sender, GridViewCommandEventArgs e) { GridView1.EditIndex = -1; GridView1.SelectedIndex = -1; if (e.CommandName == "Choose_Item")//选择 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_EquipName.SelectedIndex = row.RowIndex; Guid EN_ID = new Guid(Convert.ToString(e.CommandArgument)); sd.Update_EquipmentName_Output(EN_ID, 1, 572); BindGridView1(" and EN_Output is not null and EN_WorkTime is not null and EN_Output!=-1 and EN_WorkTime!=-1"); UpdatePanel1.Update(); BindGrid_EquipName(" and (EN_Output is null or EN_Output=-1) and (EN_WorkTime is null or EN_WorkTime=-1)"); UpdatePanel_Name.Update(); } }
//打印报表按钮 protected void BtnPrint_Click(object sender, EventArgs e) { Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); if (this.textyear.Text.ToString() == "" || this.textyear.Text.ToString().Length != 4) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('请填入正确的年份!')", true); return; } Response.Redirect("../REPORT_cc/EquiptrendPrint.aspx?" + "&Year=" + textyear.Text.ToString().Trim() + "&EN_EquipName=" + textname.Text.ToString()); }
//GridView1相关 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_Name.Visible = false; UpdatePanel_Name.Update(); if (e.CommandName == "Delete_Name")//取消统计 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView1.SelectedIndex = row.RowIndex; Grid_EquipName.EditIndex = -1; Guid EN_ID = new Guid(Convert.ToString(e.CommandArgument)); sd.Update_EquipmentName_Output(EN_ID, -1, -1); BindGrid_EquipName(" and (EN_Output is null or EN_Output=-1) and (EN_WorkTime is null or EN_WorkTime=-1)"); UpdatePanel_Name.Update(); BindGridView1(" and EN_Output is not null and EN_WorkTime is not null and EN_Output!=-1 and EN_WorkTime!=-1"); UpdatePanel_Search.Update(); } }
//打印报表按钮 protected void BtnPrint_Click(object sender, EventArgs e) { Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); if (startime.Text.ToString() == "" || endtime.Text.ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('请填入统计起止时间!')", true); return; } Response.Redirect("../REPORT_cc/EquipOutputPrint.aspx?" + "&EI_No=" + textno.Text.ToString() + "&EN_EquipName=" + textname.Text + "&EMT_Type=" + texttype.Text + "&startime=" + startime.Text + "&endtime=" + endtime.Text); }
protected void New_name_Click(object sender, EventArgs e) { Grid_EquipName.EditIndex = -1; Grid_EquipName.SelectedIndex = -1; BindGrid_EquipName(""); UpdatePanel_Name.Update(); Clear(); Panel_NewName.Visible = true; UpdatePanel_NewName.Update(); Panel_Model.Visible = false; Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); Panel1.Visible = false; UpdatePanel1.Update(); }
protected void Clear_name_Click(object sender, EventArgs e) { Grid_EquipName.EditIndex = -1; Txtname.Text = ""; UpdatePanel_Searchname.Update(); BindGrid_EquipName(""); UpdatePanel_Name.Update(); Panel_NewName.Visible = false; UpdatePanel_NewName.Update(); Panel_Model.Visible = false; Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); Panel1.Visible = false; UpdatePanel1.Update(); ; }
protected void Grid_EquipName_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_NewName.Visible = false; UpdatePanel_NewName.Update(); Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); if (e.CommandName == "Look_Model")//点击查看设备型号 { Clear(); GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_EquipName.SelectedIndex = row.RowIndex; //this.Label_enid.Text = Convert.ToString(e.CommandArgument); //string eN_ID = e.CommandArgument.ToString(); string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); string eN_ID = al[0]; Label_enid.Text = eN_ID; string enname = al[1]; Label_enname.Text = enname; Panel_Model.Visible = true; Label_enname0.Text = Label_enname.Text; BindGrid_EquipModel(" and EN_ID='" + eN_ID + "'"); Panel1.Visible = false; UpdatePanel1.Update(); Grid_EquipName.EditIndex = -1; BindGrid_EquipName(""); UpdatePanel_Name.Update(); } if (e.CommandName == "Delete_Name") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_EquipName.SelectedIndex = row.RowIndex; Guid eN_ID = new Guid(Convert.ToString(e.CommandArgument)); Label_enid.Text = Convert.ToString(eN_ID); equipNameModelL.Delete_EquipNameInfo(eN_ID); BindGrid_EquipName(""); UpdatePanel_Name.Update(); } }
//检索设备名称 protected void Search_name_Click(object sender, EventArgs e) { Grid_EquipName.EditIndex = -1; string condition = GetCondition2(); Grid_EquipName.DataSource = equipNameModelL.Search_EquipNameInfo(condition); Grid_EquipName.DataBind(); UpdatePanel_Name.Update(); Panel_NewName.Visible = false; UpdatePanel_NewName.Update(); Panel_Model.Visible = false; Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); Panel1.Visible = false; UpdatePanel1.Update(); }
//检索按钮 protected void BtnSearch_Click(object sender, EventArgs e) { Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); if (startime.Text.ToString() == "" || endtime.Text.ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('请填入统计起止时间!')", true); return; } string condition1 = GetCondition1(); string time = "BETWEEN '" + startime.Text.Trim() + "' AND '" + endtime.Text.Trim() + "'"; BindGrid_Detail(condition1, time); UpdatePanel_Grid.Update(); }
protected void BtnOK_NewName_Click(object sender, EventArgs e) { if (NewName.Text.ToString() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewName, GetType(), "alert", "alert('标记*的为必填项,请填写完整!!')", true); return; } DataSet ds = equipNameModelL.Search_EquipNameInfo("and EN_EquipName = '" + NewName.Text + "'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备名称,不能重名!')", true); return; } string eN_EquipName = NewName.Text.ToString(); eMEquipName_EMEquipModelTableInfo.EN_EquipName = eN_EquipName; equipNameModelL.Insert_EquipNameInfo(eMEquipName_EMEquipModelTableInfo); BindGrid_EquipName(""); Panel_NewName.Visible = false; UpdatePanel_Name.Update(); }
//检索按钮 protected void BtnSearch_Click(object sender, EventArgs e) { Senior_DetailOPEN.Visible = true; Senior_DetailCLOSE.Visible = false; Panel_Grid.Visible = true; UpdatePanel_Grid.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel_Name.Visible = false; UpdatePanel_Name.Update(); panelGraph.Visible = false; UpdatepanelGraph.Update(); if (this.textyear.Text.ToString() == "" || this.textyear.Text.ToString().Length != 4) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('请填入正确的年份!')", true); return; } string condition = GetCondition(); string year = textyear.Text.Trim().ToString(); BindGrid_Detail(condition, year); UpdatePanel_Grid.Update(); }
//选择统计设备按钮 protected void New_name_Click(object sender, EventArgs e) { Panel_Name.Visible = true; BindGrid_EquipName(" and (EN_Output is null or EN_Output=-1) and (EN_WorkTime is null or EN_WorkTime=-1)"); UpdatePanel_Name.Update(); }
//关闭按钮 protected void Button1_Click(object sender, EventArgs e) { Panel_Name.Visible = false; UpdatePanel_Name.Update(); }