918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/54f3ceba/6be944cd/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/54f3ceba/6be944cd/App_Web_r3jdcukd.1.cs
?#pragma checksum "D:\wwwroot\klbttc\wwwroot\ajax\GetProductInfoHandler.ashx" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "18951510AD96328473136B7B0DB4252E048042E4"

#line 1 "D:\wwwroot\klbttc\wwwroot\ajax\GetProductInfoHandler.ashx"


using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
using System.Linq;

public class GetProductInfoHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/html;charset=utf-8";

        string tableName = context.Request.Params["table"];
        string selectFieldOrder = context.Request.Params["fieldOrder"];
        string id = context.Request.Params["id"];

        ProductInfoDto productInfo = GetProductInfo(tableName, selectFieldOrder, id);

        string jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(productInfo);
        context.Response.Write(jsonData);
        context.Response.ContentEncoding = System.Text.Encoding.UTF8;
        context.Response.End();
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

    private ProductInfoDto GetProductInfo(string tableName, string selectFieldOrder, string id)
    {
        var productinfo = new ProductInfoDto();

        if (string.IsNullOrWhiteSpace(tableName)) return productinfo;
        if (string.IsNullOrWhiteSpace(selectFieldOrder)) return productinfo;
        if (string.IsNullOrWhiteSpace(id)) return productinfo;

        string productName = string.Empty;
        string matchProductKey = string.Empty;

        //产品
        string SQL = "SELECT * FROM " + tableName + " WHERE " + tableName + "0 = @id";
        DataSet ds = MyFunction.Query(SQL, new SqlParameter[] { new SqlParameter("@id", id) });
        if (ds.Tables.Count > 0)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                //var cont = ds.Tables[0].Rows[0][tableName + selectFieldOrder].ToString();
                var cont = ds.Tables[0].Rows[0]["product18"].ToString();
                var remark = ds.Tables[0].Rows[0]["product8"].ToString();
                var img = ds.Tables[0].Rows[0]["product6"].ToString();
                //return cont;
                productinfo.cont = cont;
                productinfo.img = img;
                productinfo.remark = remark;

                productName = ds.Tables[0].Rows[0]["product1"].ToString();
                matchProductKey = ds.Tables[0].Rows[0]["product4"].ToString();

                productinfo.proList = gerProductInfo(productName);
            }
        }


        if (!string.IsNullOrWhiteSpace(productName))
        {
            string condition = string.Empty;
            foreach (var item in productName.Split('/'))
            {
                condition += " charindex('" + item + "', product3)> 0 or";
            }

            if (!string.IsNullOrWhiteSpace(matchProductKey))
            {
                condition += " charindex('" + matchProductKey + "', product3)> 0 or";
            }

            //charindex(@key, product3)> 0
            DataSet list = MyFunction.Query("SELECT * FROM product WHERE product9 = @mid and (" + condition.TrimEnd(new char[] { 'r', 'o' }) + ") ORDER BY ISNULL(product10, 0) DESC,product7 DESC;", new SqlParameter[] {
                    new SqlParameter("@mid", 198),
                    //new SqlParameter("@key",productName)
                });
            if (list.Tables.Count > 0)
            {
                List<ProductDto> productList = new List<ProductDto>();
                if (list.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < list.Tables[0].Rows.Count; i++)
                    {
                        productList.Add(new ProductDto
                        {
                            DJH = list.Tables[0].Rows[i]["product1"].ToString(),
                            SYZT = list.Tables[0].Rows[i]["product2"].ToString(),
                            YWMC = list.Tables[0].Rows[i]["product3"].ToString(),
                            SYZ = list.Tables[0].Rows[i]["product4"].ToString(),
                            SYTSTM = list.Tables[0].Rows[i]["product6"].ToString(),
                            IsRowsColor = i % 2 == 0 ? true : false
                        });
                    }
                }
                productinfo.products = productList;
            }
        }


        return productinfo;
        //return MyFunction.gerProductInfo(id);
    }

    private string gerProductInfo(string name)
    {
        StringBuilder builder = new StringBuilder();
        StringBuilder sb = new StringBuilder();
        DataSet ds = new DataSet();

        string SQL = @"SELECT p.*,c.* FROM product p INNER JOIN ClassSys c ON p.product5 = c.classsys0 
WHERE product9 = 197 AND p.product1 = @name AND c.ClassSys4=193 ORDER BY ISNULL(product10, 9999), product7 DESC";
        ds = MyFunction.Query(SQL, new SqlParameter[] { new SqlParameter("@name", name) });
        if (ds.Tables.Count > 0)
        {
            var table = ds.Tables[0];
            var count = table.Rows.Count;
            if (count > 0)
            {
                var list = table.AsEnumerable().ToList();
                var claFirst = list.FirstOrDefault();
                var barColor = claFirst.Field<string>("ClassSys7");

                #region 分类
                builder.AppendLine("<div class=\"item\">");

                builder.AppendLine("<dl class=\"list-tit\">");
                builder.AppendLine("<dd>产品</dd>");
                builder.AppendLine("<dd>靶点</dd>");
                builder.AppendLine("<dd>适应症</dd>");
                builder.AppendLine("<dd>临床前/IND 筹备</dd>");
                builder.AppendLine("<dd>Ia期</dd>");
                builder.AppendLine("<dd>Ib/II期</dd>");
                builder.AppendLine("<dd>关键 II期/III期</dd>");
                builder.AppendLine("<dd>NDA申请</dd>");
                builder.AppendLine("<div class=\"clear\"></div>");
                builder.AppendLine("</dl>");

                #region 产品
                foreach (var pro in list)
                {
                    builder.AppendLine("<dl class=\"dl\">");
                    builder.AppendLine("<dt>" + pro.Field<string>("product1") + "</dt>");

                    builder.AppendLine("<dd>");
                    builder.AppendLine("<ol>");
                    builder.AppendLine("<span>" + pro.Field<string>("product2") + "</span>");
                    builder.AppendLine("<span>" + pro.Field<string>("product3") + "</span>");
                    builder.AppendLine("<span>");
                    builder.AppendLine("<div class=\"progress-bar progress-bar-striped active\" style=\"width:" + pro.Field<string>("product21") + ";background-color:" + barColor + "\"></div>");
                    builder.AppendLine("<div class=\"line\">");
                    builder.AppendLine("<i></i>");
                    builder.AppendLine("<i></i>");
                    builder.AppendLine("<i></i>");
                    builder.AppendLine("<i></i>");
                    builder.AppendLine("<i></i>");
                    builder.AppendLine("</div>");
                    builder.AppendLine("</span>");
                    builder.AppendLine("<div class=\"clear\"></div>");

                    builder.AppendLine("</ol>");
                    builder.AppendLine("</dd>");

                    builder.AppendLine("<div class=\"clear\"></div>");
                    builder.AppendLine("</dl>");
                }
                #endregion

                builder.AppendLine("</div>");
                #endregion
            }
        }

        return builder.ToString();
    }

}

public class ProductInfoDto
{
    public string cont { get; set; }
    public string remark { get; set; }
    public string img { get; set; }
    public List<ProductDto> products { get; set; }
    public string proList { get; set; }
}

public class ProductDto
{
    /// <summary>
    /// 登记号
    /// </summary>
    public string DJH { get; set; }
    /// <summary>
    /// 尝试状态
    /// </summary>
    public string SYZT { get; set; }
    /// <summary>
    /// 药物名称
    /// </summary>
    public string YWMC { get; set; }
    /// <summary>
    /// 适应症
    /// </summary>
    public string SYZ { get; set; }
    /// <summary>
    /// 尝试通俗标题
    /// </summary>
    public string SYTSTM { get; set; }
    /// <summary>
    /// 是否是换色行
    /// </summary>
    public bool IsRowsColor { get; set; }
}

#line default
#line hidden