Exemple #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index       = Convert.ToInt32(e.CommandArgument);
            GridViewRow row         = GridView1.Rows[index];
            string      ddj         = Convert.ToDateTime(cc1.time_now).ToString("yyyy-MM-dd HH:mm");
            string      pristr1     = cc1.getcolumnindexbyname(row, "cprj");
            string      pristr2     = cc1.getcolumnindexbyname(row, "line");
            string      pristr3     = cc1.getcolumnindexbyname(row, "nopr");
            string      pristr4     = cc1.getcolumnindexbyname(row, "puid");
            string      stop_status = cc1.getcolumnindexbyname(row, "workstop");
            string      position    = cc1.getcolumnindexbyname(row, "position");
            string      usdtimstr   = Convert.ToDateTime(cc1.connectionofc008_select("select usdtim from ecsfc930_pud where cprj='" + pristr1 + "' and line='" + pristr2 + "' and nopr='" + pristr3 + "' and puid='" + pristr4 + "'", "usdtim")).ToString("yyy-MM-dd HH:mm");

            Button      ssb1  = (Button)e.CommandSource;
            GridViewRow myrow = (GridViewRow)ssb1.NamingContainer;
            TextBox     tb    = (TextBox)GridView1.Rows[myrow.RowIndex].Cells[9].FindControl("tbpdsca");
            Button      upd   = (Button)GridView1.Rows[myrow.RowIndex].Cells[10].FindControl("End_exception");

            if (e.CommandName == "End_exception")
            {
                //if (tb.Text != "")
                //{
                string ssStatus = "1";    //1進行中 0休停中
                if (stop_status == "是")
                {
                    cc1.connectionofc008_modify("update ecsfc929_memb set code=NULL,statuscode='5' where cprj='" + pristr1 + "' and line='" + pristr2 + "' and nopr='" + pristr3 + "'");
                    ssStatus = "0";
                }
                else
                {
                    cc1.connectionofc008_modify("update ecsfc929_memb set statuscode='1' where cprj='" + pristr1 + "' and line='" + pristr2 + "' and nopr='" + pristr3 + "'");
                }
                cc1.connectionofc008_modify(@"update ecsfc930_pud set [workstop]='0',uclose='是',uedtim='" + ddj + "',eutm='" + cc1.calculate_time(usdtimstr, ddj) + "',pdsca='" + tb.Text + "' where cprj='" + pristr1 + "' and line='" + pristr2 + "' and nopr='" + pristr3 + "' and puid='" + pristr4 + "';");
                string uCt = cc1.connectionofc008_select("  select count(*) as uCt from ecsfc930_pud where line='" + pristr2 + "' and uclose='否'", "uCt");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "sendMsgtoKanban", "ssStatus = '" + ssStatus + "';position='" + position + "';eClose='" + uCt + "';$('#msgBtn').click();", true);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "layer_close222", "parent.location.reload();", true);
                //}
                //else
                //{
                //    //upd.Attributes.Add("onclick", "nulltip2();");
                //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "nulltip2", "nulltip2();", true);
                //    //System.Threading.Thread.Sleep(5000);
                //    //Response.Redirect(Request.Url.ToString());
                //}
            }
        }