Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TOURISM.Model.attributes model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_attributes(");
            strSql.Append("channel_id,title,remark,type,default_value,sort_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@title,@remark,@type,@default_value,@sort_id,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@remark", SqlDbType.NVarChar, 500),
            new SqlParameter("@type", SqlDbType.Int, 4),
            new SqlParameter("@default_value", SqlDbType.NVarChar, 500),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@add_time", SqlDbType.DateTime) };
            parameters[0].Value = model.channel_id;
            parameters[1].Value = model.title;
            parameters[2].Value = model.remark;
            parameters[3].Value = model.type;
            parameters[4].Value = model.default_value;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.add_time;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TOURISM.Model.sys_channel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_sys_channel(");
            strSql.Append("model_id,name,title,sort_id)");
            strSql.Append(" values (");
            strSql.Append("@model_id,@name,@title,@sort_id)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = { new SqlParameter("@model_id", SqlDbType.Int, 4),
            new SqlParameter("@name", SqlDbType.NVarChar, 100),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@sort_id", SqlDbType.Int, 4) };
            parameters[0].Value = model.model_id;
            parameters[1].Value = model.name;
            parameters[2].Value = model.title;
            parameters[3].Value = model.sort_id;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.sys_channel model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.sys_channel model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.category model)
 {
     using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
     {
         conn.Open();
         using (SqlTransaction trans = conn.BeginTransaction())
         {
             try
             {
                 //先判断选中的父节点是否被包含
                 if (IsContainNode(model.id, model.parent_id))
                 {
                     //查找旧数据
                     Model.category oldModel = GetModel(model.id);
                     //查找旧父节点数据
                     string class_list = "," + model.parent_id + ",";
                     int class_layer = 1;
                     if (oldModel.parent_id > 0)
                     {
                         Model.category oldParentModel = GetModel(conn, trans, oldModel.parent_id); //带事务
                         class_list = oldParentModel.class_list + model.parent_id + ",";
                         class_layer = oldParentModel.class_layer + 1;
                     }
                     //先提升选中的父节点
                     DbHelperSQL.ExecuteSql(conn, trans, "update dt_category set parent_id=" + oldModel.parent_id + ",class_list='" + class_list + "', class_layer=" + class_layer + " where id=" + model.parent_id); //带事务
                     UpdateChilds(conn, trans, model.parent_id); //带事务
                 }
                 //更新子节点
                 if (model.parent_id > 0)
                 {
                     Model.category model2 = GetModel(conn, trans, model.parent_id); //带事务
                     model.class_list = model2.class_list + model.id + ",";
                     model.class_layer = model2.class_layer + 1;
                 }
                 else
                 {
                     model.class_list = "," + model.id + ",";
                     model.class_layer = 1;
                 }
                 StringBuilder strSql = new StringBuilder();
                 strSql.Append("update dt_category set ");
                 strSql.Append("channel_id=@channel_id,");
                 strSql.Append("title=@title,");
                 strSql.Append("call_index=@call_index,");
                 strSql.Append("parent_id=@parent_id,");
                 strSql.Append("class_list=@class_list,");
                 strSql.Append("class_layer=@class_layer,");
                 strSql.Append("sort_id=@sort_id,");
                 strSql.Append("link_url=@link_url,");
                 strSql.Append("img_url=@img_url,");
                 strSql.Append("content=@content,");
                 strSql.Append("visible=@visible,");
                 strSql.Append("signtype=@signtype,");
                 strSql.Append("seo_description=@seo_description");
                 strSql.Append(" where id=@id");
                 SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
                 new SqlParameter("@title", SqlDbType.NVarChar, 100),
                 new SqlParameter("@call_index", SqlDbType.NVarChar, 50),
                 new SqlParameter("@parent_id", SqlDbType.Int, 4),
                 new SqlParameter("@class_list", SqlDbType.NVarChar, 500),
                 new SqlParameter("@class_layer", SqlDbType.Int, 4),
                 new SqlParameter("@sort_id", SqlDbType.Int, 4),
                 new SqlParameter("@link_url", SqlDbType.NVarChar, 255),
                 new SqlParameter("@img_url", SqlDbType.NVarChar, 255),
                 new SqlParameter("@content", SqlDbType.NText),
                 new SqlParameter("@visible", SqlDbType.NVarChar, 255),
                 new SqlParameter("@signtype", SqlDbType.NVarChar, 50),
                 new SqlParameter("@seo_description", SqlDbType.NVarChar, 255),
                 new SqlParameter("@id", SqlDbType.Int, 4) };
                 parameters[0].Value = model.channel_id;
                 parameters[1].Value = model.title;
                 parameters[2].Value = model.call_index;
                 parameters[3].Value = model.parent_id;
                 parameters[4].Value = model.class_list;
                 parameters[5].Value = model.class_layer;
                 parameters[6].Value = model.sort_id;
                 parameters[7].Value = model.link_url;
                 parameters[8].Value = model.img_url;
                 parameters[9].Value = model.content;
                 parameters[10].Value = model.visible;
                 parameters[11].Value = model.signtype;
                 parameters[12].Value = model.seo_description;
                 parameters[13].Value = model.id;
                 DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                 //更新子节点
                 UpdateChilds(conn, trans, model.id);
                 trans.Commit();
             }
             catch
             {
                 trans.Rollback();
                 return false;
             }
         }
     }
     return true;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TOURISM.Model.sys_channel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update dt_sys_channel set ");
            strSql.Append("model_id=@model_id,");
            strSql.Append("name=@name,");
            strSql.Append("title=@title,");
            strSql.Append("sort_id=@sort_id");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = { new SqlParameter("@model_id", SqlDbType.Int, 4),
            new SqlParameter("@name", SqlDbType.NVarChar, 100),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@sort_id", SqlDbType.Int, 4),
            new SqlParameter("@id", SqlDbType.Int, 4) };
            parameters[0].Value = model.model_id;
            parameters[1].Value = model.name;
            parameters[2].Value = model.title;
            parameters[3].Value = model.sort_id;
            parameters[4].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.users model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.manager_role model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.user_message model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.category model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.manager_role model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.category model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.mail_template model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.mail_template model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.cityinfo model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TOURISM.Model.users model)
 {
     return dal.Update(model);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TOURISM.Model.cityinfo model)
 {
     return dal.Add(model);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TOURISM.Model.attributes model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update dt_attributes set ");
            strSql.Append("channel_id=@channel_id,");
            strSql.Append("title=@title,");
            strSql.Append("remark=@remark,");
            strSql.Append("type=@type,");
            strSql.Append("default_value=@default_value,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = { new SqlParameter("@channel_id", SqlDbType.Int, 4),
            new SqlParameter("@title", SqlDbType.NVarChar, 100),
            new SqlParameter("@remark", SqlDbType.NVarChar, 500),
            new SqlParameter("@type", SqlDbType.Int, 4),
            new SqlParameter("@default_value", SqlDbType.NVarChar, 500),
            new SqlParameter("@sort_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.title;
            parameters[2].Value = model.remark;
            parameters[3].Value = model.type;
            parameters[4].Value = model.default_value;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.add_time;
            parameters[7].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }