public void Update(SecondhandProductModel model) { DbCommand Command = dbw.GetStoredProcCommand("UP_mwSecondhandProduct_Update"); dbw.AddInParameter(Command, "@SeProductID", DbType.Int32, model.SecondhandProductID); dbw.AddInParameter(Command, "@SeProductName", DbType.String, model.SecondhandProductName); dbw.AddInParameter(Command, "@SmallImage", DbType.String, model.SmallImage); dbw.AddInParameter(Command, "@MediumImage", DbType.String, model.MediumImage); dbw.AddInParameter(Command, "@CateID", DbType.Int32, model.CateID); dbw.AddInParameter(Command, "@CatePath", DbType.String, model.CatePath); dbw.AddInParameter(Command, "@Price", DbType.Decimal, model.Price); dbw.AddInParameter(Command, "@Stock", DbType.Int32, model.Stock); dbw.AddInParameter(Command, "@usagecondition", DbType.Int32, model.UsageCondition); dbw.AddInParameter(Command, "@Brief", DbType.String, model.Brief); dbw.AddInParameter(Command, "@UserID", DbType.String, model.UserID); dbw.AddInParameter(Command, "@Status", DbType.Int32, model.Status); dbw.AddInParameter(Command, "@SortValue", DbType.Int32, model.SortValue); dbw.AddInParameter(Command, "@truename", DbType.String, model.TrueName); dbw.AddInParameter(Command, "@phone", DbType.String, model.Phone); dbw.AddInParameter(Command, "@cellphone", DbType.String, model.CellPhone); dbw.AddInParameter(Command, "@postcode", DbType.String, model.PostCode); dbw.AddInParameter(Command, "@region", DbType.String, model.Region); dbw.AddInParameter(Command, "@address", DbType.String, model.Address); dbw.AddInParameter(Command, "@InsertTime", DbType.DateTime, model.InsertTime); dbw.AddInParameter(Command, "@UpdateTime", DbType.DateTime, model.UpdateTime); dbw.ExecuteNonQuery(Command); }
private SecondhandProductModel BindModel(DataRow row) { SecondhandProductModel model = new SecondhandProductModel() { Address = Convert.ToString(row["Address"]), Brief = Convert.ToString(row["Brief"]), CateID = Convert.ToInt32(row["CateID"]), CatePath = Convert.ToString(row["CatePath"]), CellPhone = Convert.ToString(row["CellPhone"]), InsertTime = Convert.ToDateTime(row["InsertTime"]), MediumImage = Convert.ToString(row["MediumImage"]), Phone = Convert.ToString(row["Phone"]), PostCode = Convert.ToString(row["PostCode"]), Price = Convert.ToDecimal(row["Price"]), Region = Convert.ToString(row["region"]), SecondhandProductID = Convert.ToInt32(row["SeProductID"]), SecondhandProductName = Convert.ToString(row["SeProductName"]), SmallImage = Convert.ToString(row["SmallImage"]), SortValue = Convert.ToInt32(row["SortValue"]), Status = Convert.ToInt32(row["Status"]), Stock = Convert.ToInt32(row["Stock"]), TrueName = Convert.ToString(row["truename"]), UpdateTime = Convert.ToDateTime(row["UpdateTime"]), UsageCondition = Convert.ToInt32(row["usagecondition"]), UserID = Convert.ToString(row["UserID"]) }; return(model); }
private void BindData() { SecondhandProductModel model = bll.GetModel(SecondhandProductID); if (model.Status != (int)SecondhandProductStatus.尚未审核) { MessageBox.Show(this, "该商品已被审核,禁止编辑!"); Response.Redirect("List.aspx"); return; } DropDown_Usage.DataSource = DataTableUtil.GetEnumKeyValue(typeof(SecondhandProductUsageCondition)); DropDown_Usage.DataTextField = "key"; DropDown_Usage.DataValueField = "value"; DropDown_Usage.DataBind(); CategoryID = model.CateID; if (!String.IsNullOrEmpty(Request.QueryString["categoryid"])) { CategoryID = Convert.ToInt32(Request.QueryString["categoryid"]); } TextBox_Category.Text = new MagicCategoryBll().GetModel(CategoryID).CategoryName; TextBox_ProductName.Text = model.SecondhandProductName; TextBox_Price.Text = model.Price.ToString("0.00"); TextBox_Count.Text = model.Stock.ToString(); DropDown_Usage.SelectedValue = model.UsageCondition.ToString(); 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; ucRegion.PresetRegionInfo(RegionInfo.GetRegionPathByName(model.Region.Split(' ')[model.Region.Split(' ').Length - 1])); }
public SecondhandProductModel GetModel(int SecondhandProductID) { DbCommand Command = dbr.GetStoredProcCommand("UP_mwSecondhandProduct_GetModel"); dbr.AddInParameter(Command, "@SeProductID", DbType.Int32, SecondhandProductID); DataTable dt = dbr.ExecuteDataSet(Command).Tables[0]; SecondhandProductModel model = null; if (dt.Rows.Count > 0) { model = BindModel(dt.Rows[0]); } return(model); }
private void BindData() { SecondhandProductModel model = bll.GetModel(SecondhandProductID); MemberInfo user = MemberInfo.GetFullInfo(model.UserID); Image_Small.ImageUrl = MagicWorldImageRule.GetMainImageUrl(model.SmallImage); Image_Large.ImageUrl = MagicWorldImageRule.GetMainImageUrl(model.MediumImage); Literal_ProductName.Text = model.SecondhandProductName; Literal_Price.Text = model.Price.ToString("0.00"); Literal_Stock.Text = model.Stock.ToString(); Literal_CategoryName.Text = model.CateID.ToString(); Literal_Condition.Text = Enum.GetName(typeof(SecondhandProductUsageCondition), model.UsageCondition); Literal_Description.Text = model.Brief; Literal_Nick.Text = user.UserId; Literal_Level.Text = user.UserLevel.ToString(); Literal_Phone.Text = String.IsNullOrEmpty(model.Phone) ? model.CellPhone : model.Phone; Literal_Province.Text = String.IsNullOrEmpty(model.Region) ? String.Empty : model.Region.Split(' ')[0]; Repeater_Comment.DataSource = CmtBll.GetList(AppType.MagicWorld, SecondhandProductID); Repeater_Comment.DataBind(); }
public void Update(SecondhandProductModel model) { dal.Update(model); }
public void Add(SecondhandProductModel model) { dal.Add(model); }