//新建物料类别,打开对应panel
 protected void NewMatType(object sender, EventArgs e)
 {
     try
     {
         Panel_MatTypeNew.Visible       = true;
         UpdatePanel_MatTypeNew.Visible = true;
         UpdatePanel_MatTypeNew.Update();
     }
     catch (Exception)
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('you make some mistakes ');</script>");
     }
 }
    //Gridview编辑物料类型
    protected void Gridview_MatType_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Guid   mattypeid   = new Guid(Gridview_MatType.DataKeys[e.RowIndex].Value.ToString());
        string mattypename = Convert.ToString(((TextBox)(Gridview_MatType.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString());
        string comment     = Convert.ToString(((TextBox)(Gridview_MatType.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString());

        //BindGridView_MatType();
        mat.Update_MaterialType(mattypeid, mattypename, comment);
        Gridview_MatType.EditIndex = -1;
        BindGridView_MatType();
        UpdatePanel_MatType.Update();
        Panel_MatTypeNew.Visible = false;
        UpdatePanel_MatTypeNew.Update();
    }
 //新建物料烈性-关闭
 protected void CanelMatTye(object sender, EventArgs e)
 {
     try
     {
         Panel_MatTypeNew.Visible = false;
         TextBox_NewTypeName.Text = "";
         TextArea1.InnerText      = "";
         UpdatePanel_MatTypeNew.Update();
         Panel_MatBasicDataNew.Visible = false;
         UpdatePanel_MatBasicDataNew.Update();
     }
     catch (Exception)
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('you make some mistakes ');</script>");
     }
 }
    //新建物料类型-确认
    protected void ConfirmMatTypeNew(object sender, EventArgs e)
    {
        //try
        //{
        string mattypename = TextBox_NewTypeName.Text.ToString();
        string comment     = TextArea1.InnerText.ToString();

        if (TextBox_NewTypeName.Text.ToString() == "")
        {
            ScriptManager.RegisterClientScriptBlock(UpdatePanel_MatTypeNew, GetType(), "alert", "alert('必须填写物料名称')", true);
            return;
        }
        int temp = mat.Select_IMMaterialTypeRepeat(mattypename);

        if (temp != 0)
        {
            ScriptManager.RegisterClientScriptBlock(UpdatePanel_MatTypeNew, GetType(), "alert", "alert('物料类型名称重复,不可以添加!')", true);
            return;
        }
        mat.Insert_MaterialType(mattypename, comment);
        BindGridView_MatType();
        UpdatePanel_MatType.Update();
        TextBox_NewTypeName.Text = "";
        TextArea1.InnerText      = "";
        Panel_MatTypeNew.Visible = false;
        UpdatePanel_MatTypeNew.Update();
        BindDropDownList1();
        BindDropDownList2();
        UpdatePanel_Search.Update();
        UpdatePanel_MatBasicDataNew.Update();
        ScriptManager.RegisterClientScriptBlock(UpdatePanel_MatTypeNew, GetType(), "alert", "alert('提交成功!')", true);
        //}
        //catch (Exception)
        //{
        //    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('you make some mistakes ');</script>");
        //}
    }