protected void BtnOK_NewInfo_Click(object sender, EventArgs e) { if (AddTextno.Text.ToString() == "" || DropDownList3.SelectedValue.ToString() == "" || AddTextLocation.Text.ToString() == "" || AddTextProvidor.Text.ToString() == "" || AddAcceptDate.Text.ToString() == "" || DropDownList4.SelectedValue.ToString() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewInfo, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } DataSet ds = equipmentInfL.Search_EquipmentInfInfo("and EI_No = '" + AddTextno.Text + "' and d.EMT_ID='" + Label_mid.Text + "'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备台账,不能重名!')", true); return; } Guid eTT_ID = new Guid(DropDownList3.SelectedValue.ToString()); Guid eMT_ID = new Guid(Label_mid.Text.ToString()); string eI_No = AddTextno.Text.ToString(); string eI_Location = AddTextLocation.Text.ToString(); string eI_Providor = AddTextProvidor.Text.ToString(); string eI_IsToCare = DropDownList4.SelectedValue.ToString(); DateTime eI_AcceptDate = Convert.ToDateTime((AddAcceptDate.Text.ToString())); equipmentInfL.Insert_EquipmentInfInfo(eTT_ID, eMT_ID, eI_No, eI_Location, eI_Providor, eI_IsToCare, eI_AcceptDate); BindGrid_EquipInfo(""); Panel_NewInfo.Visible = false; Panel_searchname.Visible = false; UpdatePanel_InfoItem.Update(); Panel_Supply.Visible = false; UpdatePanel_Supply.Update(); }
protected void BtnOK_EditInfo_Click(object sender, EventArgs e) { if (EditTextno.Text.ToString() == "" || DropDownList5.SelectedValue.ToString() == "" || EditTextLocation.Text.ToString() == "" || EditTextProvidor.Text.ToString() == "" || EditAcceptDate.Text.ToString() == "" || DropDownList6.SelectedValue.ToString() == "" || DropDownList8.SelectedValue.ToString() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel_EditInfo, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } DataSet ds = equipmentInfL.Search_EquipmentInfInfo("and EI_No = '" + EditTextno.Text + "' and c.EMT_Type='" + EditTextmodel.Text + "'and a.ETT_ID= '" + DropDownList5.SelectedValue.ToString() + "' and EI_Location= '" + EditTextLocation.Text + "'and EI_Providor= '" + EditTextProvidor.Text + "'and EI_IsToCare= '" + DropDownList6.SelectedValue.ToString() + "'and EI_AcceptDate= '" + EditAcceptDate.Text + "'and EI_State='" + DropDownList8.SelectedValue.ToString() + "'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备台账,不能重名!')", true); return; } Guid ETT_ID = new Guid(DropDownList5.SelectedValue.ToString()); Guid EI_ID = new Guid(Label_eiid.Text.ToString()); string EI_No = EditTextno.Text.ToString(); string EI_Location = EditTextLocation.Text.ToString(); string EI_Providor = EditTextProvidor.Text.ToString(); string EI_IsToCare = DropDownList6.SelectedValue.ToString(); DateTime EI_AcceptDate = Convert.ToDateTime((EditAcceptDate.Text.ToString())); string EI_State = DropDownList8.SelectedValue.ToString(); equipmentInfL.Update_EquipmentInfInfo(ETT_ID, EI_ID, EI_No, EI_Location, EI_Providor, EI_IsToCare, EI_AcceptDate, EI_State); BindGrid_EquipInfo(""); Panel_EditInfo.Visible = false; UpdatePanel_EditInfo.Update(); UpdatePanel_InfoItem.Update(); Panel_Supply.Visible = false; UpdatePanel_Supply.Update(); }
//检索设备台账 protected void Btn_Search_Click(object sender, EventArgs e) { string condition = GetCondition(); BindGrid_EquipInfo(condition); Panel_InfoItem.Visible = true; UpdatePanel_InfoItem.Update(); UpdatePanel_Search.Update(); Panel_EditInfo.Visible = false; UpdatePanel_EditInfo.Update(); Panel_searchname.Visible = false; Panel_NewInfo.Visible = false; UpdatePanel_NewInfo.Update(); }
protected void Btn_Clear_Click(object sender, EventArgs e) { DropDownList1.Items.Insert(0, new ListItem("请选择", "")); BindDropDownList1(); Textname.Text = ""; Textmodel.Text = ""; Textno.Text = ""; TextLocation.Text = ""; TextProvidor.Text = ""; DropDownList2.SelectedIndex = 0; TextAcceptDate.Text = ""; DropDownList7.SelectedIndex = 0; UpdatePanel_Search.Update(); BindGrid_EquipInfo(""); UpdatePanel_InfoItem.Update(); Panel_EditInfo.Visible = false; UpdatePanel_EditInfo.Update(); Panel_searchname.Visible = false; Panel_NewInfo.Visible = false; UpdatePanel_NewInfo.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.Items.Insert(0, new ListItem("请选择", "请选择")); BindDropDownList1(); DropDownList3.Items.Insert(0, new ListItem("请选择", "请选择")); BindDropDownList3(); Panel_Search.Visible = true; UpdatePanel_Search.Update(); Panel_InfoItem.Visible = true; UpdatePanel_InfoItem.Update(); string condition = ""; BindGrid_EquipInfo(condition); try { if (Request.QueryString["status"].ToString() != "") { Lab_Status.Text = Request.QueryString["status"].ToString(); } if (Lab_Status.Text == "EMInf" && Session["UserRole"].ToString().Contains("设备台账管理")) { Title = "设备台账管理"; } if (Lab_Status.Text == "EMLookInf" && Session["UserRole"].ToString().Contains("设备台账查看")) { Title = "设备台账查看"; Btn_New.Visible = false; Grid_EquipInfo.Columns[14].Visible = false; //编辑 Grid_EquipInfo.Columns[15].Visible = false; //删除 } } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true); Response.Redirect("~/Default.aspx"); } } }
protected void Grid_EquipInfo_RowCommand(object sender, GridViewCommandEventArgs e) { Panel_searchname.Visible = false; Panel_NewInfo.Visible = false; UpdatePanel_NewInfo.Update(); if (e.CommandName == "Edit_Info")//点击编辑设备台账 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_EquipInfo.SelectedIndex = row.RowIndex; //this.Label_eiid.Text = Convert.ToString(e.CommandArgument); // Clear(); string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); //string ETT_ID = al[0]; //this.DropDownList5.Value = EN_ID; //string EN_ID = al[1]; //this.Label_mid.Text = EMT_ID; //string EMT_ID = al[2]; //this.Label_nname.Text = EN_EquipName; string EI_ID = al[0]; Label_eiid.Text = EI_ID; string ETT_Type = al[1]; BindDropDownList5(); DropDownList5.Items.FindByText(ETT_Type.ToString().Trim()).Selected = true; string EN_EquipName = al[2]; EditTextname.Text = EN_EquipName; string EMT_Type = al[3]; EditTextmodel.Text = EMT_Type; string EI_No = al[4]; EditTextno.Text = EI_No; string EI_Location = al[5]; EditTextLocation.Text = EI_Location; string EI_Providor = al[6]; EditTextProvidor.Text = EI_Providor; string EI_IsToCare = al[7]; if (EI_IsToCare == "是" || EI_IsToCare == "否") { DropDownList6.SelectedValue = EI_IsToCare; } else { DropDownList6.SelectedIndex = 0; } if (al[8] == "") { EditAcceptDate.Text = ""; } else { DateTime EI_AcceptDate = Convert.ToDateTime(al[8].ToString()); EditAcceptDate.Text = EI_AcceptDate.ToString("yyyy-MM-dd"); } string EI_State = al[9]; //this.DropDownList8.Items.FindByText(EI_State.ToString().Trim()).Selected = true; DropDownList8.SelectedValue = EI_State; // BindDropDownList5(); Panel_EditInfo.Visible = true; //AddAcceptDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); UpdatePanel_EditInfo.Update(); } if (e.CommandName == "Delete_Info") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_EquipInfo.SelectedIndex = row.RowIndex; Guid eI_ID = new Guid(Convert.ToString(e.CommandArgument)); //this.Label_enid.Text = Convert.ToString(eI_ID); equipmentInfL.Delete_Proc_D_EquipmentInfInfo(eI_ID); BindGrid_EquipInfo(""); UpdatePanel_InfoItem.Update(); } }