Esempio n. 1
0
        /// <summary>
        /// 删除一条数据,及子表所有相关数据
        /// </summary>
        public bool Delete(int id)
        {
            List<CommandInfo> sqllist = new List<CommandInfo>();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from dt_manager_role ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = id;

            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("delete from dt_manager_role_value ");
            strSql2.Append(" where role_id=@role_id ");
            SqlParameter[] parameters2 = { new SqlParameter("@role_id", SqlDbType.Int, 4) };
            parameters2[0].Value = id;

            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);
            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.sys_model model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_sys_model(");
            strSql.Append("title,sort_id,inherit_index,inherit_list,inherit_detail,is_sys)");
            strSql.Append(" values (");
            strSql.Append("@title,@sort_id,@inherit_index,@inherit_list,@inherit_detail,@is_sys)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@inherit_index", SqlDbType.NVarChar, 255),
            new SqlParameter("@inherit_list", SqlDbType.NVarChar, 255),
            new SqlParameter("@inherit_detail", SqlDbType.NVarChar, 255),
            new SqlParameter("@is_sys", SqlDbType.TinyInt, 1),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.title;
            parameters[1].Value = model.sort_id;
            parameters[2].Value = model.inherit_index;
            parameters[3].Value = model.inherit_list;
            parameters[4].Value = model.inherit_detail;
            parameters[5].Value = model.is_sys;
            parameters[6].Direction = ParameterDirection.Output;
            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);

            //模型菜单
            if (model.sys_model_navs != null)
            {
                StringBuilder strSql2;
                foreach (Model.sys_model_nav models in model.sys_model_navs)
                {
                    strSql2 = new StringBuilder();
                    strSql2.Append("insert into dt_sys_model_nav(");
                    strSql2.Append("model_id,title,nav_url,sort_id)");
                    strSql2.Append(" values (");
                    strSql2.Append("@model_id,@title,@nav_url,@sort_id)");
                    SqlParameter[] parameters2 = { new SqlParameter("@model_id", SqlDbType.Int, 4),
                    new SqlParameter("@title", SqlDbType.NVarChar, 100),
                    new SqlParameter("@nav_url", SqlDbType.NVarChar, 255),
                    new SqlParameter("@sort_id", SqlDbType.Int, 4) };
                    parameters2[0].Direction = ParameterDirection.InputOutput;
                    parameters2[1].Value = models.title;
                    parameters2[2].Value = models.nav_url;
                    parameters2[3].Value = models.sort_id;

                    cmd = new CommandInfo(strSql2.ToString(), parameters2);
                    sqllist.Add(cmd);
                }
            }
            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[6].Value;
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.amount_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_amount_log(");
            strSql.Append("user_id,user_name,type,order_no,payment_id,value,remark,status,add_time,complete_time)");
            strSql.Append(" values (");
            strSql.Append("@user_id,@user_name,@type,@order_no,@payment_id,@value,@remark,@status,@add_time,@complete_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@user_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@type", SqlDbType.NVarChar, 50),
            new SqlParameter("@order_no", SqlDbType.NVarChar, 100),
            new SqlParameter("@payment_id", SqlDbType.Int, 4),
            new SqlParameter("@value", SqlDbType.Decimal, 5),
            new SqlParameter("@remark", SqlDbType.NVarChar, 500),
            new SqlParameter("@status", SqlDbType.TinyInt, 1),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@complete_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.type;
            parameters[3].Value = model.order_no;
            parameters[4].Value = model.payment_id;
            parameters[5].Value = model.value;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.status;
            parameters[8].Value = model.add_time;
            parameters[9].Value = model.complete_time;
            parameters[10].Direction = ParameterDirection.Output;

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

            if (model.status > 0)
            {
                StringBuilder strSql2 = new StringBuilder();
                strSql2.Append("update dt_users set amount=amount+" + model.value);
                strSql2.Append(" where id=@id");
                SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) };
                parameters2[0].Value = model.user_id;
                cmd = new CommandInfo(strSql2.ToString(), parameters2);
                sqllist.Add(cmd);
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[10].Value;
        }
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.report_service model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_report_service(");
            strSql.Append("[version],[equtype],[equname],[uniqucode],[network],[wifi_desc],[cookie_desc],[mac_address],[sim_operater],[add_time],service_name)");
            strSql.Append(" values (");
            strSql.Append("@version,@equtype,@equname,@uniqucode,@network,@wifi_desc,@cookie_desc,@mac_address,@sim_operater,@add_time,@service_name)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = {
                        new SqlParameter("@version", SqlDbType.VarChar, 20),
                        new SqlParameter("@equtype", SqlDbType.VarChar, 20),
                        new SqlParameter("@equname", SqlDbType.VarChar, 20),
                        new SqlParameter("@uniqucode", SqlDbType.VarChar, 20),
                        new SqlParameter("@network", SqlDbType.VarChar, 20),
                        new SqlParameter("@wifi_desc", SqlDbType.VarChar, 20),
                        new SqlParameter("@cookie_desc", SqlDbType.VarChar, 20),
                        new SqlParameter("@mac_address", SqlDbType.VarChar, 20),
                        new SqlParameter("@sim_operater", SqlDbType.VarChar, 20),
                        new SqlParameter("@add_time", SqlDbType.DateTime),
                        new SqlParameter("@service_name",  SqlDbType.VarChar, 50),
                        new SqlParameter("@ReturnValue", SqlDbType.Int)

            };
            parameters[0].Value = model.version;
            parameters[1].Value = model.equtype;
            parameters[2].Value = model.equname;
            parameters[3].Value = model.uniqucode;
            parameters[4].Value = model.network;
            parameters[5].Value = model.wifi_desc;
            parameters[6].Value = model.cookie_desc;
            parameters[7].Value = model.mac_address;
            parameters[8].Value = model.sim_operater;
            parameters[9].Value = model.add_time;
            parameters[10].Value = model.service_name;
            parameters[11].Direction = ParameterDirection.Output;

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

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[11].Value;
        }
Esempio n. 5
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.contact model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_contact(");
            strSql.Append("title,  address,  shop_hours,  telephone,  mobile,  remark1,  remark2,  sort_id,  add_time  )");
            strSql.Append(" values (");
            strSql.Append("@title  ,@address  ,@shop_hours  ,@telephone  ,@mobile  ,@remark1  ,@remark2  ,@sort_id  ,@add_time  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters =
                {
                     new SqlParameter("@title",SqlDbType.NVarChar,50 ),
                     new SqlParameter("@address",SqlDbType.NVarChar,255 ),
                     new SqlParameter("@shop_hours",SqlDbType.NVarChar,50 ),
                     new SqlParameter("@telephone",SqlDbType.NVarChar,20 ),
                     new SqlParameter("@mobile",SqlDbType.NVarChar,20 ),
                     new SqlParameter("@remark1",SqlDbType.NVarChar,50 ),
                     new SqlParameter("@remark2",SqlDbType.Int ),
                     new SqlParameter("@sort_id",SqlDbType.Int ),
                     new SqlParameter("@add_time",SqlDbType.DateTime ),
                    new SqlParameter("@ReturnValue", SqlDbType.Int)
                  };

            parameters[0].Value = model.title;
            parameters[1].Value = model.address;
            parameters[2].Value = model.shop_hours;
            parameters[3].Value = model.telephone;
            parameters[4].Value = model.mobile;
            parameters[5].Value = model.remark1;
            parameters[6].Value = model.remark2;
            parameters[7].Value = model.sort_id;
            parameters[8].Value = model.add_time;

            parameters[9].Direction = ParameterDirection.Output;

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

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[9].Value;
        }
Esempio n. 6
0
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.manager_role model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_manager_role(");
            strSql.Append("role_name,role_type)");
            strSql.Append(" values (");
            strSql.Append("@role_name,@role_type)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@role_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@role_type", SqlDbType.TinyInt, 1),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.role_name;
            parameters[1].Value = model.role_type;
            parameters[2].Direction = ParameterDirection.Output;

            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);
            StringBuilder strSql2;
            foreach (Model.manager_role_value models in model.manager_role_values)
            {
                strSql2 = new StringBuilder();
                strSql2.Append("insert into dt_manager_role_value(");
                strSql2.Append("role_id,channel_name,channel_id,action_type)");
                strSql2.Append(" values (");
                strSql2.Append("@role_id,@channel_name,@channel_id,@action_type)");
                SqlParameter[] parameters2 = { 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) };
                parameters2[0].Direction = ParameterDirection.InputOutput;
                parameters2[1].Value = models.channel_name;
                parameters2[2].Value = models.channel_id;
                parameters2[3].Value = models.action_type;

                cmd = new CommandInfo(strSql2.ToString(), parameters2);
                sqllist.Add(cmd);
            }
            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[2].Value;
        }
