Esempio n. 1
0
 /// <summary>
 /// 更新套装促销活动
 /// </summary>
 public void UpdateSuitPromotion(SuitPromotionInfo suitPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime1", SqlDbType.DateTime,8,suitPromotionInfo.StartTime1),
                                 GenerateInParam("@endtime1", SqlDbType.DateTime,8,suitPromotionInfo.EndTime1),
                                 GenerateInParam("@starttime2", SqlDbType.DateTime,8,suitPromotionInfo.StartTime2),
                                 GenerateInParam("@endtime2", SqlDbType.DateTime,8,suitPromotionInfo.EndTime2),
                                 GenerateInParam("@starttime3", SqlDbType.DateTime,8,suitPromotionInfo.StartTime3),
                                 GenerateInParam("@endtime3", SqlDbType.DateTime,8,suitPromotionInfo.EndTime3),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,suitPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,suitPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,suitPromotionInfo.Name),
                                 GenerateInParam("@quotaupper", SqlDbType.Int,4,suitPromotionInfo.QuotaUpper),
                                 GenerateInParam("@onlyonce", SqlDbType.TinyInt, 1, suitPromotionInfo.OnlyOnce),
                                 GenerateInParam("@pmid", SqlDbType.Int,4,suitPromotionInfo.PmId)
                             };
     string commandText = string.Format("UPDATE [{0}suitpromotions] SET [starttime1][email protected],[endtime1][email protected],[starttime2][email protected],[endtime2][email protected],[starttime3][email protected],[endtime3][email protected],[userranklower][email protected],[state][email protected],[name][email protected],[quotaupper][email protected],[onlyonce][email protected] WHERE [pmid][email protected]",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Esempio n. 2
0
 /// <summary>
 /// 创建套装促销活动
 /// </summary>
 public int CreateSuitPromotion(SuitPromotionInfo suitPromotionInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@starttime1", SqlDbType.DateTime,8,suitPromotionInfo.StartTime1),
                                 GenerateInParam("@endtime1", SqlDbType.DateTime,8,suitPromotionInfo.EndTime1),
                                 GenerateInParam("@starttime2", SqlDbType.DateTime,8,suitPromotionInfo.StartTime2),
                                 GenerateInParam("@endtime2", SqlDbType.DateTime,8,suitPromotionInfo.EndTime2),
                                 GenerateInParam("@starttime3", SqlDbType.DateTime,8,suitPromotionInfo.StartTime3),
                                 GenerateInParam("@endtime3", SqlDbType.DateTime,8,suitPromotionInfo.EndTime3),
                                 GenerateInParam("@userranklower", SqlDbType.SmallInt,2,suitPromotionInfo.UserRankLower),
                                 GenerateInParam("@state", SqlDbType.TinyInt,1,suitPromotionInfo.State),
                                 GenerateInParam("@name", SqlDbType.NVarChar,50,suitPromotionInfo.Name),
                                 GenerateInParam("@quotaupper", SqlDbType.Int,4,suitPromotionInfo.QuotaUpper),
                                 GenerateInParam("@onlyonce", SqlDbType.TinyInt, 1, suitPromotionInfo.OnlyOnce)
                             };
     string commandText = string.Format("INSERT INTO [{0}suitpromotions]([starttime1],[endtime1],[starttime2],[endtime2],[starttime3],[endtime3],[userranklower],[state],[name],[quotaupper],[onlyonce]) VALUES(@starttime1,@endtime1,@starttime2,@endtime2,@starttime3,@endtime3,@userranklower,@state,@name,@quotaupper,@onlyonce);SELECT SCOPE_IDENTITY();",
                                         RDBSHelper.RDBSTablePre);
     return TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms), -1);
 }
Esempio n. 3
0
        public ActionResult AddSuitPromotion(SuitPromotionModel model)
        {
            if (ModelState.IsValid)
            {
                DateTime noTime = new DateTime(1900, 1, 1);

                SuitPromotionInfo suitPromotionInfo = new SuitPromotionInfo()
                {
                    StartTime1 = model.StartTime1,
                    EndTime1 = model.EndTime1,
                    StartTime2 = model.StartTime2.HasValue ? model.StartTime2.Value : noTime,
                    EndTime2 = model.EndTime2.HasValue ? model.EndTime2.Value : noTime,
                    StartTime3 = model.StartTime3.HasValue ? model.StartTime3.Value : noTime,
                    EndTime3 = model.EndTime3.HasValue ? model.EndTime3.Value : noTime,
                    UserRankLower = model.UserRankLower,
                    State = model.State,
                    Name = model.PromotionName,
                    QuotaUpper = model.QuotaUpper,
                    OnlyOnce = model.OnlyOnce
                };

                AdminPromotions.CreateSuitPromotion(suitPromotionInfo);
                AddAdminOperateLog("添加套装促销活动", "添加套装促销活动,套装促销活动为:" + model.PromotionName);
                return PromptView("套装促销活动添加成功");
            }

            LoadSuitPromotion();
            return View(model);
        }
Esempio n. 4
0
 /// <summary>
 /// 创建套装促销活动
 /// </summary>
 public static int CreateSuitPromotion(SuitPromotionInfo suitPromotionInfo)
 {
     return BrnShop.Core.BSPData.RDBS.CreateSuitPromotion(suitPromotionInfo);
 }
Esempio n. 5
0
 /// <summary>
 /// 从IDataReader创建SuitPromotionInfo
 /// </summary>
 public static SuitPromotionInfo BuildSuitPromotionFromReader(IDataReader reader)
 {
     SuitPromotionInfo suitPromotionInfo = new SuitPromotionInfo();
     suitPromotionInfo.PmId = TypeHelper.ObjectToInt(reader["pmid"]);
     suitPromotionInfo.StartTime1 = TypeHelper.ObjectToDateTime(reader["starttime1"]);
     suitPromotionInfo.EndTime1 = TypeHelper.ObjectToDateTime(reader["endtime1"]);
     suitPromotionInfo.StartTime2 = TypeHelper.ObjectToDateTime(reader["starttime2"]);
     suitPromotionInfo.EndTime2 = TypeHelper.ObjectToDateTime(reader["endtime2"]);
     suitPromotionInfo.StartTime3 = TypeHelper.ObjectToDateTime(reader["starttime3"]);
     suitPromotionInfo.EndTime3 = TypeHelper.ObjectToDateTime(reader["endtime3"]);
     suitPromotionInfo.UserRankLower = TypeHelper.ObjectToInt(reader["userranklower"]);
     suitPromotionInfo.State = TypeHelper.ObjectToInt(reader["state"]);
     suitPromotionInfo.Name = reader["name"].ToString();
     suitPromotionInfo.QuotaUpper = TypeHelper.ObjectToInt(reader["quotaupper"]);
     suitPromotionInfo.OnlyOnce = TypeHelper.ObjectToInt(reader["onlyonce"]);
     return suitPromotionInfo;
 }
Esempio n. 6
0
 /// <summary>
 /// 更新套装促销活动
 /// </summary>
 public static void UpdateSuitPromotion(SuitPromotionInfo suitPromotionInfo)
 {
     BrnShop.Core.BSPData.RDBS.UpdateSuitPromotion(suitPromotionInfo);
     if (_promotionnosql != null)
         _promotionnosql.DeleteSuitPromotion(suitPromotionInfo.PmId);
 }