Exemplo n.º 1
0
        private string GetWorkList()
        {
            string StrQuery = Request["key"];
            //当前页
            string pageNumber  = getUTF8ToString("pageNumber");
            int    iPageNumber = string.IsNullOrEmpty(pageNumber) ? 1 : Convert.ToInt32(pageNumber);
            //每页多少行
            string pageSize  = getUTF8ToString("pageSize");
            int    iPageSize = string.IsNullOrEmpty(pageSize) ? 9999 : Convert.ToInt32(pageSize);

            StrQuery = HttpUtility.UrlDecode(StrQuery, System.Text.Encoding.UTF8);

            string sql   = "";
            string wfSql = "  WFState=" + (int)WFState.Askfor + " OR WFState=" + (int)WFState.Runing + " OR WFState=" + (int)WFState.Shift + " OR WFState=" + (int)WFState.ReturnSta;

            if (string.IsNullOrEmpty(StrQuery.Trim()))
            {
                sql = "SELECT  * FROM WF_GenerWorkFlow where 1=1 and  " + wfSql + " order by RDT desc";
            }
            else
            {
                // StrQuery = Server.UrlDecode(StrQuery);
                sql = "select * from (SELECT * from WF_GenerWorkFlow where  " + wfSql + ") as WF_GenerWorkFlow where  1=1 and " + StrQuery + " order by RDT desc  ";
            }



            System.Data.DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql);


            foreach (DataRow row in dt.Rows)
            {
                if (row["StarterName"].ToString() == "Guest")
                {
                    int oid = int.Parse(row["WorkID"].ToString());
                    if (oid != 0)
                    {
                        string ndXSql = "select * from ND" + int.Parse(row["FK_Flow"].ToString()) + "Rpt where OID = '" + oid + "'";

                        DataTable ndTable = BP.DA.DBAccess.RunSQLReturnTable(ndXSql);
                        if (ndTable.Rows.Count > 0)
                        {
                            row["StarterName"] = ndTable.Rows[0]["GuestName"];
                        }
                    }
                }
            }
            foreach (DataColumn column in dt.Columns)
            {
                column.ColumnName = column.ColumnName.ToUpper();
            }
            return(CommonDbOperator.GetJsonFromTable(dt));
        }
        private void GetData()
        {
            string StrQuery = Request["key"];

            StrQuery = HttpUtility.UrlDecode(StrQuery, System.Text.Encoding.UTF8);

            string sql   = "";
            string wfSql = "  WFState=" + (int)WFState.Askfor + " OR WFState=" + (int)WFState.Runing + " OR WFState=" + (int)WFState.Shift + " OR WFState=" + (int)WFState.ReturnSta;

            if (string.IsNullOrEmpty(StrQuery.Trim()))
            {
                sql = "SELECT  * FROM WF_GenerWorkFlow where 1=1 and  " + wfSql + " order by RDT desc";
            }
            else
            {
                // StrQuery = Server.UrlDecode(StrQuery);
                sql = "select * from (SELECT * from WF_GenerWorkFlow where  " + wfSql + ") as WF_GenerWorkFlow where  1=1 and " + StrQuery + " order by RDT desc  ";
            }

            System.Data.DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql);
            foreach (DataRow row in dt.Rows)
            {
                if (row["StarterName"].ToString() == "Guest")
                {
                    int oid = int.Parse(row["WorkID"].ToString());
                    if (oid != 0)
                    {
                        string ndXSql = "select * from ND" + int.Parse(row["FK_Flow"].ToString()) + "Rpt where OID = '" +
                                        oid + "'";
                        DataTable ndTable = BP.DA.DBAccess.RunSQLReturnTable(ndXSql);
                        if (ndTable.Rows.Count > 0)
                        {
                            row["StarterName"] = ndTable.Rows[0]["GuestName"];
                        }
                    }
                }
            }
            foreach (DataColumn column in dt.Columns)
            {
                column.ColumnName = column.ColumnName.ToUpper();
            }
            string result = CommonDbOperator.GetJsonFromTable(dt);

            Response.Clear();
            Response.Write(result);
            Response.End();
        }