当前位置: 首页>>代码示例>>C#>>正文


C# DAL.RunSqlDataTable方法代码示例

本文整理汇总了C#中DAL.RunSqlDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# DAL.RunSqlDataTable方法的具体用法?C# DAL.RunSqlDataTable怎么用?C# DAL.RunSqlDataTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAL的用法示例。


在下文中一共展示了DAL.RunSqlDataTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DKP_sc_info

        /// <summary>
        /// 通过姓名搜索DKP信息
        /// </summary>
        /// <param name="context"></param>
        public void DKP_sc_info(HttpContext context)
        {
            string name = context.Request["name"];
            string SQL = "SELECT TOP 10 [日期],[积分],[说明] FROM [CNGTZ].[dbo].[TZ_人员_积分] where 姓名[email protected]姓名 ORDER BY 日期 desc";
            string info = " {\"top\":@[email protected],\"row\":@[email protected]}";
            string row = "[]", top = "[]";
            DAL dal = new DAL();
            SqlParameter par1 = new SqlParameter("姓名", name.Trim());
            DataTable dt = dal.RunSqlDataTable(SQL, new SqlParameter[] { par1 });
            if (dt != null)
            {
                row = Json.TableToJson(dt);
            }

            SQL = @"SELECT a.[姓名],isnull(b.累计,0) as 累计,isnull(c.消费,0)as 消费,isnull(d.当前,0)as 当前 FROM [CNGTZ].[dbo].[TZ_人员] a LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 当前 FROM [CNGTZ].[dbo].[TZ_人员_积分] group BY 姓名
                                    ) d ON a.姓名=d.姓名 LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 累计 FROM [CNGTZ].[dbo].[TZ_人员_积分] where 积分>0 group BY 姓名
                                    ) b ON a.姓名=b.姓名 LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 消费 FROM [CNGTZ].[dbo].[TZ_人员_积分] where 积分<0 group BY 姓名
                                    ) c ON a.姓名=c.姓名
                                    WHERE  a.姓名[email protected]姓名";
            dt = dal.RunSqlDataTable(SQL, new SqlParameter[] { par1 });
            if (dt != null)
            {
                top = Json.TableToJson(dt);
            }
            info = info.Replace("@[email protected]", top);
            info = info.Replace("@[email protected]", row);

            context.Response.Write(info);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:36,代码来源:DKP.ashx.cs

