Пример #1
0
 /// <summary>
 /// 更新定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public static void UpdateTimeProduct(TimeProductInfo timeProductInfo)
 {
     BrnMall.Data.Products.UpdateTimeProduct(timeProductInfo);
 }
Пример #2
0
 /// <summary>
 /// 更新定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public void UpdateTimeProduct(TimeProductInfo timeProductInfo)
 {
     DbParameter[] parms = {
                             GenerateInParam("@pid", SqlDbType.Int, 4, timeProductInfo.Pid),
                             GenerateInParam("@storeid", SqlDbType.Int, 4, timeProductInfo.StoreId),
                             GenerateInParam("@onsalestate", SqlDbType.TinyInt, 1, timeProductInfo.OnSaleState),
                             GenerateInParam("@outsalestate", SqlDbType.TinyInt, 1, timeProductInfo.OutSaleState),
                             GenerateInParam("@onsaletime", SqlDbType.DateTime, 8, timeProductInfo.OnSaleTime),
                             GenerateInParam("@outsaletime", SqlDbType.DateTime, 8,timeProductInfo.OutSaleTime),
                             GenerateInParam("@recordid", SqlDbType.Int, 4, timeProductInfo.RecordId)
                             };
     string commandText = string.Format("UPDATE [{0}timeproducts] SET [pid]=@pid,[storeid]=@storeid,[onsalestate]=@onsalestate,[outsalestate]=@outsalestate,[onsaletime]=@onsaletime,[outsaletime]=@outsaletime WHERE [recordid]=@recordid",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Пример #3
0
 /// <summary>
 /// 添加定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public static void AddTimeProduct(TimeProductInfo timeProductInfo)
 {
     BrnMall.Data.Products.AddTimeProduct(timeProductInfo);
 }
Пример #4
0
 /// <summary>
 /// 添加定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public void AddTimeProduct(TimeProductInfo timeProductInfo)
 {
     DbParameter[] parms = {
                             GenerateInParam("@pid", SqlDbType.Int, 4, timeProductInfo.Pid),
                             GenerateInParam("@storeid", SqlDbType.Int, 4, timeProductInfo.StoreId),
                             GenerateInParam("@onsalestate", SqlDbType.TinyInt, 1, timeProductInfo.OnSaleState),
                             GenerateInParam("@outsalestate", SqlDbType.TinyInt, 1, timeProductInfo.OutSaleState),
                             GenerateInParam("@onsaletime", SqlDbType.DateTime, 8, timeProductInfo.OnSaleTime),
                             GenerateInParam("@outsaletime", SqlDbType.DateTime, 8,timeProductInfo.OutSaleTime)
                             };
     string commandText = string.Format("INSERT INTO [{0}timeproducts]([pid],[storeid],[onsalestate],[outsalestate],[onsaletime],[outsaletime]) VALUES(@pid,@storeid,@onsalestate,@outsalestate,@onsaletime,@outsaletime)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Пример #5
0
        /// <summary>
        /// 从IDataReader创建TimeProductInfo
        /// </summary>
        public static TimeProductInfo BuildTimeProductFromReader(IDataReader reader)
        {
            TimeProductInfo timeProductInfo = new TimeProductInfo();

            timeProductInfo.RecordId = TypeHelper.ObjectToInt(reader["recordid"]);
            timeProductInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]);
            timeProductInfo.Pid = TypeHelper.ObjectToInt(reader["pid"]);
            timeProductInfo.OnSaleState = TypeHelper.ObjectToInt(reader["onsalestate"]);
            timeProductInfo.OutSaleState = TypeHelper.ObjectToInt(reader["outsalestate"]);
            timeProductInfo.OnSaleTime = TypeHelper.ObjectToDateTime(reader["onsaletime"]);
            timeProductInfo.OutSaleTime = TypeHelper.ObjectToDateTime(reader["outsaletime"]);

            return timeProductInfo;
        }
Пример #6
0
 /// <summary>
 /// 更新定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public static void UpdateTimeProduct(TimeProductInfo timeProductInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateTimeProduct(timeProductInfo);
 }
Пример #7
0
 /// <summary>
 /// 添加定时商品
 /// </summary>
 /// <param name="timeProductInfo">定时商品信息</param>
 public static void AddTimeProduct(TimeProductInfo timeProductInfo)
 {
     BrnMall.Core.BMAData.RDBS.AddTimeProduct(timeProductInfo);
 }
Пример #8
0
        public ActionResult AddTimeProduct(TimeProductModel model)
        {
            PartProductInfo partProductInfo = AdminProducts.AdminGetPartProductById(model.Pid);
            if (partProductInfo == null)
                ModelState.AddModelError("Pid", "请选择商品");
            if (AdminProducts.IsExistTimeProduct(model.Pid))
                ModelState.AddModelError("Pid", "此商品已经存在");

            if (ModelState.IsValid)
            {
                DateTime noTime = new DateTime(1900, 1, 1);
                TimeProductInfo timeProductInfo = new TimeProductInfo()
                {
                    Pid = model.Pid,
                    StoreId = partProductInfo.StoreId,
                    OnSaleState = model.OnSaleTime == null ? 0 : 1,
                    OutSaleState = model.OutSaleTime == null ? 0 : 1,
                    OnSaleTime = model.OnSaleTime == null ? noTime : model.OnSaleTime.Value,
                    OutSaleTime = model.OutSaleTime == null ? noTime : model.OutSaleTime.Value
                };
                AdminProducts.AddTimeProduct(timeProductInfo);
                AddMallAdminLog("添加定时商品", "添加定时商品,定时商品为:" + partProductInfo.Name);
                return PromptView("定时商品添加成功");
            }
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return View(model);
        }