示例#1
0
        protected void Grv_File_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                string cmd = e.CommandName.Trim();

                if (cmd == "ReBuild")
                {
                    //获取选中行索引值
                    GridViewRow gvr = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));

                    //根据索引值获取某列的值
                    string ID     = Grv_File.Rows[gvr.RowIndex].Cells[0].Text;
                    string Client = Grv_File.Rows[gvr.RowIndex].Cells[6].Text;

                    string filepath = Grv_File.Rows[gvr.RowIndex].Cells[2].Text.Trim();
                    //string filename = Grv_File.Rows[gvr.RowIndex].Cells[1].Text.Trim();
                    LinkButton lb1      = (LinkButton)Grv_File.Rows[gvr.RowIndex].Cells[1].FindControl("linkbtn1"); //列属性为HyperLink,取值方式不一样
                    string     filename = lb1.Text.ToString();
                    string     fileno   = filename.Substring(0, filename.IndexOf("."));
                    string     guid     = Guid.NewGuid().ToString();

                    HNDrawingServicesAPI.HNDrawingSevices services = new HNDrawingSevices();

                    if (Client.Equals("HANNASERVER") || Client.Equals("HANNASERVER1") || Client.Equals("HANNASERVER2"))
                    {
                        services.SetServicesPath("http://10.151.129.88:8099/api/");
                        //PlotFileMessage plotfile = services.PlotFile(filepath, fileno, "", "", 1);
                        //string PlotString = Newtonsoft.Json.JsonConvert.SerializeObject(plotfile);
                        services.PlotFileAsync(filepath, fileno, "", "", 1, guid);
                    }
                    if (Client.Equals("HANNASERVER3") || Client.Equals("HANNASERVER4"))
                    {
                        services.SetServicesPath("http://10.151.129.91:8099/api/");
                        //PlotFileMessage plotfile = services.PlotFile(filepath, fileno, "", "", 1);
                        //string PlotString = Newtonsoft.Json.JsonConvert.SerializeObject(plotfile);
                        services.PlotFileAsync(filepath, fileno, "", "", 1, guid);
                    }
                    //更新SPF中间表state值,进行重签操作
                    //string updatesql = "UPDATE [dbo].[FilePlotPool] SET [Status]='01' WHERE ID = '" + ID + "'";
                    //noQuery(updatesql, SQLCON_Hanna);
                }
                if (cmd == "lkbtnClick")
                {
                    object[] arguments = e.CommandArgument.ToString().Split(',');
                    Response.Redirect("~/Views/HanaFileCKPLTRcd.aspx?FileName=" + arguments[0].ToString() + "&Client=" + arguments[1].ToString());
                }
            }
            catch { }
            string sql = GetConstr();

            Grid_Databinding(sql, SQLCON_Hanna);
        }
        protected void Grv1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                string cmd = e.CommandName.Trim();
                //获取选中行索引值
                GridViewRow gvr = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));

                //根据索引值获取某列的值
                string ID     = Grv1.Rows[gvr.RowIndex].Cells[0].Text; //列属性为HyperLink,获取值要麻烦些
                string Client = Grv1.Rows[gvr.RowIndex].Cells[7].Text;

                if (cmd == "ReBuild")
                {
                    string filepath = Grv1.Rows[gvr.RowIndex].Cells[3].Text.Trim();
                    string filename = ((HyperLink)(Grv1.Rows[gvr.RowIndex].Cells[1].Controls[0])).Text;  //列属性为HyperLink,取值方式不一样

                    string fileno = filename.Substring(0, filename.IndexOf("."));
                    string guid   = Guid.NewGuid().ToString();
                    HNDrawingServicesAPI.HNDrawingSevices services = new HNDrawingSevices();

                    if (Client.Equals("HANNASERVER") || Client.Equals("HANNASERVER1") || Client.Equals("HANNASERVER2"))
                    {
                        services.SetServicesPath("http://10.151.129.88:8099/api/");
                        //PlotFileMessage plotfile = services.PlotFile(filepath, fileno, "", "", 1);
                        //string PlotString = Newtonsoft.Json.JsonConvert.SerializeObject(plotfile);
                        services.PlotFileAsync(filepath, fileno, "", "", 1, guid);
                    }
                    if (Client.Equals("HANNASERVER3") || Client.Equals("HANNASERVER4"))
                    {
                        services.SetServicesPath("http://10.151.129.91:8099/api/");
                        //PlotFileMessage plotfile = services.PlotFile(filepath, fileno, "", "", 1);
                        //string PlotString = Newtonsoft.Json.JsonConvert.SerializeObject(plotfile);
                        services.PlotFileAsync(filepath, fileno, "", "", 1, guid);
                    }
                    //更新SPF中间表state值,进行重签操作
                    //string updatesql = "UPDATE [dbo].[FilePlotPool] SET [Status]='01' WHERE ID = '" + ID + "'";
                    //noQuery(updatesql, SQLCON_Hanna);
                }
            }
            catch { }
            DtUnion = GetUnitb();
            Grid_Databinding(DtUnion);
        }