Пример #1
0
 protected void Button_CloseBasic_Click(object sender, EventArgs e)
 {
     TextBox_PBC.Text    = "";
     Panel_Basic.Visible = false;
     UpdatePanel_Basic.Update();
     Panel1.Visible = false;
     UpdatePanel1.Update();
 }
Пример #2
0
    public void databind4()
    {
        string condition;
        string PBC_Name = TextBox_PBC.Text.Trim() == "" ? " and 1=1 " : " and PBC_Name like '%" + TextBox_PBC.Text.Trim() + "%' ";

        condition = PBC_Name;
        GridView_Basic.DataSource = csl.S_CSeries(label_CSN_ID3.Text.Trim(), condition);
        GridView_Basic.DataBind();
        UpdatePanel_Basic.Update();
    }
Пример #3
0
    protected void GridView_PT_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        GridView_PT.SelectedIndex = -1;
        if (-1 == e.NewPageIndex)
        {
            TextBox txtNewPageIndex = null;

            GridViewRow pagerRow = GridView_PT.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_PT.PageCount ? GridView_PT.PageCount - 1 : newPageIndex;
        GridView_PT.PageIndex = newPageIndex;
        GridView_PT.PageIndex = newPageIndex;

        databind2();
        GridView_PT.SelectedIndex = -1;
        GridView_PT.EditIndex     = -1;
        //各种pannel隐藏
        //  TextBox_PT.Text = "";
        TextBox_Series.Text      = "";
        TextBox_ProductName.Text = "";
        Panel_Add.Visible        = false;
        UpdatePanel_Add.Update();
        Panel_PT.Visible = true;
        UpdatePanel_PT.Update();
        Panel_Product.Visible = false;
        UpdatePanel_Product.Update();
        Panel_Basic.Visible = false;
        TextBox_PBC.Text    = "";
        UpdatePanel_Basic.Update();
    }
Пример #4
0
 protected void Btn_Search_Click(object sender, EventArgs e)
 {
     GridView_CS.EditIndex = -1;
     databind1();
     Panel_Add.Visible = false;
     UpdatePanel_Add.Update();
     Panel_PT.Visible = false;
     UpdatePanel_PT.Update();
     Panel_Product.Visible = false;
     UpdatePanel_Product.Update();
     Panel_Basic.Visible = false;
     UpdatePanel_Basic.Update();
     Panel1.Visible = false;
     UpdatePanel1.Update();
 }
Пример #5
0
 protected void Button_Cancel_Click(object sender, EventArgs e)
 {
     GridView_CS.EditIndex  = -1;
     TextBox_CS_Search.Text = "";
     databind1();
     Panel_Add.Visible = false;
     UpdatePanel_Add.Update();
     Panel_PT.Visible = false;
     UpdatePanel_PT.Update();
     Panel_Product.Visible = false;
     UpdatePanel_Product.Update();
     Panel_Basic.Visible = false;
     UpdatePanel_Basic.Update();
     Panel1.Visible = false;
     UpdatePanel1.Update();
 }
