Esempio n. 1
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int ProfessionalArticleAdd(Entity.ProfessionalArticle info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@ProfessionalId",  SqlDbType.Int,         4, info.ProfessionalId),
         SqlDB.MakeInParam("@CategoryId",      SqlDbType.Int,         4, info.CategoryId),
         SqlDB.MakeInParam("@Icon",            SqlDbType.NVarChar,  200, info.Icon),
         SqlDB.MakeInParam("@Title",           SqlDbType.NVarChar,  200, info.Title),
         SqlDB.MakeInParam("@ShortTitle",      SqlDbType.NVarChar,  200, info.ShortTitle),
         SqlDB.MakeInParam("@MetaTitle",       SqlDbType.NVarChar,  200, info.MetaTitle),
         SqlDB.MakeInParam("@MetaKeyWords",    SqlDbType.NVarChar,  500, info.MetaKeyWords),
         SqlDB.MakeInParam("@MetaDescription", SqlDbType.NVarChar,  300, info.MetaDescription),
         SqlDB.MakeInParam("@Summary",         SqlDbType.NVarChar, 2000, info.Summary),
         SqlDB.MakeInParam("@Content",         SqlDbType.NVarChar,    0, info.Content),
         SqlDB.MakeInParam("@IsPause",         SqlDbType.Int,         4, info.IsPause),
         SqlDB.MakeInParam("@IsTuiJian",       SqlDbType.Int,         4, info.IsTuiJian),
         SqlDB.MakeInParam("@IsNew",           SqlDbType.Int,         4, info.IsNew),
         SqlDB.MakeInParam("@IsZhiDing",       SqlDbType.Int,         4, info.IsZhiDing),
         SqlDB.MakeInParam("@ZhiDingTime",     SqlDbType.DateTime,    8, info.ZhiDingTime),
         SqlDB.MakeInParam("@PublishTime",     SqlDbType.DateTime,    8, info.PublishTime),
         SqlDB.MakeInParam("@AddTime",         SqlDbType.DateTime,    8, info.AddTime),
         SqlDB.MakeInParam("@AddWid",          SqlDbType.Int,         4, info.AddWid),
         SqlDB.MakeInParam("@IsCheck",         SqlDbType.Int,         4, info.IsCheck),
         SqlDB.MakeInParam("@CheckTime",       SqlDbType.DateTime,    8, info.CheckTime),
         SqlDB.MakeInParam("@CheckWid",        SqlDbType.Int,         4, info.CheckWid),
         SqlDB.MakeInParam("@ClickNum",        SqlDbType.Int,         4, info.ClickNum),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "ProfessionalArticleAdd", prams).ToString(), -1));
 }
