/// <summary>
        /// 查找不存在的文件并删除已删除的附件及数据
        /// </summary>
        public void DeleteList(SqlConnection conn, SqlTransaction trans, List <Model.download_attach> models, int article_id)
        {
            StringBuilder idList = new StringBuilder();

            if (models != null)
            {
                foreach (Model.download_attach modelt in models)
                {
                    if (modelt.id > 0)
                    {
                        idList.Append(modelt.id + ",");
                    }
                }
            }
            string        id_list = HotoUtils.DelLastChar(idList.ToString(), ",");
            StringBuilder strSql  = new StringBuilder();

            strSql.Append("select id,file_path from dt_download_attach where article_id=" + article_id);
            if (!string.IsNullOrEmpty(id_list))
            {
                strSql.Append(" and id not in(" + id_list + ")");
            }
            DataSet ds = DbHelperSQL.Query(conn, trans, strSql.ToString());

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int rows = DbHelperSQL.ExecuteSql(conn, trans, "delete from dt_download_attach where id=" + dr["id"].ToString()); //删除数据库
                if (rows > 0)
                {
                    HotoUtils.DeleteFile(dr["file_path"].ToString()); //删除文件
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// ²éÕÒ²»´æÔÚµÄͼƬ²¢É¾³ýÒÑɾ³ýµÄͼƬ¼°Êý¾Ý
        /// </summary>
        public void DeleteList(SqlConnection conn, SqlTransaction trans, List <Model.article_albums> models, int article_id)
        {
            StringBuilder idList = new StringBuilder();

            if (models != null)
            {
                foreach (Model.article_albums modelt in models)
                {
                    if (modelt.id > 0)
                    {
                        idList.Append(modelt.id + ",");
                    }
                }
            }
            string        id_list = HotoUtils.DelLastChar(idList.ToString(), ",");
            StringBuilder strSql  = new StringBuilder();

            strSql.Append("select id,big_img,small_img from dt_article_albums where article_id=" + article_id);
            if (!string.IsNullOrEmpty(id_list))
            {
                strSql.Append(" and id not in(" + id_list + ")");
            }
            DataSet ds = DbHelperSQL.Query(conn, trans, strSql.ToString());

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int rows = DbHelperSQL.ExecuteSql(conn, trans, "delete from dt_article_albums where id=" + dr["id"].ToString()); //ɾ³ýÊý¾Ý¿â
                if (rows > 0)
                {
                    HotoUtils.DeleteFile(dr["big_img"].ToString());   //ɾ³ýԭͼ
                    HotoUtils.DeleteFile(dr["small_img"].ToString()); //ɾ³ýËõÂÔͼ
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// 获取OAuth配置信息
 /// </summary>
 /// <param name="oauth_name"></param>
 public static oauth_config get_config(string oauth_name)
 {
     //读取接口配置信息
     Model.app_oauth model = new BLL.app_oauth().GetModel(oauth_name);
     if (model != null)
     {
         //读取站点配置信息
         Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING);
         //赋值
         oauth_config config = new oauth_config();
         config.oauth_name    = model.api_path.Trim();
         config.oauth_app_id  = model.app_id.Trim();
         config.oauth_app_key = model.app_key.Trim();
         config.return_uri    = HotoUtils.DelLastChar(siteConfig.weburl, "/") + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx";
         return(config);
     }
     return(null);
 }
Beispiel #4
0
        public static string tenpay_notify = ""; //支付完成后的回调处理页面;

        static TenpayUtil()
        {
            //读取XML配置信息
            string      fullPath = HotoUtils.GetMapPath("~/xmlconfig/tenpay.config");
            XmlDocument doc      = new XmlDocument();

            doc.Load(fullPath);
            XmlNode _bargainor_id  = doc.SelectSingleNode(@"Root/bargainor_id");
            XmlNode _tenpay_key    = doc.SelectSingleNode(@"Root/tenpay_key");
            XmlNode _tenpay_return = doc.SelectSingleNode(@"Root/tenpay_return");
            XmlNode _tenpay_notify = doc.SelectSingleNode(@"Root/tenpay_notify");

            //读取站点配置信息
            Model.siteconfig model = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING);

            bargainor_id  = _bargainor_id.InnerText;
            tenpay_key    = _tenpay_key.InnerText;
            tenpay_return = HotoUtils.DelLastChar(model.weburl, "/") + _tenpay_return.InnerText;
            tenpay_notify = HotoUtils.DelLastChar(model.weburl, "/") + _tenpay_notify.InnerText;
        }
Beispiel #5
0
        static Config()
        {
            //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

            //读取XML配置信息
            string      fullPath = HotoUtils.GetMapPath("~/xmlconfig/alipay.config");
            XmlDocument doc      = new XmlDocument();

            doc.Load(fullPath);
            XmlNode _partner      = doc.SelectSingleNode(@"Root/partner");
            XmlNode _key          = doc.SelectSingleNode(@"Root/key");
            XmlNode _seller_email = doc.SelectSingleNode(@"Root/seller_email");
            XmlNode _return_url   = doc.SelectSingleNode(@"Root/return_url");
            XmlNode _notify_url   = doc.SelectSingleNode(@"Root/notify_url");

            //读取站点配置信息
            Model.siteconfig model = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING);

            //合作身份者ID,以2088开头由16位纯数字组成的字符串
            partner = _partner.InnerText;
            //交易安全检验码,由数字和字母组成的32位字符串
            key = _key.InnerText;
            //签约支付宝账号或卖家支付宝帐户
            seller_email = _seller_email.InnerText;
            //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            return_url = HotoUtils.DelLastChar(model.weburl, "/") + _return_url.InnerText;
            //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
            notify_url = HotoUtils.DelLastChar(model.weburl, "/") + _notify_url.InnerText;

            //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

            //字符编码格式 目前支持 gbk 或 utf-8
            input_charset = "utf-8";

            //签名方式 不需修改
            sign_type = "MD5";
        }
Beispiel #6
0
        /// <summary>
        /// 查找不存在的商品并删除
        /// </summary>
        private void DeleteGoodsList(SqlConnection conn, SqlTransaction trans, List <Model.order_goods> models, int order_id)
        {
            StringBuilder idList = new StringBuilder();

            if (models != null)
            {
                foreach (Model.order_goods modelt in models)
                {
                    if (modelt.id > 0)
                    {
                        idList.Append(modelt.id + ",");
                    }
                }
            }
            string        id_list = HotoUtils.DelLastChar(idList.ToString(), ",");
            StringBuilder strSql  = new StringBuilder();

            strSql.Append("delete from dt_order_goods where order_id=" + order_id);
            if (!string.IsNullOrEmpty(id_list))
            {
                strSql.Append(" and id not in(" + id_list + ")");
            }
            DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString());
        }