Пример #6
0
 protected void GridView_CS_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     if (((TextBox)(GridView_CS.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim() != label_CSN_Name.Text.Trim())
     {
         string    condition = " and CSN_Name='" + ((TextBox)(GridView_CS.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim() + "'";
         DataSet   ds        = csl.S_CSName(condition);
         DataTable dt        = ds.Tables[0];
         if (dt.Rows.Count != 0)
         {
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该产能核定系列名称,请您再次核对!')", true);
             //  GridView_CS.SelectedIndex = -1;
             // GridView_CS.EditIndex = -1;
             // return;
         }
         else
         {
             try
             {
                 csl.U_CSName(new Guid(GridView_CS.DataKeys[e.RowIndex].Values["CSN_ID"].ToString().Trim()), ((TextBox)(GridView_CS.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim());
             }
             catch (Exception)
             {
                 ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('应输入日期格式!')", true);
                 return;
             }
         }
     }
     GridView_CS.SelectedIndex = -1;
     GridView_CS.EditIndex     = -1;
     //panel 各种隐藏
     TextBox_PT.Text          = "";
     TextBox_Series.Text      = "";
     TextBox_ProductName.Text = "";
     Panel_Add.Visible        = false;
     UpdatePanel_Add.Update();
     Panel_PT.Visible = false;
     UpdatePanel_PT.Update();
     databind1();
     Panel_Product.Visible = false;
     UpdatePanel_Product.Update();
     Panel_Basic.Visible = false;
     TextBox_PBC.Text    = "";
     UpdatePanel_Basic.Update();
 }
Пример #7
0
 protected void GridView_CS_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     GridView_CS.SelectedIndex = -1;
     GridView_CS.EditIndex     = -1;
     databind1();
     //panel 各种隐藏
     TextBox_PT.Text          = "";
     TextBox_Series.Text      = "";
     TextBox_ProductName.Text = "";
     Panel_Add.Visible        = false;
     UpdatePanel_Add.Update();
     Panel_PT.Visible = false;
     UpdatePanel_PT.Update();
     Panel_Product.Visible = false;
     UpdatePanel_Product.Update();
     Panel_Basic.Visible = false;
     TextBox_PBC.Text    = "";
     UpdatePanel_Basic.Update();
 }
Пример #8
0
 protected void GridView_CS_RowEditing(object sender, GridViewEditEventArgs e)
 {
     GridView_CS.EditIndex = e.NewEditIndex;
     databind1();
     label_CSN_Name.Text = GridView_CS.DataKeys[e.NewEditIndex].Values["CSN_Name"].ToString();
     //panel 各种隐藏
     TextBox_PT.Text          = "";
     TextBox_Series.Text      = "";
     TextBox_ProductName.Text = "";
     Panel_Add.Visible        = false;
     UpdatePanel_Add.Update();
     Panel_PT.Visible = false;
     UpdatePanel_PT.Update();
     Panel_Product.Visible = false;
     UpdatePanel_Product.Update();
     Panel_Basic.Visible = false;
     TextBox_PBC.Text    = "";
     UpdatePanel_Basic.Update();
     Panel1.Visible = false;
     UpdatePanel1.Update();
 }
Пример #9
0
    protected void GridView_PT_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeletePT")//
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            // GridView_WOmain.SelectedIndex = row.RowIndex;

            string id = e.CommandArgument.ToString().Trim();
            try
            {
                Guid guid = new Guid(id);
                csl.D_CSName_ProType(guid);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true);
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除失败!,请您再核对!')", true);

                return;
            }

            //panel 各种隐藏
            TextBox_PT.Text          = "";
            TextBox_Series.Text      = "";
            TextBox_ProductName.Text = "";
            Panel_Add.Visible        = false;
            UpdatePanel_Add.Update();
            Panel_PT.Visible = true;
            UpdatePanel_PT.Update();
            databind2();
            Panel_Product.Visible = false;
            UpdatePanel_Product.Update();
            Panel_Basic.Visible = false;
            TextBox_PBC.Text    = "";
            UpdatePanel_Basic.Update();
        }
    }
Пример #10
0
    protected void GridView_Basic_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete_Basic")//
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            // GridView_WOmain.SelectedIndex = row.RowIndex;

            string id = e.CommandArgument.ToString().Trim();
            try
            {
                Guid guid = new Guid(id);
                csl.D_CSeries(guid);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true);
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除失败!,请您再核对!')", true);

                return;
            }

            //panel 各种隐藏
            TextBox_PT.Text          = "";
            TextBox_Series.Text      = "";
            TextBox_ProductName.Text = "";
            Panel_Basic.Visible      = true;
            Panel_Add.Visible        = false;
            UpdatePanel_Add.Update();
            Panel_PT.Visible = false;
            UpdatePanel_PT.Update();
            databind4();
            Panel_Product.Visible = false;
            UpdatePanel_Product.Update();

            //   TextBox_PBC.Text = "";
            UpdatePanel_Basic.Update();
            Panel1.Visible = false;
            UpdatePanel1.Update();
        }

        if (e.CommandName == "Edit_Basic")//
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView_Basic.SelectedIndex = row.RowIndex;

            DropDownList_PBC.DataSource     = erl.S_WOError_Rework_PBCraft();
            DropDownList_PBC.DataTextField  = "PBC_Name";
            DropDownList_PBC.DataValueField = "PBC_ID";
            DropDownList_PBC.DataBind();
            string[] al = e.CommandArgument.ToString().Split(new char[] { '?' });
            DropDownList_PBC.SelectedItem.Text = al[1];
            DropDownList_PBC.Enabled           = false;
            Label_ID.Text       = al[0];
            TextBox1.Text       = al[2];
            TextBox2.Text       = al[3];
            TxtFormulaEdit.Text = al[4];
            LabelAddOrEdit.Text = "编辑";
            Panel1.Visible      = true;
            UpdatePanel1.Update();
        }
    }