Esempio n. 7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.point_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_point_log(");
            strSql.Append("user_id,user_name,value,remark,add_time)");
            strSql.Append(" values (");
            strSql.Append("@user_id,@user_name,@value,@remark,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@user_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@value", SqlDbType.Int, 4),
            new SqlParameter("@remark", SqlDbType.NVarChar, 500),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.value;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.add_time;
            parameters[5].Direction = ParameterDirection.Output;

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

            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("update dt_users set point=point+" + model.value);
            if (model.value > 0)
            {
                strSql2.Append(",exp=exp+" + model.value);
            }
            strSql2.Append(" where id=@id");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters2[0].Value = model.user_id;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[5].Value;
        }
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.redpacket_guid model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_redpacket_guid(");
            strSql.Append("guid_id,  redpacket_id,  status,  unique_code,  apply_time,  remark1,  remark2  )");
            strSql.Append(" values (");
            strSql.Append("@guid_id  ,@redpacket_id  ,@status  ,@unique_code  ,@apply_time  ,@remark1  ,@remark2  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters =
                {
                     new SqlParameter("@guid_id",SqlDbType.Int ),
                     new SqlParameter("@redpacket_id",SqlDbType.Int ),
                     new SqlParameter("@status",SqlDbType.Int ),
                     new SqlParameter("@unique_code",SqlDbType.NVarChar ),
                     new SqlParameter("@apply_time",SqlDbType.DateTime ),
                     new SqlParameter("@remark1",SqlDbType.NVarChar ),
                     new SqlParameter("@remark2",SqlDbType.Int ),
                    new SqlParameter("@ReturnValue", SqlDbType.Int)
                  };

            parameters[0].Value = model.guid_id;
            parameters[1].Value = model.redpacket_id;
            parameters[2].Value = model.status;
            parameters[3].Value = model.unique_code;
            parameters[4].Value = model.apply_time;
            parameters[5].Value = model.remark1;
            parameters[6].Value = model.remark2;

            parameters[7].Direction = ParameterDirection.Output;

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

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[7].Value;
        }
Esempio n. 9
0
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.article_news model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_article(");
            strSql.Append("channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@category_id,@title,@link_url,@img_url,@seo_title,@seo_keywords,@seo_description,@content,@sort_id,@click,@is_lock,@user_id,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@category_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_title", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_keywords", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
            new SqlParameter("@content", SqlDbType.NText),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@click", SqlDbType.Int, 4),
            new SqlParameter("@is_lock", SqlDbType.TinyInt, 1),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.seo_title;
            parameters[6].Value = model.seo_keywords;
            parameters[7].Value = model.seo_description;
            parameters[8].Value = model.content;
            parameters[9].Value = model.sort_id;
            parameters[10].Value = model.click;
            parameters[11].Value = model.is_lock;
            parameters[12].Value = model.user_id;
            parameters[13].Value = model.add_time;
            parameters[14].Direction = ParameterDirection.Output;

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

            //副表信息
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("insert into dt_article_news(");
            strSql2.Append("id,author,[from],zhaiyao,is_msg,is_top,is_red,is_hot,is_slide,is_publish)");
            strSql2.Append(" values (");
            strSql2.Append("@id,@author,@from,@zhaiyao,@is_msg,@is_top,@is_red,@is_hot,@is_slide,@is_publish)");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@author", SqlDbType.NVarChar, 100),
            new SqlParameter("@from", SqlDbType.NVarChar, 50),
            new SqlParameter("@zhaiyao", SqlDbType.NVarChar, 255),
            new SqlParameter("@is_msg", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_top", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_red", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_hot", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_slide", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_publish", SqlDbType.TinyInt, 1) };
            parameters2[0].Direction = ParameterDirection.InputOutput;
            parameters2[1].Value = model.author;
            parameters2[2].Value = model.from;
            parameters2[3].Value = model.zhaiyao;
            parameters2[4].Value = model.is_msg;
            parameters2[5].Value = model.is_top;
            parameters2[6].Value = model.is_red;
            parameters2[7].Value = model.is_hot;
            parameters2[8].Value = model.is_slide;
            parameters2[9].Value = model.is_publish;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //顶和踩
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("insert into dt_article_diggs(");
            strSql3.Append("id,digg_good,digg_bad)");
            strSql3.Append(" values (");
            strSql3.Append("@id,@digg_good,@digg_bad)");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@digg_good", SqlDbType.Int, 4),
            new SqlParameter("@digg_bad", SqlDbType.Int, 4) };
            parameters3[0].Direction = ParameterDirection.InputOutput;
            parameters3[1].Value = model.digg_good;
            parameters3[2].Value = model.digg_bad;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //图片相册
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_article_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@big_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@small_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@remark", SqlDbType.NVarChar, 500) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }
            //扩展属性
            if (model.attribute_values != null)
            {
                StringBuilder strSql5;
                foreach (Model.attribute_value models in model.attribute_values)
                {
                    strSql5 = new StringBuilder();
                    strSql5.Append("insert into dt_attribute_value(");
                    strSql5.Append("article_id,attribute_id,title,content)");
                    strSql5.Append(" values (");
                    strSql5.Append("@article_id,@attribute_id,@title,@content)");
                    SqlParameter[] parameters5 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@attribute_id", SqlDbType.Int, 4),
                    new SqlParameter("@title", SqlDbType.NVarChar, 100),
                    new SqlParameter("@content", SqlDbType.NText) };
                    parameters5[0].Direction = ParameterDirection.InputOutput;
                    parameters5[1].Value = models.attribute_id;
                    parameters5[2].Value = models.title;
                    parameters5[3].Value = models.content;
                    cmd = new CommandInfo(strSql5.ToString(), parameters5);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[14].Value;
        }
Esempio n. 10
0
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.orders model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_orders(");
            strSql.Append("order_no,user_id,user_name,payment_id,distribution_id,status,payment_status,distribution_status,delivery_name,delivery_no,accept_name,post_code,telphone,mobile,address,message,payable_amount,real_amount,payable_freight,real_freight,payment_fee,order_amount,point,add_time,payment_time,confirm_time,distribution_time,complete_time)");
            strSql.Append(" values (");
            strSql.Append("@order_no,@user_id,@user_name,@payment_id,@distribution_id,@status,@payment_status,@distribution_status,@delivery_name,@delivery_no,@accept_name,@post_code,@telphone,@mobile,@address,@message,@payable_amount,@real_amount,@payable_freight,@real_freight,@payment_fee,@order_amount,@point,@add_time,@payment_time,@confirm_time,@distribution_time,@complete_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@order_no", SqlDbType.NVarChar, 100),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@user_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@payment_id", SqlDbType.Int, 4),
            new SqlParameter("@distribution_id", SqlDbType.Int, 4),
            new SqlParameter("@status", SqlDbType.TinyInt, 1),
            new SqlParameter("@payment_status", SqlDbType.TinyInt, 1),
            new SqlParameter("@distribution_status", SqlDbType.TinyInt, 1),
            new SqlParameter("@delivery_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@delivery_no", SqlDbType.NVarChar, 100),
            new SqlParameter("@accept_name", SqlDbType.NVarChar, 50),
            new SqlParameter("@post_code", SqlDbType.NVarChar, 20),
            new SqlParameter("@telphone", SqlDbType.NVarChar, 30),
            new SqlParameter("@mobile", SqlDbType.NVarChar, 30),
            new SqlParameter("@address", SqlDbType.NVarChar, 255),
            new SqlParameter("@message", SqlDbType.NVarChar, 500),
            new SqlParameter("@payable_amount", SqlDbType.Decimal, 5),
            new SqlParameter("@real_amount", SqlDbType.Decimal, 5),
            new SqlParameter("@payable_freight", SqlDbType.Decimal, 5),
            new SqlParameter("@real_freight", SqlDbType.Decimal, 5),
            new SqlParameter("@payment_fee", SqlDbType.Decimal, 5),
            new SqlParameter("@order_amount", SqlDbType.Decimal, 5),
            new SqlParameter("@point", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@payment_time", SqlDbType.DateTime),
            new SqlParameter("@confirm_time", SqlDbType.DateTime),
            new SqlParameter("@distribution_time", SqlDbType.DateTime),
            new SqlParameter("@complete_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.order_no;
            parameters[1].Value = model.user_id;
            parameters[2].Value = model.user_name;
            parameters[3].Value = model.payment_id;
            parameters[4].Value = model.distribution_id;
            parameters[5].Value = model.status;
            parameters[6].Value = model.payment_status;
            parameters[7].Value = model.distribution_status;
            parameters[8].Value = model.delivery_name;
            parameters[9].Value = model.delivery_no;
            parameters[10].Value = model.accept_name;
            parameters[11].Value = model.post_code;
            parameters[12].Value = model.telphone;
            parameters[13].Value = model.mobile;
            parameters[14].Value = model.address;
            parameters[15].Value = model.message;
            parameters[16].Value = model.payable_amount;
            parameters[17].Value = model.real_amount;
            parameters[18].Value = model.payable_freight;
            parameters[19].Value = model.real_freight;
            parameters[20].Value = model.payment_fee;
            parameters[21].Value = model.order_amount;
            parameters[22].Value = model.point;
            parameters[23].Value = model.add_time;
            parameters[24].Value = model.payment_time;
            parameters[25].Value = model.confirm_time;
            parameters[26].Value = model.distribution_time;
            parameters[27].Value = model.complete_time;
            parameters[28].Direction = ParameterDirection.Output;

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

            //订单商品列表
            if (model.order_goods != null)
            {
                StringBuilder strSql2;
                foreach (Model.order_goods models in model.order_goods)
                {
                    strSql2 = new StringBuilder();
                    strSql2.Append("insert into dt_order_goods(");
                    strSql2.Append("order_id,goods_id,goods_name,goods_price,real_price,quantity,point,unique_code,status,menpiao_type)");
                    strSql2.Append(" values (");
                    strSql2.Append("@order_id,@goods_id,@goods_name,@goods_price,@real_price,@quantity,@point,@unique_code,@status,@menpiao_type)");
                    SqlParameter[] parameters2 = { new SqlParameter("@order_id", SqlDbType.Int, 4),
                    new SqlParameter("@goods_id", SqlDbType.Int, 4),
                    new SqlParameter("@goods_name", SqlDbType.NVarChar, 100),
                    new SqlParameter("@goods_price", SqlDbType.Decimal, 5),
                    new SqlParameter("@real_price", SqlDbType.Decimal, 5),
                    new SqlParameter("@quantity", SqlDbType.Int, 4),
                    new SqlParameter("@point", SqlDbType.Int, 4),
                    new SqlParameter("@unique_code", SqlDbType.VarChar, 20),
                    new SqlParameter("@status", SqlDbType.Int, 4),
                    new SqlParameter("@menpiao_type", SqlDbType.Int, 4)};
                    parameters2[0].Direction = ParameterDirection.InputOutput;
                    parameters2[1].Value = models.goods_id;
                    parameters2[2].Value = models.goods_name;
                    parameters2[3].Value = models.goods_price;
                    parameters2[4].Value = models.real_price;
                    parameters2[5].Value = models.quantity;
                    parameters2[6].Value = models.point;
                    parameters2[7].Value = models.unique_code;
                    parameters2[8].Value = models.status;
                    parameters2[9].Value = models.menpiao_type;
                    cmd = new CommandInfo(strSql2.ToString(), parameters2);
                    sqllist.Add(cmd);
                }
            }
            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[28].Value;
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.article_content model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update dt_article set ");
            strSql.Append("channel_id=@channel_id,");
            strSql.Append("category_id=@category_id,");
            strSql.Append("title=@title,");
            strSql.Append("link_url=@link_url,");
            strSql.Append("img_url=@img_url,");
            strSql.Append("seo_title=@seo_title,");
            strSql.Append("seo_keywords=@seo_keywords,");
            strSql.Append("seo_description=@seo_description,");
            strSql.Append("content=@content,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("click=@click,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("user_id=@user_id,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@category_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_title", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_keywords", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
            new SqlParameter("@content", SqlDbType.NText),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@click", SqlDbType.Int, 4),
            new SqlParameter("@is_lock", SqlDbType.TinyInt, 1),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.seo_title;
            parameters[6].Value = model.seo_keywords;
            parameters[7].Value = model.seo_description;
            parameters[8].Value = model.content;
            parameters[9].Value = model.sort_id;
            parameters[10].Value = model.click;
            parameters[11].Value = model.is_lock;
            parameters[12].Value = model.user_id;
            parameters[13].Value = model.add_time;
            parameters[14].Value = model.id;

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

            //修改副表
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("update dt_article_content set ");
            strSql2.Append("id=@id,");
            strSql2.Append("call_index=@call_index,");
            strSql2.Append("is_msg=@is_msg,");
            strSql2.Append("is_red=@is_red");
            strSql2.Append(" where id=@id ");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@call_index", SqlDbType.NVarChar, 50),
            new SqlParameter("@is_msg", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_red", SqlDbType.TinyInt, 1) };
            parameters2[0].Value = model.id;
            parameters2[1].Value = model.call_index;
            parameters2[2].Value = model.is_msg;
            parameters2[3].Value = model.is_red;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //修改顶和踩
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("update dt_article_diggs set ");
            strSql3.Append("digg_good=@digg_good,");
            strSql3.Append("digg_bad=@digg_bad");
            strSql3.Append(" where id=@id ");
            SqlParameter[] parameters3 = { new SqlParameter("@digg_good", SqlDbType.Int, 4),
            new SqlParameter("@digg_bad", SqlDbType.Int, 4),
            new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters3[0].Value = model.digg_good;
            parameters3[1].Value = model.digg_bad;
            parameters3[2].Value = model.id;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.goods model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_goods(");
            strSql.Append("channel_id,  category_id,  title,  link_url,  img_url,  content,  sell_time,  phone,  mobilephone,  city_id,  address,  lat,  lng,  type_id,  rtype_id,  discount,  avg_price,  market_price,  sell_price,  status,  sort_id,  begin_date,  end_date,  good_limit,  add_time,  is_top,  is_slide,  is_red,  remark1,  remark2,old_price ,contact  )");
            strSql.Append(" values (");
            strSql.Append("@channel_id  ,@category_id  ,@title  ,@link_url  ,@img_url  ,@content  ,@sell_time  ,@phone  ,@mobilephone  ,@city_id  ,@address  ,@lat  ,@lng  ,@type_id  ,@rtype_id  ,@discount  ,@avg_price  ,@market_price  ,@sell_price  ,@status  ,@sort_id  ,@begin_date  ,@end_date  ,@good_limit  ,@add_time  ,@is_top  ,@is_slide  ,@is_red  ,@remark1  ,@remark2,@old_price,@contact  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int ),
            new SqlParameter("@category_id", SqlDbType.Int ),
            new SqlParameter("@title", SqlDbType.NVarChar ),
            new SqlParameter("@link_url", SqlDbType.NVarChar ),
            new SqlParameter("@img_url", SqlDbType.NVarChar ),
            new SqlParameter("@content", SqlDbType.NText ),
            new SqlParameter("@sell_time", SqlDbType.NVarChar ),
            new SqlParameter("@phone", SqlDbType.NVarChar ),
            new SqlParameter("@mobilephone", SqlDbType.NVarChar ),
            new SqlParameter("@city_id", SqlDbType.Int ),
            new SqlParameter("@address", SqlDbType.NVarChar ),
            new SqlParameter("@lat", SqlDbType.NVarChar ),
            new SqlParameter("@lng", SqlDbType.NVarChar ),
            new SqlParameter("@type_id", SqlDbType.Int ),
            new SqlParameter("@rtype_id", SqlDbType.Int ),
            new SqlParameter("@discount", SqlDbType.Int ),
            new SqlParameter("@avg_price", SqlDbType.Decimal ),
            new SqlParameter("@market_price", SqlDbType.Decimal ),
            new SqlParameter("@sell_price", SqlDbType.Decimal ),
            new SqlParameter("@status", SqlDbType.Int ),
            new SqlParameter("@sort_id", SqlDbType.Int ),
            new SqlParameter("@begin_date", SqlDbType.NVarChar ),
            new SqlParameter("@end_date", SqlDbType.NVarChar ),
            new SqlParameter("@good_limit", SqlDbType.Int ),
            new SqlParameter("@add_time", SqlDbType.DateTime ),
            new SqlParameter("@is_top", SqlDbType.Int ),
            new SqlParameter("@is_slide", SqlDbType.Int ),
            new SqlParameter("@is_red", SqlDbType.Int ),
            new SqlParameter("@remark1", SqlDbType.NVarChar ),
            new SqlParameter("@remark2", SqlDbType.Int ),
             new SqlParameter("@old_price", SqlDbType.Decimal ),
               new SqlParameter("@contact", SqlDbType.NVarChar ),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };

            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.content;
            parameters[6].Value = model.sell_time;
            parameters[7].Value = model.phone;
            parameters[8].Value = model.mobilephone;
            parameters[9].Value = model.city_id;
            parameters[10].Value = model.address;
            parameters[11].Value = model.lat;
            parameters[12].Value = model.lng;
            parameters[13].Value = model.type_id;
            parameters[14].Value = model.rtype_id;
            parameters[15].Value = model.discount;
            parameters[16].Value = model.avg_price;
            parameters[17].Value = model.market_price;
            parameters[18].Value = model.sell_price;
            parameters[19].Value = model.status;
            parameters[20].Value = model.sort_id;
            parameters[21].Value = model.begin_date;
            parameters[22].Value = model.end_date;
            parameters[23].Value = model.good_limit;
            parameters[24].Value = model.add_time;
            parameters[25].Value = model.is_top;
            parameters[26].Value = model.is_slide;
            parameters[27].Value = model.is_red;
            parameters[28].Value = model.remark1;
            parameters[29].Value = model.remark2;
            parameters[30].Value = model.old_price;
            parameters[31].Value = model.contact;
            parameters[32].Direction = ParameterDirection.Output;

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

            ////????
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.goods_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_goods_albums(");
                    strSql4.Append("good_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@good_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = { new SqlParameter("@good_id", SqlDbType.Int, 4),
                    new SqlParameter("@big_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@small_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@remark", SqlDbType.NVarChar, 500) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[31].Value;
        }
Esempio n. 13
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.tourgroup model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_group(");
            strSql.Append("channel_id,  manager_id,  category_id,  title,  group_property,  sex,  people_count,  start_date,  end_date,  total_count,  is_stay,  book_require,  language_type,  ticket_type,  restaurant_type,  account_type,  linecity_id,  fromplace_id, toplace_id, service_price,  status,  content,  add_time,  description,  is_top,  is_slide,  is_red,  remark1,  remark2,sort_id  )");
            strSql.Append(" values (");
            strSql.Append("@channel_id  ,@manager_id  ,@category_id  ,@title  ,@group_property  ,@sex  ,@people_count  ,@start_date  ,@end_date  ,@total_count   ,@is_stay  ,@book_require  ,@language_type  ,@ticket_type  ,@restaurant_type  ,@account_type  ,@linecity_id  ,@fromplace_id  ,@toplace_id,@service_price  ,@status  ,@content  ,@add_time  ,@description  ,@is_top  ,@is_slide  ,@is_red  ,@remark1  ,@remark2,@sort_id  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int ),
            new SqlParameter("@manager_id", SqlDbType.Int ),
            new SqlParameter("@category_id", SqlDbType.Int ),
            new SqlParameter("@title", SqlDbType.NVarChar ),
            new SqlParameter("@group_property", SqlDbType.Int ),
            new SqlParameter("@sex", SqlDbType.Int ),
            new SqlParameter("@people_count", SqlDbType.Int ),
            new SqlParameter("@start_date", SqlDbType.NVarChar ),
            new SqlParameter("@end_date", SqlDbType.NVarChar ),
            new SqlParameter("@total_count", SqlDbType.Int ),

            new SqlParameter("@is_stay", SqlDbType.Int ),
            new SqlParameter("@book_require", SqlDbType.NVarChar ),
            new SqlParameter("@language_type", SqlDbType.Int ),
            new SqlParameter("@ticket_type", SqlDbType.Int ),
            new SqlParameter("@restaurant_type", SqlDbType.Int ),
            new SqlParameter("@account_type", SqlDbType.Int ),
            new SqlParameter("@linecity_id", SqlDbType.Int ),
            new SqlParameter("@fromplace_id", SqlDbType.Int ),
            new SqlParameter("@toplace_id", SqlDbType.Int ),
            new SqlParameter("@service_price", SqlDbType.Decimal ),
            new SqlParameter("@status", SqlDbType.Int ),
            new SqlParameter("@content", SqlDbType.NVarChar ),
            new SqlParameter("@add_time", SqlDbType.DateTime ),
            new SqlParameter("@description", SqlDbType.NVarChar ),
            new SqlParameter("@is_top", SqlDbType.Int ),
            new SqlParameter("@is_slide", SqlDbType.Int ),
            new SqlParameter("@is_red", SqlDbType.Int ),
            new SqlParameter("@remark1", SqlDbType.NVarChar ),
            new SqlParameter("@remark2", SqlDbType.Int ),
            new SqlParameter("@sort_id", SqlDbType.Int ),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };

            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.manager_id;
            parameters[2].Value = model.category_id;
            parameters[3].Value = model.title;
            parameters[4].Value = model.group_property;
            parameters[5].Value = model.sex;
            parameters[6].Value = model.people_count;
            parameters[7].Value = model.start_date;
            parameters[8].Value = model.end_date;
            parameters[9].Value = model.total_count;

            parameters[10].Value = model.is_stay;
            parameters[11].Value = model.book_require;
            parameters[12].Value = model.language_type;
            parameters[13].Value = model.ticket_type;
            parameters[14].Value = model.restaurant_type;
            parameters[15].Value = model.account_type;
            parameters[16].Value = model.linecity_id;
            parameters[17].Value = model.fromplace_id;
            parameters[18].Value = model.toplace_id;
            parameters[19].Value = model.service_price;
            parameters[20].Value = model.status;
            parameters[21].Value = model.content;
            parameters[22].Value = model.add_time;
            parameters[23].Value = model.description;
            parameters[24].Value = model.is_top;
            parameters[25].Value = model.is_slide;
            parameters[26].Value = model.is_red;
            parameters[27].Value = model.remark1;
            parameters[28].Value = model.remark2;
            parameters[29].Value = model.sort_id;
            parameters[30].Direction = ParameterDirection.Output;

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

            ////????
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_skindetect_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@big_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@small_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@remark", SqlDbType.NVarChar, 500) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[30].Value;
        }
Esempio n. 14
0
        /// <summary>
        /// 删除一条数据,及子表所有相关数据
        /// </summary>
        public bool Delete(int id)
        {
            //取得相册MODEL
            List<Model.article_albums> albumsList = new article_albums().GetList(id);
            //取得附件MODEL
            List<Model.download_attach> attachList = new download_attach().GetList(id);

            List<CommandInfo> sqllist = new List<CommandInfo>();
            //删除文章模型数据
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from dt_article_news ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = id;
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);

            ////删除下载模型数据
            //StringBuilder strSql2 = new StringBuilder();
            //strSql2.Append("delete from dt_article_download ");
            //strSql2.Append(" where id=@id ");
            //SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            //parameters2[0].Value = id;
            //cmd = new CommandInfo(strSql2.ToString(), parameters2);
            //sqllist.Add(cmd);

            //删除商品模型数据
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("delete from dt_article_goods ");
            strSql3.Append(" where id=@id ");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters3[0].Value = id;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //删除内容模型数据
            StringBuilder strSql4 = new StringBuilder();
            strSql4.Append("delete from dt_article_content ");
            strSql4.Append(" where id=@id ");
            SqlParameter[] parameters4 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters4[0].Value = id;
            cmd = new CommandInfo(strSql4.ToString(), parameters4);
            sqllist.Add(cmd);

            //删除顶和踩
            StringBuilder strSql5 = new StringBuilder();
            strSql5.Append("delete from dt_article_diggs ");
            strSql5.Append(" where id=@id ");
            SqlParameter[] parameters5 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters5[0].Value = id;
            cmd = new CommandInfo(strSql5.ToString(), parameters5);
            sqllist.Add(cmd);

            ////删除商品价格
            //StringBuilder strSql6 = new StringBuilder();
            //strSql6.Append("delete from dt_goods_group_price ");
            //strSql6.Append(" where article_id=@article_id ");
            //SqlParameter[] parameters6 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            //parameters6[0].Value = id;
            //cmd = new CommandInfo(strSql6.ToString(), parameters6);
            //sqllist.Add(cmd);

            ////删除下载的附件
            //StringBuilder strSql7 = new StringBuilder();
            //strSql7.Append("delete from dt_download_attach ");
            //strSql7.Append(" where article_id=@article_id ");
            //SqlParameter[] parameters7 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            //parameters7[0].Value = id;
            //cmd = new CommandInfo(strSql7.ToString(), parameters7);
            //sqllist.Add(cmd);

            //删除图片相册
            StringBuilder strSql8 = new StringBuilder();
            strSql8.Append("delete from dt_article_albums ");
            strSql8.Append(" where article_id=@article_id ");
            SqlParameter[] parameters8 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            parameters8[0].Value = id;
            cmd = new CommandInfo(strSql8.ToString(), parameters8);
            sqllist.Add(cmd);

            ////删除扩展属性
            //StringBuilder strSql9 = new StringBuilder();
            //strSql9.Append("delete from dt_attribute_value ");
            //strSql9.Append(" where article_id=@article_id ");
            //SqlParameter[] parameters9 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            //parameters9[0].Value = id;
            //cmd = new CommandInfo(strSql9.ToString(), parameters9);
            //sqllist.Add(cmd);

            ////删除评论
            //StringBuilder strSql10 = new StringBuilder();
            //strSql10.Append("delete from dt_article_comment ");
            //strSql10.Append(" where article_id=@article_id ");
            //SqlParameter[] parameters10 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            //parameters10[0].Value = id;
            //cmd = new CommandInfo(strSql10.ToString(), parameters10);
            //sqllist.Add(cmd);

            //删除大黄页
            StringBuilder strSql10 = new StringBuilder();
            strSql10.Append("delete from dt_article_company ");
            strSql10.Append(" where id=@id ");
            SqlParameter[] parameters10 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters10[0].Value = id;
            cmd = new CommandInfo(strSql10.ToString(), parameters10);
            sqllist.Add(cmd);

            //删除主表信息
            StringBuilder strSql11 = new StringBuilder();
            strSql11.Append("delete from dt_article ");
            strSql11.Append(" where id=@id ");
            SqlParameter[] parameters11 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters11[0].Value = id;
            cmd = new CommandInfo(strSql11.ToString(), parameters11);
            sqllist.Add(cmd);

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                new article_albums().DeleteFile(albumsList); //删除图片
                new download_attach().DeleteFile(attachList); //删除附件
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.guidaudio model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_guidaudio(");
            strSql.Append("channel_id,  audio_name,  audio_path,  content,  audio_time,  audio_size,  is_free,  add_time,  is_top,  is_slide,  is_red,  remark1,  remark2,  img_url,sort_id  )");
            strSql.Append(" values (");
            strSql.Append("@channel_id  ,@audio_name  ,@audio_path  ,@content  ,@audio_time  ,@audio_size  ,@is_free  ,@add_time  ,@is_top  ,@is_slide  ,@is_red  ,@remark1  ,@remark2  ,@img_url,@sort_id  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int ),
            new SqlParameter("@audio_name", SqlDbType.NVarChar ),
            new SqlParameter("@audio_path", SqlDbType.NVarChar ),
            new SqlParameter("@content", SqlDbType.NVarChar ),
            new SqlParameter("@audio_time", SqlDbType.NVarChar ),
            new SqlParameter("@audio_size", SqlDbType.NVarChar ),
            new SqlParameter("@is_free", SqlDbType.Int ),
            new SqlParameter("@add_time", SqlDbType.DateTime ),
            new SqlParameter("@is_top", SqlDbType.Int ),
            new SqlParameter("@is_slide", SqlDbType.Int ),
            new SqlParameter("@is_red", SqlDbType.Int ),
            new SqlParameter("@remark1", SqlDbType.NVarChar ),
            new SqlParameter("@remark2", SqlDbType.Int ),
            new SqlParameter("@img_url", SqlDbType.NVarChar ),
            new SqlParameter("@sort_id", SqlDbType.Int ),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };

            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.audio_name;
            parameters[2].Value = model.audio_path;
            parameters[3].Value = model.content;
            parameters[4].Value = model.audio_time;
            parameters[5].Value = model.audio_size;
            parameters[6].Value = model.is_free;
            parameters[7].Value = model.add_time;
            parameters[8].Value = model.is_top;
            parameters[9].Value = model.is_slide;
            parameters[10].Value = model.is_red;
            parameters[11].Value = model.remark1;
            parameters[12].Value = model.remark2;
            parameters[13].Value = model.img_url;
            parameters[14].Value = model.sort_id;
            parameters[15].Direction = ParameterDirection.Output;

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

            ////????
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_skindetect_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@big_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@small_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@remark", SqlDbType.NVarChar, 500) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[15].Value;
        }
Esempio n. 16
0
        /// <summary>
        /// 删除
        /// </summary>
        public bool Delete(int id)
        {
            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = null;

            //删除主表
            StringBuilder strSql11 = new StringBuilder();
            strSql11.Append("delete from [dt_contact] ");
            strSql11.Append(" where id=@id ");
            SqlParameter[] parameters11 = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters11[0].Value = id;
            cmd = new CommandInfo(strSql11.ToString(), parameters11);
            sqllist.Add(cmd);

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 17
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 = Utils.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;
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.amount_log model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update dt_amount_log set ");
            strSql.Append("user_id=@user_id,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("type=@type,");
            strSql.Append("order_no=@order_no,");
            strSql.Append("payment_id=@payment_id,");
            strSql.Append("value=@value,");
            strSql.Append("remark=@remark,");
            strSql.Append("status=@status,");
            strSql.Append("add_time=@add_time,");
            strSql.Append("complete_time=@complete_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = { new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@user_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@type", SqlDbType.NVarChar, 50),
            new SqlParameter("@order_no", SqlDbType.NVarChar, 100),
            new SqlParameter("@payment_id", SqlDbType.Int, 4),
            new SqlParameter("@value", SqlDbType.Decimal, 5),
            new SqlParameter("@remark", SqlDbType.NVarChar, 500),
            new SqlParameter("@status", SqlDbType.TinyInt, 1),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@complete_time", SqlDbType.DateTime),
            new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.type;
            parameters[3].Value = model.order_no;
            parameters[4].Value = model.payment_id;
            parameters[5].Value = model.value;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.status;
            parameters[8].Value = model.add_time;
            parameters[9].Value = model.complete_time;
            parameters[10].Value = model.id;

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

            if (model.status > 0)
            {
                StringBuilder strSql2 = new StringBuilder();
                strSql2.Append("update dt_users set amount=amount+" + model.value);
                strSql2.Append(" where id=@id");
                SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) };
                parameters2[0].Value = model.user_id;
                cmd = new CommandInfo(strSql2.ToString(), parameters2);
                sqllist.Add(cmd);
            }

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(Model.redpacket model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_redpacket(");
            strSql.Append("channel_id,  title,  content,  market_price,  sell_price,  total_count,  start_date,  end_date,  add_time,  status,  is_top,  is_slide,  is_red,  sort_id,  remark1,  remark2,  img_url  )");
            strSql.Append(" values (");
            strSql.Append("@channel_id  ,@title  ,@content  ,@market_price  ,@sell_price  ,@total_count ,@start_date  ,@end_date  ,@add_time  ,@status  ,@is_top  ,@is_slide  ,@is_red  ,@sort_id  ,@remark1  ,@remark2  ,@img_url  )");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters =
                {
                     new SqlParameter("@channel_id",SqlDbType.Int ),
                     new SqlParameter("@title",SqlDbType.NVarChar ),
                     new SqlParameter("@content",SqlDbType.NVarChar ),
                     new SqlParameter("@market_price",SqlDbType.Decimal ),
                     new SqlParameter("@sell_price",SqlDbType.Decimal ),
                     new SqlParameter("@total_count",SqlDbType.Int ),

                     new SqlParameter("@start_date",SqlDbType.NVarChar ),
                     new SqlParameter("@end_date",SqlDbType.NVarChar ),
                     new SqlParameter("@add_time",SqlDbType.DateTime ),
                     new SqlParameter("@status",SqlDbType.Int ),
                     new SqlParameter("@is_top",SqlDbType.Int ),
                     new SqlParameter("@is_slide",SqlDbType.Int ),
                     new SqlParameter("@is_red",SqlDbType.Int ),
                     new SqlParameter("@sort_id",SqlDbType.Int ),
                     new SqlParameter("@remark1",SqlDbType.NVarChar ),
                     new SqlParameter("@remark2",SqlDbType.Int ),
                     new SqlParameter("@img_url",SqlDbType.NVarChar ),
                    new SqlParameter("@ReturnValue", SqlDbType.Int)
                  };

            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.title;
            parameters[2].Value = model.content;
            parameters[3].Value = model.market_price;
            parameters[4].Value = model.sell_price;
            parameters[5].Value = model.total_count;

            parameters[6].Value = model.start_date;
            parameters[7].Value = model.end_date;
            parameters[8].Value = model.add_time;
            parameters[9].Value = model.status;
            parameters[10].Value = model.is_top;
            parameters[11].Value = model.is_slide;
            parameters[12].Value = model.is_red;
            parameters[13].Value = model.sort_id;
            parameters[14].Value = model.remark1;
            parameters[15].Value = model.remark2;
            parameters[16].Value = model.img_url;

            parameters[17].Direction = ParameterDirection.Output;

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

            ////????
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_skindetect_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = {
                            new SqlParameter("@article_id", SqlDbType.Int,4),
                            new SqlParameter("@big_img", SqlDbType.NVarChar,255),
                            new SqlParameter("@small_img", SqlDbType.NVarChar,255),
                            new SqlParameter("@remark", SqlDbType.NVarChar,500)};
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[17].Value;
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.article_company model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_article(");
            strSql.Append("channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@category_id,@title,@link_url,@img_url,@seo_title,@seo_keywords,@seo_description,@content,@sort_id,@click,@is_lock,@user_id,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@category_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_title", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_keywords", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
            new SqlParameter("@content", SqlDbType.NText),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@click", SqlDbType.Int, 4),
            new SqlParameter("@is_lock", SqlDbType.TinyInt, 1),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.seo_title;
            parameters[6].Value = model.seo_keywords;
            parameters[7].Value = model.seo_description;
            parameters[8].Value = model.content;
            parameters[9].Value = model.sort_id;
            parameters[10].Value = model.click;
            parameters[11].Value = model.is_lock;
            parameters[12].Value = model.user_id;
            parameters[13].Value = model.add_time;
            parameters[14].Direction = ParameterDirection.Output;

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

            //副表信息
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("insert into dt_article_company(");
            strSql2.Append("id,call_index,is_msg,is_red,address,telephone,[user],is_top,remark1,remark2,x_lng,y_lat,line,price,sell_price,flight_num,seat_price,begin_date,end_date,entry_port,visa_type,visa_nation,visa_data)");
            strSql2.Append(" values (");
            strSql2.Append("@id,@call_index,@is_msg,@is_red,@address,@telephone,@user,@is_top,@remark1,@remark2,@x_lng,@y_lat,@line,@price,@sell_price,@flight_num,@seat_price,@begin_date,@end_date,@entry_port,@visa_type,@visa_nation,@visa_data)");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@call_index", SqlDbType.NVarChar, 50),
            new SqlParameter("@is_msg", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_red", SqlDbType.TinyInt, 1),

            new SqlParameter("@address", SqlDbType.NVarChar, 255),
            new SqlParameter("@telephone", SqlDbType.NVarChar, 50),
            new SqlParameter("@user", SqlDbType.NVarChar, 50),
            new SqlParameter("@is_top", SqlDbType.TinyInt, 1),
            new SqlParameter("@remark1", SqlDbType.NVarChar, 50),
            new SqlParameter("@remark2", SqlDbType.Int, 4),
            new SqlParameter("@x_lng", SqlDbType.NVarChar, 50),
            new SqlParameter("@y_lat", SqlDbType.NVarChar, 50),
                                         new SqlParameter("@line", SqlDbType.NVarChar, 155),
                                         new SqlParameter("@price", SqlDbType.Decimal),
                                         new SqlParameter("@sell_price", SqlDbType.Decimal),
                                         new SqlParameter("@flight_num", SqlDbType.NVarChar, 50),
                                         new SqlParameter("@seat_price", SqlDbType.NVarChar, 50),
                                         new SqlParameter("@begin_date", SqlDbType.NVarChar, 100),
                                         new SqlParameter("@end_date", SqlDbType.NVarChar, 100),
                                         new SqlParameter("@entry_port", SqlDbType.NVarChar, 50),
                                         new SqlParameter("@visa_type", SqlDbType.NVarChar, 100),
                                         new SqlParameter("@visa_nation", SqlDbType.NVarChar, 50),
                                         new SqlParameter("@visa_data", SqlDbType.NVarChar, 255)
                                         };
            parameters2[0].Direction = ParameterDirection.InputOutput;
            parameters2[1].Value = model.call_index;
            parameters2[2].Value = model.is_msg;
            parameters2[3].Value = model.is_red;

            parameters2[4].Value = model.address;
            parameters2[5].Value = model.telephone;

            parameters2[6].Value = model.user;
            parameters2[7].Value = model.is_top;
            parameters2[8].Value = model.remark1;
            parameters2[9].Value = model.remark2;

            parameters2[10].Value = model.x_lng;
            parameters2[11].Value = model.y_lat;
            parameters2[12].Value = model.line;
            parameters2[13].Value = model.price;
            parameters2[14].Value = model.sell_price;
            parameters2[15].Value = model.flight_num;
            parameters2[16].Value = model.seat_price;
            parameters2[17].Value = model.begin_date;
            parameters2[18].Value = model.end_date;
            parameters2[19].Value = model.entry_port;
            parameters2[20].Value = model.visa_type;
            parameters2[21].Value = model.visa_nation;
            parameters2[22].Value = model.visa_data;

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

            //顶和踩
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("insert into dt_article_diggs(");
            strSql3.Append("id,digg_good,digg_bad)");
            strSql3.Append(" values (");
            strSql3.Append("@id,@digg_good,@digg_bad)");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@digg_good", SqlDbType.Int, 4),
            new SqlParameter("@digg_bad", SqlDbType.Int, 4) };
            parameters3[0].Direction = ParameterDirection.InputOutput;
            parameters3[1].Value = model.digg_good;
            parameters3[2].Value = model.digg_bad;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //图片相册
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_article_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@big_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@small_img", SqlDbType.NVarChar, 255),
                    new SqlParameter("@remark", SqlDbType.NVarChar, 500) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.big_img;
                    parameters4[2].Value = models.small_img;
                    parameters4[3].Value = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[14].Value;
        }
Esempio n. 21
0
        /// <summary>
        /// 删除
        /// </summary>
        public bool Delete(int id)
        {
            //获取相册列表
            List<Model.article_albums> albumsList = new article_albums().GetList(id);
            List<CommandInfo> sqllist = new List<CommandInfo>();

            //删除图片相册
            StringBuilder strSql8 = new StringBuilder();
            strSql8.Append("delete from dt_article_albums ");
            strSql8.Append(" where article_id=@article_id ");
            SqlParameter[] parameters8 = { new SqlParameter("@article_id", SqlDbType.Int, 4) };
            parameters8[0].Value = id;
            CommandInfo cmd = new CommandInfo(strSql8.ToString(), parameters8);
            sqllist.Add(cmd);
            //删除副表
            StringBuilder strSql9 = new StringBuilder();
            strSql9.Append("delete from [dt_group_guid] ");
            strSql9.Append(" where [group_id]=@id ");
            SqlParameter[] parameters9 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters9[0].Value = id;
            cmd = new CommandInfo(strSql9.ToString(), parameters9);
            sqllist.Add(cmd);

            //删除主表
            StringBuilder strSql11 = new StringBuilder();
            strSql11.Append("delete from [dt_group] ");
            strSql11.Append(" where id=@id ");
            SqlParameter[] parameters11 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters11[0].Value = id;
            cmd = new CommandInfo(strSql11.ToString(), parameters11);
            sqllist.Add(cmd);

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                new article_albums().DeleteFile(albumsList); //删除文件

                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            //先取得用户Model
            Model.users model = GetModel(id);
            if (model == null)
            {
                return false;
            }
            List<CommandInfo> sqllist = new List<CommandInfo>();
            //删除登录日志
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from dt_user_login_log ");
            strSql.Append(" where user_id=@id");
            SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = id;
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);

            //删除申请码
            StringBuilder strSql1 = new StringBuilder();
            strSql1.Append("delete from dt_user_code ");
            strSql1.Append(" where user_id=@id");
            SqlParameter[] parameters1 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters1[0].Value = id;
            cmd = new CommandInfo(strSql1.ToString(), parameters1);
            sqllist.Add(cmd);

            //删除积分记录
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("delete from dt_point_log ");
            strSql2.Append(" where user_id=@id");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters2[0].Value = id;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //删除金额记录
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("delete from dt_amount_log ");
            strSql3.Append(" where user_id=@id");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters3[0].Value = id;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //删除短消息
            StringBuilder strSql4 = new StringBuilder();
            strSql4.Append("delete from dt_user_message ");
            strSql4.Append(" where post_user_name=@post_user_name or accept_user_name=@accept_user_name");
            SqlParameter[] parameters4 = { new SqlParameter("@post_user_name", SqlDbType.NVarChar, 100),
            new SqlParameter("@accept_user_name", SqlDbType.NVarChar, 100) };
            parameters4[0].Value = model.user_name;
            parameters4[1].Value = model.user_name;
            cmd = new CommandInfo(strSql4.ToString(), parameters4);
            sqllist.Add(cmd);

            //删除用户旅团
            StringBuilder strSql5 = new StringBuilder();
            strSql5.Append("delete from dt_group_guid");
            strSql5.Append(" where guid_id=@guid_id");
            SqlParameter[] parameters5 = { new SqlParameter("@guid_id", SqlDbType.Int, 4) };
            parameters5[0].Value = id;
            cmd = new CommandInfo(strSql5.ToString(), parameters5);
            sqllist.Add(cmd);

            //删除用户红包
            StringBuilder strSql6 = new StringBuilder();
            strSql6.Append("delete from dt_redpacket_guid");
            strSql6.Append(" where guid_id=@guid_id");
            SqlParameter[] parameters6 = { new SqlParameter("@guid_id", SqlDbType.Int, 4) };
            parameters6[0].Value = id;
            cmd = new CommandInfo(strSql6.ToString(), parameters6);
            sqllist.Add(cmd);

            //删除导游关注旅行社
            StringBuilder strSql7 = new StringBuilder();
            strSql7.Append("delete from [dt_manager_guid]");
            strSql7.Append(" where guid_id=@guid_id");
            SqlParameter[] parameters7 = { new SqlParameter("@guid_id", SqlDbType.Int, 4) };
            parameters7[0].Value = id;
            cmd = new CommandInfo(strSql7.ToString(), parameters7);
            sqllist.Add(cmd);

            //待完善
            //将报团数+1
            //bll_tourgroup.UpdateField(travelId, "book_count=" + (model_group.book_count + 1));
            //将抢购人数+1
            //bll_redpacket.UpdateField(redpacketId, "book_count=" + (model_redpacket.book_count + 1));

            //删除用户
            StringBuilder strSql9 = new StringBuilder();
            strSql9.Append("delete from dt_users ");
            strSql9.Append(" where id=@id");
            SqlParameter[] parameters9 = { new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters9[0].Value = id;
            cmd = new CommandInfo(strSql9.ToString(), parameters9);
            sqllist.Add(cmd);

            int rowsAffected = DbHelperSQL.ExecuteSqlTran(sqllist);
            if (rowsAffected > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.article_download model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_article(");
            strSql.Append("channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@category_id,@title,@link_url,@img_url,@seo_title,@seo_keywords,@seo_description,@content,@sort_id,@click,@is_lock,@user_id,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@category_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_title", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_keywords", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
            new SqlParameter("@content", SqlDbType.NText),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@click", SqlDbType.Int, 4),
            new SqlParameter("@is_lock", SqlDbType.TinyInt, 1),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.seo_title;
            parameters[6].Value = model.seo_keywords;
            parameters[7].Value = model.seo_description;
            parameters[8].Value = model.content;
            parameters[9].Value = model.sort_id;
            parameters[10].Value = model.click;
            parameters[11].Value = model.is_lock;
            parameters[12].Value = model.user_id;
            parameters[13].Value = model.add_time;
            parameters[14].Direction = ParameterDirection.Output;

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

            //附表信息
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("insert into dt_article_download(");
            strSql2.Append("id,is_msg,is_red)");
            strSql2.Append(" values (");
            strSql2.Append("@id,@is_msg,@is_red)");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@is_msg", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_red", SqlDbType.TinyInt, 1) };
            parameters2[0].Direction = ParameterDirection.InputOutput;
            parameters2[1].Value = model.is_msg;
            parameters2[2].Value = model.is_red;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //顶和踩
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("insert into dt_article_diggs(");
            strSql3.Append("id,digg_good,digg_bad)");
            strSql3.Append(" values (");
            strSql3.Append("@id,@digg_good,@digg_bad)");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@digg_good", SqlDbType.Int, 4),
            new SqlParameter("@digg_bad", SqlDbType.Int, 4) };
            parameters3[0].Direction = ParameterDirection.InputOutput;
            parameters3[1].Value = model.digg_good;
            parameters3[2].Value = model.digg_bad;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //下载附件
            if (model.download_attachs != null)
            {
                StringBuilder strSql4;
                foreach (Model.download_attach models in model.download_attachs)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_download_attach(");
                    strSql4.Append("article_id,title,file_path,file_ext,file_size,down_num,point)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@title,@file_path,@file_ext,@file_size,@down_num,@point)");
                    SqlParameter[] parameters4 = { new SqlParameter("@article_id", SqlDbType.Int, 4),
                    new SqlParameter("@title", SqlDbType.NVarChar, 255),
                    new SqlParameter("@file_path", SqlDbType.NVarChar, 255),
                    new SqlParameter("@file_ext", SqlDbType.NVarChar, 100),
                    new SqlParameter("@file_size", SqlDbType.Int, 4),
                    new SqlParameter("@down_num", SqlDbType.Int, 4),
                    new SqlParameter("@point", SqlDbType.Int, 4) };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value = models.title;
                    parameters4[2].Value = models.file_path;
                    parameters4[3].Value = models.file_ext;
                    parameters4[4].Value = models.file_size;
                    parameters4[5].Value = models.down_num;
                    parameters4[6].Value = models.point;
                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[14].Value;
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.article_content model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_article(");
            strSql.Append("channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@category_id,@title,@link_url,@img_url,@seo_title,@seo_keywords,@seo_description,@content,@sort_id,@click,@is_lock,@user_id,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@category_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_title", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_keywords", SqlDbType.NVarChar, 255),
            new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
            new SqlParameter("@content", SqlDbType.NText),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@click", SqlDbType.Int, 4),
            new SqlParameter("@is_lock", SqlDbType.TinyInt, 1),
            new SqlParameter("@user_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime),
            new SqlParameter("@ReturnValue", SqlDbType.Int) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.category_id;
            parameters[2].Value = model.title;
            parameters[3].Value = model.link_url;
            parameters[4].Value = model.img_url;
            parameters[5].Value = model.seo_title;
            parameters[6].Value = model.seo_keywords;
            parameters[7].Value = model.seo_description;
            parameters[8].Value = model.content;
            parameters[9].Value = model.sort_id;
            parameters[10].Value = model.click;
            parameters[11].Value = model.is_lock;
            parameters[12].Value = model.user_id;
            parameters[13].Value = model.add_time;
            parameters[14].Direction = ParameterDirection.Output;

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

            //副表信息
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("insert into dt_article_content(");
            strSql2.Append("id,call_index,is_msg,is_red)");
            strSql2.Append(" values (");
            strSql2.Append("@id,@call_index,@is_msg,@is_red)");
            SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@call_index", SqlDbType.NVarChar, 50),
            new SqlParameter("@is_msg", SqlDbType.TinyInt, 1),
            new SqlParameter("@is_red", SqlDbType.TinyInt, 1) };
            parameters2[0].Direction = ParameterDirection.InputOutput;
            parameters2[1].Value = model.call_index;
            parameters2[2].Value = model.is_msg;
            parameters2[3].Value = model.is_red;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //顶和踩
            StringBuilder strSql3 = new StringBuilder();
            strSql3.Append("insert into dt_article_diggs(");
            strSql3.Append("id,digg_good,digg_bad)");
            strSql3.Append(" values (");
            strSql3.Append("@id,@digg_good,@digg_bad)");
            SqlParameter[] parameters3 = { new SqlParameter("@id", SqlDbType.Int, 4),
            new SqlParameter("@digg_good", SqlDbType.Int, 4),
            new SqlParameter("@digg_bad", SqlDbType.Int, 4) };
            parameters3[0].Direction = ParameterDirection.InputOutput;
            parameters3[1].Value = model.digg_good;
            parameters3[2].Value = model.digg_bad;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[14].Value;
        }