Ejemplo n.º 1
0
    //Gridview编辑设备类型
    protected void Grid_EquipType_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Guid eTT_ID = new Guid(Grid_EquipType.DataKeys[e.RowIndex].Value.ToString());

        //类型不为空
        if (((TextBox)(Grid_EquipType.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString() == "")
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('设备类型不能为空!')", true);
            return;
        }
        string    eTT_Type = Convert.ToString(((TextBox)(Grid_EquipType.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString());
        DataSet   ds       = equipTypeL.Search_EquipTypeTableInfo("and ETT_Type = '" + eTT_Type + " '");
        DataTable dt       = ds.Tables[0];

        if (dt.Rows.Count != 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备类型名称,不能重名!')", true);
            return;
        }
        Grid_EquipType.EditIndex      = -1;
        eMEquipTypeTableInfo.ETT_ID   = eTT_ID;
        eMEquipTypeTableInfo.ETT_Type = eTT_Type;
        equipTypeL.Update_EquipTypeTableInfo(eMEquipTypeTableInfo);
        BindGrid_EquipType("");
        Txtname.Text = "";
        UpdatePanel_Search.Update();
        UpdatePanel_TypeItem.Update();
    }
Ejemplo n.º 2
0
 protected void Btn_Clear_Click(object sender, EventArgs e)
 {
     Grid_EquipType.EditIndex = -1;
     Txtname.Text             = "";
     UpdatePanel_Search.Update();
     BindGrid_EquipType("");
     UpdatePanel_TypeItem.Update();
     Panel_NewType.Visible = false;
     UpdatePanel_NewType.Update();
 }
Ejemplo n.º 3
0
 protected void Btn_New_Click(object sender, EventArgs e)
 {
     Grid_EquipType.EditIndex     = -1;
     Grid_EquipType.SelectedIndex = -1;
     BindGrid_EquipType("");
     UpdatePanel_TypeItem.Update();
     Clear();
     Panel_NewType.Visible       = true;
     UpdatePanel_NewType.Visible = true;
     UpdatePanel_NewType.Update();
 }
Ejemplo n.º 4
0
    protected void Btn_Search_Click(object sender, EventArgs e)
    {
        Grid_EquipType.EditIndex = -1;
        string condition = GetCondition();

        Grid_EquipType.DataSource = equipTypeL.Search_EquipTypeTableInfo(condition);
        Grid_EquipType.DataBind();
        UpdatePanel_TypeItem.Update();
        Panel_NewType.Visible = false;
        UpdatePanel_NewType.Update();
    }
Ejemplo n.º 5
0
    //Gridview删除设备类型
    protected void Grid_EquipType_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Panel_NewType.Visible = false;
        UpdatePanel_NewType.Update();

        if (e.CommandName == "Delete_Type")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Grid_EquipType.SelectedIndex = row.RowIndex;

            Guid ETT_ID = new Guid(Convert.ToString(e.CommandArgument));
            equipTypeL.Delete_EquipTypeTableInfo(ETT_ID);
            BindGrid_EquipType("");
            UpdatePanel_TypeItem.Update();
        }
    }
Ejemplo n.º 6
0
    //新增确认
    protected void BtnOK_NewType_Click(object sender, EventArgs e)
    {
        if (TxtAddType.Text.ToString() == "")
        {
            ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewType, GetType(), "alert", "alert('标记*的为必填项,请填写完整!!')", true);
            return;
        }
        DataSet   ds = equipTypeL.Search_EquipTypeTableInfo("and ETT_Type = '" + TxtAddType.Text.ToString() + "'");
        DataTable dt = ds.Tables[0];

        if (dt.Rows.Count != 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备类型名称,不能重名!')", true);
            return;
        }
        string eTT_Type = TxtAddType.Text.ToString();

        eMEquipTypeTableInfo.ETT_Type = eTT_Type;
        equipTypeL.Insert_EquipTypeTableInfo(eMEquipTypeTableInfo);
        BindGrid_EquipType("");
        Panel_NewType.Visible = false;
        UpdatePanel_TypeItem.Update();
    }