Esempio n. 2
0
        /// <summary>
        /// 暂停该值
        /// </summary>
        /// <param name="Id">自增id的值</param>
        /// <returns>暂停成功返回ture,否则返回false</returns>
        public static bool ProfessionalArticlePause(Entity.ProfessionalArticle info)
        {
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.Text, "UPDATE [ProfessionalArticle] SET IsPause = " + info.IsPause + "  WHERE Id =  " + info.Id);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool ProfessionalArticleEdit(Entity.ProfessionalArticle info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",              SqlDbType.Int,         4, info.Id),
                SqlDB.MakeInParam("@ProfessionalId",  SqlDbType.Int,         4, info.ProfessionalId),
                SqlDB.MakeInParam("@CategoryId",      SqlDbType.Int,         4, info.CategoryId),
                SqlDB.MakeInParam("@Icon",            SqlDbType.NVarChar,  200, info.Icon),
                SqlDB.MakeInParam("@Title",           SqlDbType.NVarChar,  200, info.Title),
                SqlDB.MakeInParam("@ShortTitle",      SqlDbType.NVarChar,  200, info.ShortTitle),
                SqlDB.MakeInParam("@MetaTitle",       SqlDbType.NVarChar,  200, info.MetaTitle),
                SqlDB.MakeInParam("@MetaKeyWords",    SqlDbType.NVarChar,  500, info.MetaKeyWords),
                SqlDB.MakeInParam("@MetaDescription", SqlDbType.NVarChar,  300, info.MetaDescription),
                SqlDB.MakeInParam("@Summary",         SqlDbType.NVarChar, 2000, info.Summary),
                SqlDB.MakeInParam("@Content",         SqlDbType.NVarChar,    0, info.Content),
                SqlDB.MakeInParam("@IsPause",         SqlDbType.Int,         4, info.IsPause),
                SqlDB.MakeInParam("@IsTuiJian",       SqlDbType.Int,         4, info.IsTuiJian),
                SqlDB.MakeInParam("@IsNew",           SqlDbType.Int,         4, info.IsNew),
                SqlDB.MakeInParam("@IsZhiDing",       SqlDbType.Int,         4, info.IsZhiDing),
                SqlDB.MakeInParam("@ZhiDingTime",     SqlDbType.DateTime,    8, info.ZhiDingTime),
                SqlDB.MakeInParam("@PublishTime",     SqlDbType.DateTime,    8, info.PublishTime),
                SqlDB.MakeInParam("@AddTime",         SqlDbType.DateTime,    8, info.AddTime),
                SqlDB.MakeInParam("@AddWid",          SqlDbType.Int,         4, info.AddWid),
                SqlDB.MakeInParam("@IsCheck",         SqlDbType.Int,         4, info.IsCheck),
                SqlDB.MakeInParam("@CheckTime",       SqlDbType.DateTime,    8, info.CheckTime),
                SqlDB.MakeInParam("@CheckWid",        SqlDbType.Int,         4, info.CheckWid),
                SqlDB.MakeInParam("@ClickNum",        SqlDbType.Int,         4, info.ClickNum),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "ProfessionalArticleEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.ProfessionalArticle ProfessionalArticleEntityGet(int Id)
        {
            Entity.ProfessionalArticle info = new Entity.ProfessionalArticle();
            DataTable dt = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [ProfessionalArticle] WHERE Id = " + Id + ";").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id              = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.ProfessionalId  = Basic.Utils.StrToInt(dt.Rows[0]["ProfessionalId"].ToString(), 0);
                info.CategoryId      = Basic.Utils.StrToInt(dt.Rows[0]["CategoryId"].ToString(), 0);
                info.Icon            = dt.Rows[0]["Icon"].ToString();
                info.Title           = dt.Rows[0]["Title"].ToString();
                info.ShortTitle      = dt.Rows[0]["ShortTitle"].ToString();
                info.MetaTitle       = dt.Rows[0]["MetaTitle"].ToString();
                info.MetaKeyWords    = dt.Rows[0]["MetaKeyWords"].ToString();
                info.MetaDescription = dt.Rows[0]["MetaDescription"].ToString();
                info.Summary         = dt.Rows[0]["Summary"].ToString();
                info.Content         = dt.Rows[0]["Content"].ToString();
                info.IsPause         = Basic.Utils.StrToInt(dt.Rows[0]["IsPause"].ToString(), 0);
                info.IsTuiJian       = Basic.Utils.StrToInt(dt.Rows[0]["IsTuiJian"].ToString(), 0);
                info.IsNew           = Basic.Utils.StrToInt(dt.Rows[0]["IsNew"].ToString(), 0);
                info.IsZhiDing       = Basic.Utils.StrToInt(dt.Rows[0]["IsZhiDing"].ToString(), 0);
                info.AddWid          = Basic.Utils.StrToInt(dt.Rows[0]["AddWid"].ToString(), 0);
                info.IsCheck         = Basic.Utils.StrToInt(dt.Rows[0]["IsCheck"].ToString(), 0);
                info.CheckWid        = Basic.Utils.StrToInt(dt.Rows[0]["CheckWid"].ToString(), 0);
                info.ClickNum        = Basic.Utils.StrToInt(dt.Rows[0]["ClickNum"].ToString(), 0);
                info.AddTime         = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString());
                info.CheckTime       = Basic.Utils.StrToDateTime(dt.Rows[0]["CheckTime"].ToString());
                info.PublishTime     = Basic.Utils.StrToDateTime(dt.Rows[0]["PublishTime"].ToString());
                info.ZhiDingTime     = Basic.Utils.StrToDateTime(dt.Rows[0]["ZhiDingTime"].ToString());
                return(info);
            }
            else
            {
                return(null);
            }
        }