Пример #11
0
    protected void GridView_CS_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete123")//
        {
            GridView_CS.EditIndex = -1;
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            // GridView_WOmain.SelectedIndex = row.RowIndex;

            string id = e.CommandArgument.ToString().Trim();
            try
            {
                Guid guid = new Guid(id);
                csl.D_CSName(guid);
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true);
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除失败!,请您再核对!')", true);

                return;
            }

            //panel 各种隐藏
            TextBox_PT.Text          = "";
            TextBox_Series.Text      = "";
            TextBox_ProductName.Text = "";
            Panel_Basic.Visible      = false;
            TextBox_PBC.Text         = "";
            UpdatePanel_Basic.Update();
            Panel_Add.Visible = false;
            UpdatePanel_Add.Update();
            Panel_PT.Visible = false;
            UpdatePanel_PT.Update();
            databind1();
            Panel_Product.Visible = false;
            UpdatePanel_Product.Update();
            Panel1.Visible = false;
            UpdatePanel1.Update();
        }

        if (e.CommandName == "CapacityPT")//
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView_CS.SelectedIndex = row.RowIndex;

            string[] al = e.CommandArgument.ToString().Split(new char[] { ',' });
            label_CSN_ID.Text    = al[0].Trim();
            label_CSN_Name2.Text = al[1].Trim();
            databind2();
            GridView_PT.SelectedIndex = -1;
            GridView_PT.EditIndex     = -1;
            //panel 各种隐藏
            Panel_Basic.Visible = false;
            TextBox_PBC.Text    = "";
            UpdatePanel_Basic.Update();
            TextBox_PT.Text          = "";
            TextBox_Series.Text      = "";
            TextBox_ProductName.Text = "";
            Panel_Add.Visible        = false;
            UpdatePanel_Add.Update();
            Panel_PT.Visible = true;
            UpdatePanel_PT.Update();
            Panel_Product.Visible = false;
            UpdatePanel_Product.Update();
            GridView_CS.EditIndex = -1;
            databind1();
            UpdatePanel_CS.Update();
            Panel1.Visible = false;
            UpdatePanel1.Update();
        }


        if (e.CommandName == "CapacityUnit")//
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView_CS.SelectedIndex = row.RowIndex;

            string[] al = e.CommandArgument.ToString().Split(new char[] { ',' });
            label_CSN_ID3.Text   = al[0].Trim();
            label_CSN_Name3.Text = al[1].Trim();
            Panel_Basic.Visible  = true;
            databind4();
            GridView_Basic.SelectedIndex = -1;
            GridView_Basic.EditIndex     = -1;
            //panel 各种隐藏
            TextBox_PT.Text          = "";
            TextBox_Series.Text      = "";
            TextBox_ProductName.Text = "";
            Panel_Add.Visible        = false;
            UpdatePanel_Add.Update();
            Panel_PT.Visible = false;
            UpdatePanel_PT.Update();
            Panel_Product.Visible = false;
            UpdatePanel_Product.Update();
            GridView_CS.EditIndex = -1;
            databind1();
            UpdatePanel_CS.Update();
            Panel1.Visible = false;
            UpdatePanel1.Update();
        }
    }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LbCanBeUsedItem.Attributes.Add("onClick", "listboxSelect()");    //为listbox注册客户端单击事件

            try
            {
                if (!((Session["UserRole"].ToString().Contains("产能核定基础信息维护")) || (Session["UserRole"].ToString().Contains("产能核定基础信息查看"))))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true);
                    Response.Redirect("~/Default.aspx");
                }
                label_pagestate.Text = Request.QueryString["state"];
                string state = label_pagestate.Text;
                if (Session["UserRole"].ToString().Contains("产能核定基础信息查看") && state.Trim() == "look")
                {
                    Title = "产能核定基础信息查看";
                    GridView_CS.Columns[2].Visible = false;
                    GridView_CS.Columns[3].Visible = false;
                    Button_AddCS.Visible           = false;
                    Button_AddPT.Visible           = false;
                    GridView_PT.Columns[2].Visible = false;

                    GridView_Basic.Columns[5].Visible = false;
                    GridView_Basic.Columns[6].Visible = false;
                    Button_AddBasic.Visible           = false;
                }
                if (Session["UserRole"].ToString().Contains("产能核定基础信息维护") && state.Trim() == "manage")
                {
                    Title = "产能核定基础信息维护";
                }
                label_GridPageState.Text = "默认数据源";
                string condition = " and 1=1";
                GridView_CS.DataSource = csl.S_CSName(condition);
                GridView_CS.DataBind();
                UpdatePanel_CS.Update();
                GridView_CS.SelectedIndex = -1;

                // GridView_Detail.EditIndex = -1;
                //各种pannel隐藏
                Panel_Add.Visible = false;
                UpdatePanel_Add.Update();
                Panel_PT.Visible = false;
                UpdatePanel_PT.Update();
                Panel_Product.Visible = false;
                UpdatePanel_Product.Update();
                Panel_Basic.Visible = false;
                TextBox_PBC.Text    = "";
                UpdatePanel_Basic.Update();
                TextBox_PT.Text          = "";
                TextBox_Series.Text      = "";
                TextBox_ProductName.Text = "";
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true);
                Response.Redirect("~/Default.aspx");
            }
        }
    }