/// <summary>
 /// 更新数据目录
 /// </summary>
 /// <param name="json"></param>
 /// <param name="proc"></param>
 /// <returns></returns>
 protected string GetReturnJsonInt(string json, string proc, string userId, string entid)
 {
     try
     {
         string         r_json = "";
         var            msg    = "";
         SqlParameter[] param  = (JsonMethod.ListParameter(json, userId, entid)).ToArray();//动态解析json参数
         SqlRun         sql    = new SqlRun(SqlRun.sqlstr);
         int            n      = sql.ExecuteNonQuery(proc, param);
         if (n > 0)
         {
             msg    = "更新成功";
             r_json = JsonMethod.GetError(0, msg);
         }
         else
         {
             msg    = "更新失败!";
             r_json = JsonMethod.GetError(1, msg);
         }
         return(r_json);
     }
     catch (Exception ex)
     {
         string r_json = JsonMethod.GetError(1, ex.Message);
         return(r_json);
     }
 }
        /// <summary>
        /// 返回DataTable()
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string GetReturnJsonBox(string json, string proc, string typename, string userId, string entid)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entid)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      ds    = sql.RunProcedureDR(proc, param);

            if (ds.Rows.Count > 0)
            {
                ///加载节点
                string    objList = "";
                DataTable dtc     = ds;
                if (dtc.Rows.Count > 0)
                {
                    switch (typename)
                    {
                    case "Pc_GetType":    //资质角色
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["TypeId"] + "'>" + dr_c1["Name"] + "</option>";
                        }
                        break;

                    default:
                        break;
                    }
                }
                return("{\"flag\":\"0\",\"objList\":\"" + objList + "\"}");
            }
            else
            {
                string error = "无数据";
                return(JsonMethod.GetError(1, error));
            }
        }
        /// <summary>
        /// 修改是否启用
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userid"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string EnablePayment(string json, string proc, string userid, string entid)
        {
            SqlParameter[] param  = (JsonMethod.ListParameter(json, userid, entid)).ToArray();//动态解析json参数
            SqlRun         sql    = new SqlRun(SqlRun.sqlstr);
            int            number = sql.ExecuteNonQuery(proc, param);

            if (number > 0)
            {
                return(JsonMethod.GetError(0, "操作成功"));
            }
            else
            {
                return(JsonMethod.GetError(1, "操作失败"));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 加载商品选项分类/属性/状态
        /// </summary>
        /// <returns></returns>
        protected string LoadCheckBox(string json, string proc, string userId, string entId, HttpContext context)
        {
            string checkType = context.Request.QueryString["CheckType"];

            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataSet        ds    = sql.RunProDataSet(proc, param);
            ///加载商品分类
            string    categoryList = "";
            DataTable dtc          = ds.Tables[0];

            if (dtc.Rows.Count > 0)
            {
                DataRow[] drc_1 = dtc.Select("class_layer=1", "sort_id asc");
                foreach (DataRow dr_c1 in drc_1)
                {
                    categoryList += "<option value='" + dr_c1["id"] + "'>" + dr_c1["title"] + "</option>";
                    DataRow[] drc_2 = dtc.Select("class_layer=2 and parent_id=" + dr_c1["id"] + " ", "sort_id asc");
                    foreach (DataRow dr_c2 in drc_2)
                    {
                        categoryList += "<option value='" + dr_c2["id"] + "'>&nbsp;&nbsp;├" + dr_c2["title"] + "</option>";
                    }
                }
            }
            ///加载商品属性
            string    attributeList = "";
            int       no            = 0;
            DataTable dta           = ds.Tables[1];

            if (dta.Rows.Count > 0)
            {
                foreach (DataRow dr_a in dta.Rows)
                {
                    if (checkType == "CheckBox")
                    {
                        attributeList += "<div class='radio-box'><input name='isRecommend' type='checkbox' id='tjCheck_" + no + "' value='" + dr_a["id"] + "' ><label for='status-" + no + "'>" + dr_a["title"] + "</label></div>";
                    }
                    else
                    {
                        attributeList += "<option value='" + dr_a["id"] + "'>" + dr_a["title"] + "</option>";
                    }
                    no++;
                }
            }
            return("{\"flag\":\"0\",\"categoryList\":\"" + categoryList + "\",\"attributeList\":\"" + attributeList + "\"}");
        }
Beispiel #5
0
        /// <summary>
        /// 获取多个表返回Json
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string ReturnDataSetJson(string json, string proc, string userId, string entId)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataSet        ds    = sql.RunProDataSet(proc, param);
            string         r_json;

            if (ds.Tables.Count > 0)
            {
                r_json = JsonMethod.DataSetToJson("0", ds);
            }
            else
            {
                string error = "无数据";
                r_json = JsonMethod.GetError(1, error);
            }
            return(r_json);
        }
Beispiel #6
0
        /// <summary>
        /// 获取商品分类列表
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entId"></param>
        /// <returns></returns>
        protected string GetGoodsCategory(string json, string proc, string userId, string entId)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      dt    = sql.RunProcedureDR(proc, param);
            string         r_json;

            if (dt.Rows.Count > 0)
            {
                r_json = JsonMethod.GoodsCategory(dt);
            }
            else
            {
                string error = "无数据";
                r_json = JsonMethod.GetError(1, error);
            }
            return(r_json);
        }
        /// <summary>
        /// 获取多个表返回Json
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string ReturnDataTableJson(string json, string proc, string userId, string entId)
        {
            string r_json;

            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      table = sql.RunProcedureDR(proc, param);

            if (table.Rows.Count > 0)
            {
                r_json = JsonMethod.DataTableToJson("0", table);
            }
            else
            {
                string error = "无数据";
                r_json = JsonMethod.GetError(1, error);
            }
            return(r_json);
        }
        /// <summary>
        /// 更新数据目录
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <returns></returns>
        protected string GetReturnJsonInt(string json, string proc, string userId, string entid)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entid)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            int            n     = sql.ExecuteNonQuery(proc, param);
            string         r_json;
            string         msg;

            if (n > 0)
            {
                msg    = "更新成功";
                r_json = JsonMethod.GetError(0, msg);
            }
            else
            {
                msg    = "更新失败!";
                r_json = JsonMethod.GetError(1, msg);
            }
            return(r_json);
        }
        /// <summary>
        /// 更新数据库的数据,返回一个表
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <returns></returns>
        protected string GetReturnDs(string json, string proc, string UserId, string entid)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, UserId, entid)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      dt    = sql.RunProcedureDR(proc, param);
            string         r_json;

            if (dt.Rows.Count > 0)
            {
                int    flag = int.Parse(dt.Rows[0]["flag"].ToString() ?? "1");
                string msg  = dt.Rows[0]["msg"].ToString();
                r_json = JsonMethod.GetError(flag, msg);
            }
            else
            {
                string msg = dt.Rows[0]["msg"].ToString();
                r_json = JsonMethod.GetError(1, msg);
            }
            return(r_json);
        }
        /// <summary>
        /// 检测用户的角色权限
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entId"></param>
        /// <returns></returns>
        protected string GetRoleJson(string json, string proc, string userId, string entId)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      ds    = sql.RunProcedureDR(proc, param);
            string         r_json;

            if (ds.Rows.Count > 0)
            {
                int recordCount = 0;
                int pageCount   = 0;
                r_json = JsonMethod.GetDataTable(0, recordCount, pageCount, ds);
            }
            else
            {
                string error = "无数据";
                r_json = JsonMethod.GetError(1, error);
            }
            return(r_json);
        }
        /// <summary>
        /// 获取数据返回数据列表
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entId"></param>
        /// <returns></returns>
        protected string GetReturnJson(string json, string proc, string userId, string entId)
        {
            string r_json;

            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataSet        ds    = sql.RunProDataSet(proc, param);

            if (ds.Tables.Count >= 3)
            {
                if (ds.Tables[1].Rows.Count > 0)
                {
                    int       recordCount = Convert.ToInt32(ds.Tables[2].Rows[0]["recordCount"].ToString().Trim());
                    int       pageCount   = Convert.ToInt32(ds.Tables[2].Rows[0]["pageCount"].ToString().Trim());
                    DataTable table       = sql.GetChinaName(ds.Tables[1]);
                    r_json = JsonMethod.GetDataTable(0, recordCount, pageCount, table, ds.Tables[1]);
                }
                else
                {
                    string error = "无数据";
                    r_json = JsonMethod.GetError(1, error);
                }
            }
            else
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int recordCount = 0;
                    int pageCount   = 0;
                    r_json = JsonMethod.GetDataTable(0, recordCount, pageCount, ds.Tables[0]);
                }
                else
                {
                    string error = "无数据";
                    r_json = JsonMethod.GetError(1, error);
                }
            }
            return(r_json);
        }