示例2: Checking

 /// <summary>
 /// 检查站点数据是否有错误数据
 /// </summary>
 public void Checking(HttpContext context)
 {
     string SQL = @"SELECT 站点 as zd,b.简称 as 站点
                                           ,[日期]
                                           ,[枪号]
                                           ,[流水号]
                                           ,[气量]
                                           ,[金额]
                                           ,[单价]
                                           ,[用户号]
                                           ,[卡名]
                                           ,[车类型]
                                           ,[车牌号]
                                           ,[消费方式]
                                       FROM [CNGQT].[dbo].[CNG_充装检查] left JOIN cngtz.dbo.TZ_站点 b
                                       ON 站点=b.ID
                                       where 卡名='班组卡' AND 消费方式<>'记帐金额'";
     string row = "[]";
     int n = 0;
     bool ok = false;
     string retext = "{\"ok\":@[email protected],\"数量\":@数量@,\"row\":@[email protected]}";
     DAL dal = new DAL();
     DataTable dt = dal.RunSqlDataTable(SQL);
     if (dt != null && dt.Rows.Count > 0)
     {
         ok = true;
         n = dt.Rows.Count;
         row = Json.TableToJson(dt);
     }
     retext = retext.Replace("@[email protected]", ok.ToString().ToLower());
     retext = retext.Replace("@数量@", n.ToString());
     retext = retext.Replace("@[email protected]", row);
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:37,代码来源:sys.ashx.cs

示例3: getgas

        public void getgas(HttpContext context)
        {
            string time1 = context.Request["time1"];
            string time2 = context.Request["time2"];

            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable("EXECUTE [WebApp].[dbo].[CC_每小时气量分站点] '" + time1 + "','" + time2 + "'");
            if (dt == null) { context.Response.Write("{}"); return; };
            string str1 = "", str2 = "", str3 = "", str4 = "";
            //double r1=0,r2=0,r3=0;
            int n = 0;
            foreach (DataRow dr in dt.Rows)
            {
                n++;
                str1 = str1 + dr["南高"].ToString() + ",";
                str2 = str2 + dr["西路"].ToString() + ",";
                str3 = str3 + dr["麻柳沱"].ToString() + ",";

                str4 = str4 + "\" " + n.ToString() + " \",";
            }

            str1 = str1.Substring(0, str1.Length - 1);
            str2 = str2.Substring(0, str2.Length - 1);
            str3 = str3.Substring(0, str3.Length - 1);
            str4 = str4.Substring(0, str4.Length - 1);
            string text = "{\"南高\":[" + str1 + "],\"西路\":[" + str2 + "],\"麻柳沱\":[" + str3 + "],\"x\":[" + str4 + "]}";

            //Json.TableToJson(dt);
            context.Response.Write(text);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:30,代码来源:hello.ashx.cs

示例4: TZ_SBlist

 /// <summary>
 /// 返回 站点 设备列表 json
 /// </summary>
 /// <param name="context"></param>
 public void TZ_SBlist(HttpContext context)
 {
     string zd = context.Request["zd"];
     string SQL = "SELECT [id],[设备名称] as text FROM [CNGCL].[dbo].[WX_设备台账] where 站点=" + zd + " order by 编号";
     DAL dal = new DAL();
     DataTable dt = dal.RunSqlDataTable(SQL);
     context.Response.Write(Json.TableToJson(dt));
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:12,代码来源:weixiu.ashx.cs

示例5: getgasdq

        /// <summary>
        /// 取当前气量 分小时
        /// </summary>
        /// <param name="context"></param>
        public void getgasdq(HttpContext context)
        {
            string time1 = DateTime.Now.ToShortDateString();
            string time2 = Convert.ToDateTime(time1).AddDays(1).ToShortDateString();

            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable("EXECUTE [WebApp].[dbo].[CC_每小时气量分站点] '" + time1 + "','" + time2 + "'");
            if (dt == null) { context.Response.Write("{}"); return; };
            string str1 = "", str2 = "", str3 = "", str4 = "";
            //double r1=0,r2=0,r3=0;
            int n = 0;
            foreach (DataRow dr in dt.Rows)
            {
                n++;
                //r1=Math.Round( Convert.ToDouble( dr["南高"].ToString ()));
                //r2=Math.Round( Convert.ToDouble( dr["西路"].ToString ()));
                //r3=Math.Round( Convert.ToDouble( dr["麻柳沱"].ToString ()));

                //str1 = str1 + r1.ToString() + ",";
                //str2 = str2 + r2.ToString() + ",";
                //str3 = str3 + r3.ToString() + ",";

                str1 = str1 + dr["南高"].ToString() + ",";
                str2 = str2 + dr["西路"].ToString() + ",";
                str3 = str3 + dr["麻柳沱"].ToString() + ",";

                str4 = str4 + "\" " + n.ToString() + " \",";
            }

            str1 = str1.Substring(0, str1.Length - 1);
            str2 = str2.Substring(0, str2.Length - 1);
            str3 = str3.Substring(0, str3.Length - 1);
            str4 = str4.Substring(0, str4.Length - 1);
            string text = "{\"南高\":[" + str1 + "],\"西路\":[" + str2 + "],\"麻柳沱\":[" + str3 + "],\"x\":[" + str4 + "]}";

            //Json.TableToJson(dt);
            context.Response.Write(text);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:42,代码来源:hello.ashx.cs

示例6: getlog

        public void getlog(HttpContext context)
        {
            int row = int.Parse(context.Request["rows"].ToString());
            int page = int.Parse(context.Request["page"].ToString());
            string name = context.Request["name"];
            DAL dal = new DAL();
            string SQLtext = "SELECT [ID],[日期],[用户名],[模块程序] as 操作模块,[操作记录] FROM [WebApp].[dbo].[DL_操作日志] where 用户名='"+name+"' AND 是否隐藏=0 ORDER BY 日期 DESC ";

            DataTable dtab = dal.RunSqlDataTable(SQLtext);
            int n = dtab.Rows.Count;
            if (n <= 0)
            {
                string txtno = "{ \"total\": 0, \"rows\": [] }";
                context.Response.Write(txtno);
                return;
            }

            dtab = BLL.tools.GetPagedTable(dtab, page, row);

            string txt = "{\"total\":" + n + ",\"rows\":" + Json.TableToJson(dtab) + "}";
            Sys.DebugMes(txt);
            context.Response.Write(txt);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:23,代码来源:userLog.ashx.cs

示例7: BM_tree

        /// <summary>
        /// 初始化 部门树
        /// </summary>
        /// <param name="context"></param>
        public void BM_tree(HttpContext context)
        {
            string SQL = "SELECT [部门编号],[部门] FROM [CNGTZ].[dbo].[TZ_部门] WHERE 上级部门='0' order by 排序";
            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL);
            string node = "{{\"id\":\"{0}\",\"text\":\"{1}\",\"attributes\":false,\"state\":\"closed\",\"iconCls\":\"ico_tree_folder_close\",\"children\":[{{\"text\":\"正在加载......\"}}] }}"; //\"iconCls\":\"ico_tree_folder_close\"
            string temp = "";
            string txt = "";
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow i in dt.Rows)
                {
                    temp = string.Format(node, i["部门编号"].ToString(), i["部门"].ToString());
                    txt += temp + ",";
                }
                txt = "[" + txt.Substring(0, txt.Length - 1) + "]";
            }
            else
            {
                txt = "[]";
            }

            context.Response.Write(txt);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:28,代码来源:user.ashx.cs

示例8: JF_getMX

 /// <summary>
 /// 取得人员积分明细
 /// </summary>
 /// <param name="context"></param>
 public void JF_getMX(HttpContext context)
 {
     string name = context.Request["name"];
     int row = int.Parse(context.Request["rows"]);
     int page = int.Parse(context.Request["page"]);
     string SQL = @"SELECT [ID]
                                       ,[姓名]
                                       ,convert(varchar(20),[日期],120) as 日期
                                       ,[积分]
                                       ,[说明]
                                       ,[操作人]
                                   FROM [CNGTZ].[dbo].[TZ_人员_积分]
                                   where 姓名[email protected]姓名 ORDER BY 日期 DESC ";
     DAL dal = new DAL();
     SqlParameter par1 = new SqlParameter("姓名", name);
     string retext = "{\"total\":@行数@,\"rows\":@行对象@}", rows = "[]";
     DataTable dt = dal.RunSqlDataTable(SQL, new SqlParameter[] { par1 });
     if (dt == null)
     {
         retext = retext.Replace("@行数@", "0");
         retext = retext.Replace("@行对象@", rows);
         context.Response.Write(retext);
         return;
     }
     retext = retext.Replace("@行数@", dt.Rows.Count.ToString());
     if (dt.Rows.Count > 0)
     {
         //dt = BLL.tools.GetPagedTable(dt, page, row);
         dt = BLL.tools.GetPagedTable(dt, page, row);
         rows = Json.TableToJson(dt);
     }
     retext = retext.Replace("@行对象@", rows);
     Sys.DebugMes(retext);
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:39,代码来源:user.ashx.cs

示例9: button5_Click

        private void button5_Click(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Parse("2012-2-21");
            int zd = 3;//麻柳沱
            int n = 12;//枪数目
            List<ZDGAS.gunSum> gunS = new List<ZDGAS.gunSum>();
            List<ZDGAS.gunGas> gunG = new List<ZDGAS.gunGas>();
            DAL dal = new DAL();
            for (int i = 0; i < n; i++)
            {
                ZDGAS.gunSum gs = new ZDGAS.gunSum();
                ZDGAS.gunGas gg = new ZDGAS.gunGas();
                string SQL1 = ZDGAS.getBZstarttime(dt, i + 1, zd, false, true);
                string SQL2 = ZDGAS.getBZendtime(dt, i + 1, zd, false, true);
                DataTable dt1 = dal.RunSqlDataTable(SQL1);
                DataTable dt2 = dal.RunSqlDataTable(SQL2);

                gs.枪号 = i + 1; gg.枪号 = i + 1;
                gg.站点 = zd;

                if (dt1.Rows.Count <= 0)
                {
                    gs.错误信息 = "未接班";
                    gg.接班时间 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    gg.接班时间 = dt1.Rows[0]["time"].ToString();
                    gs.停止起 = Convert.ToDouble(dt1.Rows[0]["stopsumgas"].ToString());
                    gs.接班总气量 = Convert.ToDouble(dt1.Rows[0]["SuMGas"].ToString());
                    gs.接班总金额 = Convert.ToDouble(dt1.Rows[0]["SuMMOney"].ToString());
                }

                if (dt2.Rows.Count <= 0)
                {
                    gs.错误信息 = "未交班";
                    gg.交班时间 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    gg.交班时间 = dt2.Rows[0]["time"].ToString();
                    gs.停止止 = Convert.ToDouble(dt1.Rows[0]["stopsumgas"].ToString());
                    gs.交班总气量 = Convert.ToDouble(dt2.Rows[0]["SuMGas"].ToString());
                    gs.交班总金额 = Convert.ToDouble(dt2.Rows[0]["SuMMOney"].ToString());
                }

                gg.FF_计算数据();
                gs.系统班累气量 = Math.Round(gg.记帐刷卡气量 + gg.现金消费气量 + gg.预购刷卡气量, 2);
                gs.系统班累金额 = Math.Round(gg.记帐刷卡金额 + gg.现金消费金额 + gg.预购刷卡金额, 2);

                gs.FF_计算数值();

                if (gs.错误信息 != "")
                {
                    switch (gs.错误信息)
                    {
                        case "未交班": gg.交班时间 = "未交班"; break;
                        case "未接班": gg.接班时间 = "未接班"; break;
                        default:
                            break;
                    }
                }

                gunG.Add(gg);
                gunS.Add(gs);

            }
            //string dataFh = "{\"top\":头对象,\"sum\":累计对象,\"gas\":销售对象,\"gasjz\":记帐对象}";

            string fotS1 = "[{\"交班时间\":\"合计:\",\"现金消费气量\":{0},\"现金消费金额\":{1},\"记帐刷卡气量\":{2},\"记帐刷卡金额\":{3},\"预购刷卡气量\":{4},\"预购刷卡金额\":{5}}]";
            //string  fotS1 = "{{0}-{1}-{2}-{3}-{4}-{5}}";
            fotS1 = fotS1.Replace("{0}", "11111");
            fotS1 = fotS1.Replace("{1}", "22222");
            fotS1 = fotS1.Replace("{2}", "3333");
            fotS1 = fotS1.Replace("{3}", "4444");
            fotS1 = fotS1.Replace("{4}", "5555");
            fotS1 = fotS1.Replace("{5}", "6666");

            string text = "{\"total\":12,\"rows\":行数据对象,\"footer\":合计对象}";
            text = text.Replace("行数据对象", Json.Json_转换到json(gunG));
            text = text.Replace("合计对象", fotS1);

            string Txt = text + "\r\n\r\n";
            Txt += "{\"total\":12,\"rows\":" + Json.Json_转换到json(gunS) + "}";
            textBox1.Text = Txt;
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:86,代码来源:Form1.cs

示例10: IcGetBzUser

        /// <summary>
        /// 获取班组人员 和 IC 数据
        /// </summary>
        /// <param name="context"></param>
        public void IcGetBzUser(HttpContext context)
        {
            string zdcode = context.Request["zdcode"];
            string bzcode = context.Request["bzcode"];
            string bz = "";
            switch (bzcode)
            {
                case "010501": bz = "1,2"; break;
                case "010502": bz = "3,4"; break;
                case "010503": bz = "2,3"; break;
                default:
                    bz = bzcode.Substring(bzcode.Length - 1, 1);
                    break;
            }

            string SQL1 = "SELECT [卡号],[班组],[人员] FROM [CNGTZ].[dbo].[IC_绑定] where 所属站点='" + zdcode + "' and 班组 in (" + bz + ") ORDER BY 卡号";
            string SQL2 = "SELECT[姓名]FROM [CNGTZ].[dbo].[TZ_人员]where 所属部门='" + bzcode + "' order by [姓名]";
            string retext = "{\"name\":@[email protected],\"ic\":@[email protected]}", names = "", ics = "";
            var dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL1);
            ics = dt.Rows.Count > 0 ? Json.TableToJson(dt) : "[]";
            dt = dal.RunSqlDataTable(SQL2);
            names = dt.Rows.Count > 0 ? Json.TableToJson(dt) : "[]";
            retext = retext.Replace("@[email protected]", names);
            retext = retext.Replace("@[email protected]", ics);
            context.Response.Write(retext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:31,代码来源:user.ashx.cs

示例11: JF_get

        /// <summary>
        /// 取得积分人员列表
        /// </summary>
        public void JF_get(HttpContext context)
        {
            string zd = context.Request["zd"];
            string bz = context.Request["bz"];
            string retext = "{\"total\":@行数@,\"rows\":@行对象@}", rows = "[]";
            string SQL = @"SELECT a.[姓名],isnull(b.累计,0) as 累计,isnull(c.消费,0)as 消费,isnull(d.当前,0)as 当前 FROM [CNGTZ].[dbo].[TZ_人员] a LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 当前 FROM [CNGTZ].[dbo].[TZ_人员_积分] group BY 姓名
                                    ) d ON a.姓名=d.姓名 LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 累计 FROM [CNGTZ].[dbo].[TZ_人员_积分] where 积分>0 group BY 姓名
                                    ) b ON a.姓名=b.姓名 LEFT JOIN (
                                    SELECT [姓名],sum([积分]) as 消费 FROM [CNGTZ].[dbo].[TZ_人员_积分] where 积分<0 group BY 姓名
                                    ) c ON a.姓名=c.姓名
                                    WHERE a.所属部门 like '@替换@' ORDER BY 当前 desc,a.姓名";
            SQL = SQL.Replace("@替换@", bz);

            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL);
            if (dt == null)
            {
                retext = retext.Replace("@行数@", "0");
                retext = retext.Replace("@行对象@", rows);
                context.Response.Write(retext);
                return;
            }
            retext = retext.Replace("@行数@", dt.Rows.Count.ToString());
            if (dt.Rows.Count > 0)
            {
                //dt = BLL.tools.GetPagedTable(dt, page, row);
                rows = Json.TableToJson(dt);
            }
            retext = retext.Replace("@行对象@", rows);
            Sys.DebugMes(retext);
            context.Response.Write(retext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:37,代码来源:user.ashx.cs

示例12: getuserlist

        /// <summary>
        /// 根据部门 获取人员列表
        /// </summary>
        /// <param name="context"></param>
        public void getuserlist(HttpContext context)
        {
            string code = context.Request["code"];
            bool IScheck = bool.Parse(context.Request["IScheck"]);

            string SQL = @"SELECT a.[ID],a.[姓名],a.[拼音],b.[部门],a.[所属部门] FROM [CNGTZ].[dbo].[TZ_人员] a LEFT JOIN [CNGTZ].dbo.TZ_部门 b ON a.所属部门=b.部门编号 where a.[所属部门]='" + code + "' order by a.[姓名]";
            if (IScheck)
            {
                SQL = @"SELECT a.[ID],a.[姓名],a.[拼音],b.[部门],a.[所属部门] FROM [CNGTZ].[dbo].[TZ_人员] a LEFT JOIN [CNGTZ].dbo.TZ_部门 b ON a.所属部门=b.部门编号 where a.[所属部门] like '" + code + "%' order by a.[姓名]";
            }
            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL);
            string rowtext = "{\"total\":" + dt.Rows.Count.ToString() + ",\"rows\":@行数据对象@}";
            string rowdx = "[]";
            if (dt.Rows.Count > 0)
            {
                rowdx = Json.TableToJson(dt);
            }

            rowtext = rowtext.Replace("@行数据对象@", rowdx);
            Sys.DebugMes(rowtext);
            context.Response.Write(rowtext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:27,代码来源:user.ashx.cs

示例13: IcGetBzcode

 /// <summary>
 /// 获取 所属班组的人员name
 /// </summary>
 /// <param name="context"></param>
 public void IcGetBzcode(HttpContext context)
 {
     string code = context.Request["code"];
     string SQL = "SELECT[姓名] FROM [CNGTZ].[dbo].[TZ_人员]where 所属部门='" + code + "' order by [姓名]";
     var dal = new DAL();
     var dt = dal.RunSqlDataTable(SQL);
     context.Response.Write(Json.TableToJson(dt));
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:12,代码来源:user.ashx.cs

示例14: ListScanUserInfo

        //通过部门分类 搜索人员信息
        public void ListScanUserInfo(HttpContext context)
        {
            string bm = context.Request["bm"];
            int row = int.Parse(context.Request["rows"]);
            int page = int.Parse(context.Request["page"]);
            string retext = "{\"total\":@行数@,\"rows\":@行对象@}", rows = "[]";
            string SQL = @"SELECT a.ID,a.姓名,e.部门
                                                ,isnull(b.性别,'') as 性别
                                                ,isnull(convert (varchar(10), b.出生年月,120),'') as 出生年月
                                                ,isnull(datediff(year,b.出生年月,getdate()),'') as 年龄
                                                ,isnull(b.婚姻,'') as 婚姻
                                                ,isnull(b.学历,'') as 学历
                                                ,isnull(b.政治面貌,'') as 政治面貌
                                                ,isnull(b.身份证号,'') as 身份证号
                                                ,isnull(c.手机,'') as 手机
                                                ,isnull(c.联系电话,'') as 联系电话
                                                ,isnull(c.家庭住址,'') as 家庭住址
                                                ,isnull(c.银行卡号,'') as 银行卡号
                                                ,isnull(c.电子邮件,'') as 电子邮件
                                                ,isnull(d.毕业院校,'') as 毕业院校
                                                ,isnull(convert (varchar(10), d.毕业时间,120),'') as 毕业时间
                                                ,isnull(d.专业,'') as 所学专业
                                                ,isnull(convert (varchar(10), d.参加工作日期,120),'') as 参加工作日期
                                                  FROM [CNGTZ].[dbo].[TZ_人员] a
                                                  LEFT JOIN [CNGTZ].[dbo].TZ_人员_基本信息 b ON a.ID=b.ID
                                                  LEFT JOIN [CNGTZ].[dbo].TZ_人员_档案1 c ON a.ID = c.ID
                                                  LEFT JOIN [CNGTZ].[dbo].TZ_人员_档案2 d ON a.ID = d.ID
                                                  LEFT JOIN [CNGTZ].[dbo].TZ_部门 e ON a.所属部门 = e.部门编号
                                                WHERE a.所属部门 LIKE '@[email protected]%'
                                                  ORDER BY 姓名";
            SQL = SQL.Replace("@[email protected]", bm);

            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL);
            if (dt == null)
            {
                retext = retext.Replace("@行数@", "0");
                retext = retext.Replace("@行对象@", rows);
                context.Response.Write(retext);
                return;
            }
            retext = retext.Replace("@行数@", dt.Rows.Count.ToString());
            if (dt.Rows.Count > 0)
            {
                dt = BLL.tools.GetPagedTable(dt, page, row);
                rows = Json.TableToJson(dt);
            }
            retext = retext.Replace("@行对象@", rows);
            Sys.DebugMes(retext);
            context.Response.Write(retext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:52,代码来源:user.ashx.cs

示例15: sum

        private string Chart_站点年度生产(string year ,string zd)
        {
            string retext = "{ \"ok\":true,\"msg\":\"\",\"sc1\":@替换对象[email protected],\"sc2\":@替换对象[email protected],\"sum\":@替换对象[email protected]  }";

            string SQL = @"SELECT sum(生产气量) as 生产气量,
                                            '输差率'=
                                            CASE  sum([购进数]+[修正值]) when 0 then 0
                                            else round((sum([购进数])+sum([修正值])-sum([生产气量])-sum([库存数]))/sum([购进数]+[修正值])*100,2) end FROM [CNGQT].[dbo].[CW_月度统计] where 年[email protected]年度@ and 站点[email protected]站点@  GROUP BY 月 order by 月";
            SQL = SQL.Replace("@年度@", year);
            SQL = SQL.Replace("@站点@", zd);

            DAL dal = new DAL();
            DataTable dt = dal.RunSqlDataTable(SQL);
            if (dt == null)
            {
                retext = retext.Replace(":true", ":false");

                return retext;
            }
            double[] sc1 = new double[12];
            double[] sc2 = new double[12];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sc1[i] = double.Parse(dt.Rows[i]["生产气量"].ToString());
                sc2[i] = double.Parse(dt.Rows[i]["输差率"].ToString());
            }
            SQL = "SELECT sum(生产气量) as 生产气量 FROM [CNGQT].[dbo].[CW_月度统计] where 年[email protected]年度@ and 站点[email protected]站点@";
            SQL = SQL.Replace("@年度@", year);
            SQL = SQL.Replace("@站点@", zd);
            string yearSum = dal.RunSqlGetID(SQL);

            string sc1Json = Json.Json_转换到json<double[]>(sc1);
            string sc2Json = Json.Json_转换到json<double[]>(sc2);
            retext = retext.Replace("@替换对象[email protected]", sc1Json);
            retext = retext.Replace("@替换对象[email protected]", sc2Json);
            retext = retext.Replace("@替换对象[email protected]", yearSum);

            return retext;
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:39,代码来源:CNGGAS.ashx.cs


注:本文中的DAL.RunSqlDataTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。