Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public int Add(SYS_Famous_CategoryMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_Famous_Category(");
            strSql.Append("Name,ParentSysNo)");
            strSql.Append(" values (");
            strSql.Append("@Name,@ParentSysNo)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",        SqlDbType.NVarChar,  200),
                new SqlParameter("@ParentSysNo", SqlDbType.Int,         4),
                new SqlParameter("@DR",          SqlDbType.TinyInt,     1),
                new SqlParameter("@TS",          SqlDbType.DateTime),
            };
            if (model.Name != AppConst.StringNull)
            {
                parameters[0].Value = model.Name;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.ParentSysNo != AppConst.IntNull)
            {
                parameters[1].Value = model.ParentSysNo;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[2].Value = model.DR;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[3].Value = model.TS;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);

            return(SqlHelper.ExecuteNonQuery(cmd, parameters));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>

        public SYS_Famous_CategoryMod GetModel(int SysNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select SysNo, Name, ParentSysNo, DR, TS from  SYS_Famous_Category");
            strSql.Append(" where SysNo=@SysNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo", SqlDbType.Int, 4)
            };
            parameters[0].Value = SysNo;
            SYS_Famous_CategoryMod model = new SYS_Famous_CategoryMod();
            DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
                {
                    model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
                }
                model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                if (ds.Tables[0].Rows[0]["ParentSysNo"].ToString() != "")
                {
                    model.ParentSysNo = int.Parse(ds.Tables[0].Rows[0]["ParentSysNo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
                {
                    model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
                {
                    model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SYS_Famous_CategoryMod model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into SYS_Famous_Category(");
            strSql.Append("Name,ParentSysNo)");
            strSql.Append(" values (");
            strSql.Append("@Name,@ParentSysNo)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlCommand cmd = new SqlCommand(strSql.ToString());
            SqlParameter[] parameters = {
                 new SqlParameter("@Name",SqlDbType.NVarChar,200),
                 new SqlParameter("@ParentSysNo",SqlDbType.Int,4),
                 new SqlParameter("@DR",SqlDbType.TinyInt,1),
                 new SqlParameter("@TS",SqlDbType.DateTime),
             };
            if (model.Name != AppConst.StringNull)
                parameters[0].Value = model.Name;
            else
                parameters[0].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[0]);
            if (model.ParentSysNo != AppConst.IntNull)
                parameters[1].Value = model.ParentSysNo;
            else
                parameters[1].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[1]);
            if (model.DR != AppConst.IntNull)
                parameters[2].Value = model.DR;
            else
                parameters[2].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[2]);
            if (model.TS != AppConst.DateTimeNull)
                parameters[3].Value = model.TS;
            else
                parameters[3].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[3]);

            return SqlHelper.ExecuteNonQuery(cmd,parameters);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SYS_Famous_CategoryMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update SYS_Famous_Category set ");
     strSql.Append("Name=@Name,");
     strSql.Append("ParentSysNo=@ParentSysNo,");
     strSql.Append("DR=@DR,");
     strSql.Append("TS=@TS");
     strSql.Append(" where SysNo=@SysNo ");
     SqlCommand cmd = new SqlCommand(strSql.ToString());
     SqlParameter[] parameters = {
          new SqlParameter("@SysNo",SqlDbType.Int,4),
          new SqlParameter("@Name",SqlDbType.NVarChar,200),
          new SqlParameter("@ParentSysNo",SqlDbType.Int,4),
          new SqlParameter("@DR",SqlDbType.TinyInt,1),
          new SqlParameter("@TS",SqlDbType.DateTime)
      };
     if (model.SysNo != AppConst.IntNull)
         parameters[0].Value = model.SysNo;
     else
         parameters[0].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[0]);
     if (model.Name != AppConst.StringNull)
         parameters[1].Value = model.Name;
     else
         parameters[1].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[1]);
     if (model.ParentSysNo != AppConst.IntNull)
         parameters[2].Value = model.ParentSysNo;
     else
         parameters[2].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[2]);
     if (model.DR != AppConst.IntNull)
         parameters[3].Value = model.DR;
     else
         parameters[3].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[3]);
     if (model.TS != AppConst.DateTimeNull)
         parameters[4].Value = model.TS;
     else
         parameters[4].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[4]);
     return SqlHelper.ExecuteNonQuery(cmd,parameters);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SYS_Famous_CategoryMod GetModel(int SysNo)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select SysNo, Name, ParentSysNo, DR, TS from  SYS_Famous_Category");
     strSql.Append(" where SysNo=@SysNo ");
     SqlParameter[] parameters = {
     new SqlParameter("@SysNo", SqlDbType.Int,4 )
      		};
     parameters[0].Value = SysNo;
     SYS_Famous_CategoryMod model = new SYS_Famous_CategoryMod();
     DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
         {
             model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
         }
         model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
         if (ds.Tables[0].Rows[0]["ParentSysNo"].ToString() != "")
         {
             model.ParentSysNo = int.Parse(ds.Tables[0].Rows[0]["ParentSysNo"].ToString());
         }
         if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
         {
             model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
         {
             model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public int Update(SYS_Famous_CategoryMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_Famous_Category set ");
            strSql.Append("Name=@Name,");
            strSql.Append("ParentSysNo=@ParentSysNo,");
            strSql.Append("DR=@DR,");
            strSql.Append("TS=@TS");
            strSql.Append(" where SysNo=@SysNo ");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo",       SqlDbType.Int,        4),
                new SqlParameter("@Name",        SqlDbType.NVarChar, 200),
                new SqlParameter("@ParentSysNo", SqlDbType.Int,        4),
                new SqlParameter("@DR",          SqlDbType.TinyInt,    1),
                new SqlParameter("@TS",          SqlDbType.DateTime)
            };
            if (model.SysNo != AppConst.IntNull)
            {
                parameters[0].Value = model.SysNo;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.Name != AppConst.StringNull)
            {
                parameters[1].Value = model.Name;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.ParentSysNo != AppConst.IntNull)
            {
                parameters[2].Value = model.ParentSysNo;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[3].Value = model.DR;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[4].Value = model.TS;
            }
            else
            {
                parameters[4].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[4]);
            return(SqlHelper.ExecuteNonQuery(cmd, parameters));
        }
Exemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(SYS_Famous_CategoryMod model)
 {
     dal.Update(model);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SYS_Famous_CategoryMod model)
 {
     return dal.Add(model);
 }
Exemplo n.º 9
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public void Update(SYS_Famous_CategoryMod model)
        {
            dal.Update(model);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public int Add(SYS_Famous_CategoryMod model)
        {
            return(dal.Add(model));
        }