/// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(AuctionProductModel model)
        {
            DbCommand dbCommand = dbw.GetStoredProcCommand("UP_mwAuctionProduct_Update");

            dbw.AddInParameter(dbCommand, "AuctionId", DbType.Int32, model.AuctionID);
            dbw.AddInParameter(dbCommand, "ProductName", DbType.AnsiString, model.ProductName);
            dbw.AddInParameter(dbCommand, "SmallImage", DbType.AnsiString, model.SmallImage);
            dbw.AddInParameter(dbCommand, "MediumImage", DbType.AnsiString, model.MediumImage);
            dbw.AddInParameter(dbCommand, "OutLinkUrl", DbType.AnsiString, model.OutLinkUrl);
            dbw.AddInParameter(dbCommand, "StartPrice", DbType.Decimal, model.StartPrice);
            dbw.AddInParameter(dbCommand, "AddPrices", DbType.String, model.AddPrices);
            dbw.AddInParameter(dbCommand, "CurPrice", DbType.Decimal, model.CurPrice);
            dbw.AddInParameter(dbCommand, "Brief", DbType.AnsiString, model.Brief);
            dbw.AddInParameter(dbCommand, "StartTime", DbType.DateTime, model.StartTime);
            dbw.AddInParameter(dbCommand, "EndTime", DbType.DateTime, model.EndTime);
            dbw.AddInParameter(dbCommand, "Status", DbType.Byte, model.Status);
            dbw.AddInParameter(dbCommand, "@CateID", DbType.Int32, model.CategoryID);
            dbw.AddInParameter(dbCommand, "@CatePath", DbType.String, model.CategoryPath);
            dbw.AddInParameter(dbCommand, "@userid", DbType.String, model.UserID);
            dbw.AddInParameter(dbCommand, "@truename", DbType.String, model.TrueName);
            dbw.AddInParameter(dbCommand, "@phone", DbType.String, model.Phone);
            dbw.AddInParameter(dbCommand, "@cellphone", DbType.String, model.CellPhone);
            dbw.AddInParameter(dbCommand, "@postcode", DbType.String, model.PostCode);
            dbw.AddInParameter(dbCommand, "@region", DbType.String, model.Region);
            dbw.AddInParameter(dbCommand, "@address", DbType.String, model.Address);
            dbw.AddInParameter(dbCommand, "@inserttime", DbType.String, model.InsertTime);
            dbw.AddInParameter(dbCommand, "@updatetime", DbType.String, model.UpdateTime);

            dbw.ExecuteNonQuery(dbCommand);
        }
예제 #2
0
        private void BindData()
        {
            AuctionProductModel model   = bll.GetModel(AuctionID);
            MagicCategoryBll    cateBll = new MagicCategoryBll();

            if (model.Status != (int)AuctionProductStatus.尚未审核)
            {
                MessageBox.Show(this, "该商品已被审核,禁止编辑!");
                Response.Redirect("List.aspx");
                return;
            }

            CategoryID = model.CategoryID;
            if (!String.IsNullOrEmpty(Request.QueryString["categoryid"]))
            {
                CategoryID = Convert.ToInt32(Request.QueryString["categoryid"]);
            }

            TextBox_Category.Text    = new MagicCategoryBll().GetModel(CategoryID).CategoryName;
            TextBox_ProductName.Text = StringUtility.RemoveHtmlTags(model.ProductName);
            TextBox_StartPrice.Text  = model.StartPrice.ToString("0.00");
            TextBox_AddPrices.Text   = model.AddPrices;
            TextBox_StartTime.Text   = model.StartTime.ToString("yyyy-MM-dd");
            TextBox_EndTime.Text     = model.EndTime.ToString("yyyy-MM-dd");
            TextBox_Brief.Text       = model.Brief;
            TextBox_TrueName.Text    = model.TrueName;
            TextBox_Phone.Text       = model.Phone;
            TextBox_CellPhone.Text   = model.CellPhone;
            TextBox_PostCode.Text    = model.PostCode;
            TextBox_Address.Text     = model.Address;

            string[] LastRegion = model.Region.Split(' ');
            ucRegion.PresetRegionInfo(RegionInfo.GetRegionPathByName(LastRegion[String.IsNullOrEmpty(LastRegion[2]) ? 1 : 2]));
        }