Beispiel #12
0
        /// <summary>
        /// 返回DataTable(渠道分类)
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string GetReturnJsonBox(string json, string proc, string typename, string userId, string entid)
        {
            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entid)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      ds    = sql.RunProcedureDR(proc, param);

            if (ds.Rows.Count > 0)
            {
                ///加载节点
                string    objList = "";
                DataTable dtc     = ds;
                if (dtc.Rows.Count > 0)
                {
                    switch (typename)
                    {
                    case "Pc_GetClassType":    //设备类型//应用范围
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["Code"] + "'>" + dr_c1["Name"] + "</option>";
                        }
                        break;

                    case "Pc_GetCouponType":    //领取类型
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["typeCoding"] + "'>" + dr_c1["typeName"] + "</option>";
                        }
                        break;

                    case "Pc_GetBrandType":    //品牌类型
                        var num = 0;
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            //;
                            objList += "<input type='checkbox' id='chkPpBox" + num + "' value='" + dr_c1["billno"] + "' title='" + dr_c1["name"] + "' />&nbsp;<label for='chkPpBox" + num + "''>" + dr_c1["name"] + "</label>&nbsp;&nbsp;&nbsp;&nbsp";
                            num++;
                        }
                        break;

                    case "Pc_GoodsGroup":    //商品分组
                        var n = 0;
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            //;
                            objList += "<input type='checkbox' id='chkPpBox" + n + "' value='" + dr_c1["billno"] + "' title='" + dr_c1["name"] + "' />&nbsp;<label for='chkPpBox" + n + "''>" + dr_c1["name"] + "</label>&nbsp;&nbsp;&nbsp;&nbsp";
                            n++;
                        }
                        break;

                    case "Pc_GetHelperType":
                    case "Pc_GetCateGoryType":    //分类类型
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["id"] + "'>" + dr_c1["title"] + "</option>";
                        }
                        break;

                    case "Pc_GetShengType":    //省
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["id"] + "'>" + dr_c1["name"] + "</option>";
                        }
                        break;

                    case "Pc_GetShiType":    //市
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["id"] + "'>" + dr_c1["name"] + "</option>";
                        }
                        break;

                    case "Pc_GetQuType":    //区
                        foreach (DataRow dr_c1 in dtc.Rows)
                        {
                            objList += "<option value='" + dr_c1["id"] + "'>" + dr_c1["name"] + "</option>";
                        }
                        break;

                    default:
                        break;
                    }
                }
                return("{\"flag\":\"0\",\"objList\":\"" + objList + "\"}");
            }
            else
            {
                string error = "无数据";
                return(JsonMethod.GetError(1, error));
            }
        }