Beispiel #7
0
        /// <summary>
        /// 更新一条数据及其子表
        /// </summary>
        public bool Update(Model.manager_role model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dt_manager_role set ");
            strSql.Append("role_name=@role_name,");
            strSql.Append("role_type=@role_type");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",        SqlDbType.Int,        4),
                new SqlParameter("@role_name", SqlDbType.NVarChar, 100),
                new SqlParameter("@role_type", SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.role_name;
            parameters[2].Value = model.role_type;

            List <CommandInfo> sqllist = new List <CommandInfo>();
            CommandInfo        cmd     = new CommandInfo(strSql.ToString(), parameters);

            sqllist.Add(cmd);

            //删除权限
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("delete from dt_manager_role_value where role_id=@role_id ");
            StringBuilder idList = new StringBuilder();

            if (model.manager_role_values != null)
            {
                foreach (Model.manager_role_value models in model.manager_role_values)
                {
                    if (models.id > 0)
                    {
                        idList.Append(models.id + ",");
                    }
                }
                string id_list = HotoUtils.DelLastChar(idList.ToString(), ",");
                if (!string.IsNullOrEmpty(id_list))
                {
                    strSql2.Append(" and id not in(" + id_list + ")");
                }
            }
            SqlParameter[] parameters2 =
            {
                new SqlParameter("@role_id", SqlDbType.Int, 4)
            };
            parameters2[0].Value = model.id;

            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //添加权限
            if (model.manager_role_values != null)
            {
                StringBuilder strSql3;
                foreach (Model.manager_role_value models in model.manager_role_values)
                {
                    strSql3 = new StringBuilder();
                    if (models.id == 0)
                    {
                        strSql3.Append("insert into dt_manager_role_value(");
                        strSql3.Append("role_id,channel_name,channel_id,action_type)");
                        strSql3.Append(" values (");
                        strSql3.Append("@role_id,@channel_name,@channel_id,@action_type)");
                        SqlParameter[] parameters3 =
                        {
                            new SqlParameter("@role_id",      SqlDbType.Int,        4),
                            new SqlParameter("@channel_name", SqlDbType.NVarChar, 255),
                            new SqlParameter("@channel_id",   SqlDbType.Int,        4),
                            new SqlParameter("@action_type",  SqlDbType.NVarChar, 100)
                        };
                        parameters3[0].Value = model.id;
                        parameters3[1].Value = models.channel_name;
                        parameters3[2].Value = models.channel_id;
                        parameters3[3].Value = models.action_type;

                        cmd = new CommandInfo(strSql3.ToString(), parameters3);
                        sqllist.Add(cmd);
                    }
                }
            }

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }