Example #1
0
        private void GetCFXQ(HttpContext context)
        {
            string       bsm = context.Request["BSM"];
            ReturnObject ro  = new ReturnObject();

            try
            {
                //使用可能有多个
                string sqlSYQK = string.Format(@"select * from cf_syqk t where sscfdm='{0}'", bsm);
                //闲置只有一个
                string sqlXZQK = string.Format(@"select * from cf_xzqk t where sscfdm='{0}'", bsm);
                //配套设置只有一个
                string sqlPTSS = string.Format(@"select t2.* from cf t1
left join cf_ptss t2 on t1.sscqdm=t2.bsm
where t1.bsm='{0}' ", bsm);

                DataTable dtSYQK = DBContext.Instance.ExecuteQuery(sqlSYQK);
                DataTable dtXZQK = DBContext.Instance.ExecuteQuery(sqlXZQK);
                DataTable dtPTSS = DBContext.Instance.ExecuteQuery(sqlPTSS);

                ro.AddData("SYQK", dtSYQK);
                ro.AddData("XZQK", EntityUtilities.DataTableToDict(dtXZQK));
                ro.AddData("PTSS", EntityUtilities.DataTableToDict(dtPTSS));
            }
            catch (System.Exception ex)
            {
                ro = new ReturnObject(ex.Message);
            }
            string rt = Newtonsoft.Json.JsonConvert.SerializeObject(ro);

            this.ResponseResult(rt);
        }
Example #2
0
 /// <summary>
 /// 将DataTable的第一行转换为 Dictionary。如果第一行为空,则返回空 Dictionary。
 /// </summary>
 /// <param name="dt"></param>
 /// <returns></returns>
 public static Dictionary <string, object> DataTableToDict(DataTable dt)
 {
     return(EntityUtilities.DataRowToDict(dt == null ? null : (dt.Rows.Count > 0 ? dt.Rows[0] : null)));
 }