Beispiel #1
0
        /// <summary>
        /// 从IDataReader创建TopicInfo
        /// </summary>
        public static TopicInfo BuildTopicFromReader(IDataReader reader)
        {
            TopicInfo topicInfo = new TopicInfo();

            topicInfo.TopicId = TypeHelper.ObjectToInt(reader["topicid"]);
            topicInfo.StartTime = TypeHelper.ObjectToDateTime(reader["starttime"]);
            topicInfo.EndTime = TypeHelper.ObjectToDateTime(reader["endtime"]);
            topicInfo.IsShow = TypeHelper.ObjectToInt(reader["isshow"]);
            topicInfo.SN = reader["sn"].ToString();
            topicInfo.Title = reader["title"].ToString();
            topicInfo.HeadHtml = reader["headhtml"].ToString();
            topicInfo.BodyHtml = reader["bodyhtml"].ToString();

            return topicInfo;
        }
Beispiel #2
0
        public ActionResult Add(TopicModel model)
        {
            if (ModelState.IsValid)
            {
                string sn = AdminTopic.GenerateTopicSN();
                TopicInfo topicInfo = new TopicInfo()
                {
                    StartTime = model.StartTime,
                    EndTime = model.EndTime,
                    SN = sn,
                    Title = model.Title,
                    HeadHtml = model.HeadHtml ?? "",
                    BodyHtml = model.BodyHtml ?? "",
                    IsShow = model.IsShow
                };

                AdminTopic.CreateTopic(topicInfo);
                AddMallAdminLog("添加活动专题", "添加活动专题,活动专题为:" + model.Title);
                return PromptView("活动专题添加成功");
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return View(model);
        }
Beispiel #3
0
 /// <summary>
 /// 更新活动专题
 /// </summary>
 /// <param name="topicInfo">活动专题信息</param>
 public static void UpdateTopic(TopicInfo topicInfo)
 {
     BrnMall.Data.Topics.UpdateTopic(topicInfo);
     BrnMall.Core.BMACache.Remove(CacheKeys.MALL_TOPIC_INFO + topicInfo.TopicId);
     BrnMall.Core.BMACache.Remove(CacheKeys.MALL_TOPIC_INFO + topicInfo.SN);
 }
Beispiel #4
0
 /// <summary>
 /// 创建活动专题
 /// </summary>
 /// <param name="topicInfo">活动专题信息</param>
 public static void CreateTopic(TopicInfo topicInfo)
 {
     BrnMall.Data.Topics.CreateTopic(topicInfo);
 }
Beispiel #5
0
 /// <summary>
 /// 更新活动专题
 /// </summary>
 /// <param name="topicInfo">活动专题信息</param>
 public void UpdateTopic(TopicInfo topicInfo)
 {
     DbParameter[] parms = {
                             GenerateInParam("@starttime", SqlDbType.DateTime, 8, topicInfo.StartTime),
                             GenerateInParam("@endtime", SqlDbType.DateTime,8,topicInfo.EndTime),
                             GenerateInParam("@isshow", SqlDbType.TinyInt,1,topicInfo.IsShow),
                             GenerateInParam("@sn", SqlDbType.Char,16,topicInfo.SN),
                             GenerateInParam("@title", SqlDbType.NVarChar,100,topicInfo.Title),
                             GenerateInParam("@headhtml", SqlDbType.NText,0,topicInfo.HeadHtml),
                             GenerateInParam("@bodyhtml", SqlDbType.NText,0,topicInfo.BodyHtml),
                             GenerateInParam("@topicid", SqlDbType.Int,4,topicInfo.TopicId)
                             };
     string commandText = string.Format("UPDATE [{0}topics] SET [starttime]=@starttime,[endtime]=@endtime,[isshow]=@isshow,[sn]=@sn,[title]=@title,[headhtml]=@headhtml,[bodyhtml]=@bodyhtml WHERE [topicid]=@topicid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Beispiel #6
0
 /// <summary>
 /// 创建活动专题
 /// </summary>
 /// <param name="topicInfo">活动专题信息</param>
 public void CreateTopic(TopicInfo topicInfo)
 {
     DbParameter[] parms = {
                             GenerateInParam("@starttime", SqlDbType.DateTime, 8, topicInfo.StartTime),
                             GenerateInParam("@endtime", SqlDbType.DateTime,8,topicInfo.EndTime),
                             GenerateInParam("@isshow", SqlDbType.TinyInt,1,topicInfo.IsShow),
                             GenerateInParam("@sn", SqlDbType.Char,16,topicInfo.SN),
                             GenerateInParam("@title", SqlDbType.NVarChar,100,topicInfo.Title),
                             GenerateInParam("@headhtml", SqlDbType.NText,0,topicInfo.HeadHtml),
                             GenerateInParam("@bodyhtml", SqlDbType.NText,0,topicInfo.BodyHtml)
                             };
     string commandText = string.Format("INSERT INTO [{0}topics]([starttime],[endtime],[isshow],[sn],[title],[headhtml],[bodyhtml]) VALUES(@starttime,@endtime,@isshow,@sn,@title,@headhtml,@bodyhtml)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Beispiel #7
0
 /// <summary>
 /// 更新活动专题
 /// </summary>
 /// <param name="topicInfo">活动专题信息</param>
 public static void UpdateTopic(TopicInfo topicInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateTopic(topicInfo);
 }