예제 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <AuctionProductModel> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List <AuctionProductModel> modelList = new List <AuctionProductModel>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                AuctionProductModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new AuctionProductModel();
                    if (ds.Tables[0].Rows[n]["AuctionId"].ToString() != "")
                    {
                        model.AuctionID = int.Parse(ds.Tables[0].Rows[n]["AuctionId"].ToString());
                    }
                    model.ProductName = ds.Tables[0].Rows[n]["ProductName"].ToString();
                    model.SmallImage  = ds.Tables[0].Rows[n]["SmallImage"].ToString();
                    model.MediumImage = ds.Tables[0].Rows[n]["MediumImage"].ToString();
                    model.OutLinkUrl  = ds.Tables[0].Rows[n]["OutLinkUrl"].ToString();
                    if (ds.Tables[0].Rows[n]["StartPrice"].ToString() != "")
                    {
                        model.StartPrice = decimal.Parse(ds.Tables[0].Rows[n]["StartPrice"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["AddPrices"].ToString() != "")
                    {
                        model.AddPrices = ds.Tables[0].Rows[n]["AddPrices"].ToString();
                    }
                    if (ds.Tables[0].Rows[n]["CurPrice"].ToString() != "")
                    {
                        model.CurPrice = decimal.Parse(ds.Tables[0].Rows[n]["CurPrice"].ToString());
                    }
                    model.Brief = ds.Tables[0].Rows[n]["Brief"].ToString();
                    if (ds.Tables[0].Rows[n]["StartTime"].ToString() != "")
                    {
                        model.StartTime = DateTime.Parse(ds.Tables[0].Rows[n]["StartTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["EndTime"].ToString() != "")
                    {
                        model.EndTime = DateTime.Parse(ds.Tables[0].Rows[n]["EndTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(ds.Tables[0].Rows[n]["Status"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public AuctionProductModel GetModel(int AuctionId)
        {
            DbCommand dbCommand = dbr.GetStoredProcCommand("UP_mwAuctionProduct_GetModel");

            dbr.AddInParameter(dbCommand, "AuctionId", DbType.Int32, AuctionId);

            AuctionProductModel model = null;

            using (IDataReader dataReader = dbr.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
예제 #5
0
        protected void Repeater_AddPrices_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "b")
            {
                if (CurrentUser != null)
                {
                    AuctionLogModel LastAuction = LogBll.GetLastAuction(AuctionID);
                    if (LastAuction != null && LastAuction.UserName == CurrentUser.UserId)
                    {
                        MessageBox.Show(this, "尚无竞拍者的出价高于您");
                        return;
                    }

                    decimal             BidPrice = Convert.ToInt32(e.CommandArgument);
                    AuctionProductModel model    = bll.GetModel(AuctionID);


                    decimal CurrentPrice = model.CurPrice + BidPrice;

                    AuctionLogModel LogModel = new AuctionLogModel();
                    LogModel.LogID       = CommDataHelper.GetNewSerialNum(AppType.MagicWorld);
                    LogModel.AuctionID   = AuctionID;
                    LogModel.AuctionTime = DateTime.Now;
                    LogModel.AutionPrice = CurrentPrice;
                    LogModel.UserName    = GetUserName();

                    LogBll.Add(LogModel);

                    model.CurPrice = CurrentPrice;
                    bll.Update(model);

                    Response.Redirect(Request.RawUrl);
                }
                else
                {
                    Response.Redirect("/Login.aspx?returnurl=" + Server.UrlPathEncode(Request.RawUrl));
                }
            }
        }
예제 #6
0
        private void BindData()
        {
            AuctionProductModel model = bll.GetModel(AuctionID);

            DataTable dt = new DataTable(); dt.Columns.Add("price");

            foreach (string s in model.AddPrices.Split(','))
            {
                DataRow row = dt.NewRow();
                row["price"] = decimal.Parse(s);
                dt.Rows.Add(row);
            }
            dt.DefaultView.Sort           = "price asc";
            Repeater_AddPrices.DataSource = dt;
            Repeater_AddPrices.DataBind();

            Image_Large.ImageUrl  = MagicWorldImageRule.GetMainImageUrl(model.MediumImage);
            Image_Medium.ImageUrl = MagicWorldImageRule.GetMainImageUrl(model.SmallImage);

            Literal_ProductName.Text  = model.ProductName;
            Literal_StartPrice.Text   = model.StartPrice.ToString("0.00");
            Literal_CurrentPrice.Text = model.CurPrice.ToString("0.00");;
            Literal_MinAddPrice.Text  = dt.Rows[0]["price"].ToString();
            Literal_MaxAddPrice.Text  = dt.Rows[dt.Rows.Count - 1]["price"].ToString();
            Literal_StartTime.Text    = model.StartTime.ToString("yyyy-MM-dd");
            Literal_EndTime.Text      = model.EndTime.ToString("yyyy-MM-dd");
            Literal_Description.Text  = model.Brief;

            Repeater_BidList.DataSource = LogBll.GetList("auctionid=" + AuctionID + " order by auctiontime desc");
            Repeater_BidList.DataBind();

            Repeater_Comment.DataSource = CmtBll.GetList(AppType.MagicWorld, AuctionID);
            Repeater_Comment.DataBind();


            Repeater_Other.DataSource = bll.GetRelatedProductList(model.CategoryID);
            Repeater_Other.DataBind();
        }
예제 #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(AuctionProductModel model)
 {
     dal.Update(model);
 }
예제 #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(AuctionProductModel model)
 {
     dal.Add(model);
 }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public AuctionProductModel ReaderBind(IDataReader dataReader)
        {
            AuctionProductModel model = new AuctionProductModel();
            object ojb;

            ojb = dataReader["AuctionId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AuctionID = (int)ojb;
            }
            model.ProductName = dataReader["ProductName"].ToString();
            model.SmallImage  = dataReader["SmallImage"].ToString();
            model.MediumImage = dataReader["MediumImage"].ToString();
            model.OutLinkUrl  = dataReader["OutLinkUrl"].ToString();
            ojb = dataReader["StartPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StartPrice = (decimal)ojb;
            }
            ojb = dataReader["AddPrices"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AddPrices = ojb.ToString();
            }
            ojb = dataReader["CurPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CurPrice = (decimal)ojb;
            }
            model.Brief = dataReader["Brief"].ToString();
            ojb         = dataReader["StartTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StartTime = (DateTime)ojb;
            }
            ojb = dataReader["EndTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EndTime = (DateTime)ojb;
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = Convert.ToInt32(ojb);
            }
            ojb = dataReader["cateid"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CategoryID = Convert.ToInt32(ojb);
            }
            ojb = dataReader["catepath"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CategoryPath = Convert.ToString(ojb);
            }

            model.UserID     = Convert.ToString(dataReader["userid"]);
            model.TrueName   = Convert.ToString(dataReader["truename"]);
            model.Phone      = Convert.ToString(dataReader["phone"]);
            model.CellPhone  = Convert.ToString(dataReader["cellphone"]);
            model.PostCode   = Convert.ToString(dataReader["postcode"]);
            model.Region     = Convert.ToString(dataReader["region"]);
            model.Address    = Convert.ToString(dataReader["address"]);
            model.InsertTime = Convert.ToDateTime(dataReader["inserttime"]);
            model.UpdateTime = Convert.ToDateTime(dataReader["updatetime"]);
            return(model);
        }