protected void Button_Question_Click(object sender, EventArgs e) { //验证用户,如果未登录则提示登录 if (String.IsNullOrEmpty(TextBox_QuestionContent.Text.Trim())) { MessageBox.Show(this, "输入问题内容"); return; } QuestionModel model = new QuestionModel(); model.QuestionId = CommDataHelper.GetNewSerialNum(AppType.Other); model.Content = TextBox_QuestionContent.Text.Trim(); model.ContentId = ProductID; model.ContentType = NoName.NetShop.Common.ContentType.Product; model.InsertTime = DateTime.Now; //model.LastAnswerId = ""; //model.LastAnswerTime = ""; model.Title = ""; model.UserId = GetUserID(); questionBll.Add(model); BindQuestionData(AspNetPager.CurrentPageIndex); Response.Redirect(Request.RawUrl); }
private void Insert() { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_Title.Text)) { ErrorMessage += "请输入标题!"; } if (String.IsNullOrEmpty(TextBox_Content.Text)) { ErrorMessage += "请输入内容!"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } ProductSpecificationModel model = new ProductSpecificationModel(); model.SpecificationID = CommDataHelper.GetNewSerialNum(AppType.Product); model.CategoryID = 0; model.CategoryPath = ""; model.Content = TextBox_Content.Text; model.CreateTime = DateTime.Now; model.Title = TextBox_Title.Text; model.Type = Convert.ToInt16(DropDown_Type.SelectedValue); bll.Insert(model); }
protected void btnAdd_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(txtCateName.Text)) { ErrorMessage += "分类名称不可为空"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } MagicCategoryModel model = new MagicCategoryModel(); MagicCategoryModel ParentModel = bll.GetModel(ParentID); model.CategoryID = CommDataHelper.GetNewSerialNum(AppType.MagicWorld); model.CategoryLevel = ParentModel == null?0:ParentModel.CategoryLevel + 1; model.CategoryName = txtCateName.Text; model.CategoryPath = ParentModel == null?model.CategoryID.ToString() : ParentModel.CategoryPath + "/" + model.CategoryID; model.IsHide = chkIsHide.Checked; model.ParentID = ParentID; model.ShowOrder = model.CategoryID; model.Status = 0; bll.Add(model); MessageBox.Show(this, "添加成功!"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">window.parent.location=window.parent.location+'?_=" + DateTime.Now.Ticks + "'</script>"); }
protected void Button_Submit_Click(object sender, EventArgs e) { if (TextBox_CategoryName.Text != String.Empty) { NewsCategoryModel model = new NewsCategoryModel(); int ParentID = Convert.ToInt32(Input_ParentCategoryID.Value); NewsCategoryModel pModel = bll.GetModel(ParentID); model.CateID = CommDataHelper.GetNewSerialNum("ne"); model.CateLevel = pModel == null?0:pModel.CateLevel + 1; model.CateName = TextBox_CategoryName.Text; model.IsHide = Convert.ToInt32(DropDownList_IsHide.SelectedValue) == 1?true:false; model.ParentID = ParentID; model.ShowOrder = model.CateID; model.Status = 1; bll.Add(model); MessageBox.Show(this, "添加成功!"); Response.Redirect("list.aspx"); } else { MessageBox.Show(this, "请输入分类名称"); } }
protected void Button_Submit_Click(object sender, EventArgs e) { if (CurrentUser != null) { GroupApplyModel model = new GroupApplyModel(); model.GroupApplyID = CommDataHelper.GetNewSerialNum(AppType.GroupShopping); model.ApplyBrief = TextBox_Message.Text; model.ApplyStatus = (int)GroupProductApplyStatus.申请中; model.ApplyTime = DateTime.Now; model.ConfirmTime = DateTime.Now; model.GroupProductID = Convert.ToInt32(Request.QueryString["productid"]); model.UserID = CurrentUser.UserId; abll.Add(model); if (Session["group-product-apply"] != null) { Session.Remove("group-product-apply"); } MessageBox.ShowAndRedirect(this, "申请成功,请等待管理员审批", Request.RawUrl); } else { Session["group-product-apply"] = TextBox_Message.Text; Response.Redirect("/Login.aspx?returnurl=" + Request.RawUrl); } }
protected void Button_Comment_Click(object sender, EventArgs e) { //验证用户,如果未登录则提示登录 if (String.IsNullOrEmpty(TextBox_CommentContent.Text.Trim())) { MessageBox.Show(this, "请输入评论内容"); return; } //验证是否已经购买此商品,否则不允许评论 else if (!MemberInfo.ExistsOrderProduct(GetUserID(), ProductID)) { MessageBox.Show(this, "您尚未购买此商品!"); return; } CommentModel model = new CommentModel(); model.AppType = AppType.Product; model.CommentID = CommDataHelper.GetNewSerialNum(AppType.Product); model.Content = TextBox_CommentContent.Text.Trim(); model.CreateTime = DateTime.Now; model.TargetID = ProductID; model.UserID = GetUserID(); BindCommentData(AspNetPager.CurrentPageIndex); commentBll.Add(model); Response.Redirect(Request.RawUrl); }
private void BindList() { gvList.DataSource = CommDataHelper.GetDataFromSingleTableByPage(SearPageInfo); gvList.DataBind(); pageNav.CurrentPageIndex = SearPageInfo.PageIndex; pageNav.PageSize = SearPageInfo.PageSize; pageNav.RecordCount = SearPageInfo.TotalItem; }
protected void Button_Add_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_ProductName.Text.Trim())) ErrorMessage += "产品名称不能为空\\n"; if (String.IsNullOrEmpty(TextBox_MarketPrice.Text.Trim()) || !PageValidate.IsDecimal(TextBox_MarketPrice.Text.Trim())) ErrorMessage += "市场价输入有误\\n"; if (String.IsNullOrEmpty(TextBox_GroupPrice.Text.Trim()) || !PageValidate.IsDecimal(TextBox_GroupPrice.Text.Trim())) ErrorMessage += "团购价输入有误\\n"; if (String.IsNullOrEmpty(TextBox_PrePaidPrice.Text.Trim()) || !PageValidate.IsDecimal(TextBox_PrePaidPrice.Text.Trim())) ErrorMessage += "预付金额输入有误\\n"; if (String.IsNullOrEmpty(TextBox_SuccedLine.Text.Trim()) || !PageValidate.IsNumber(TextBox_SuccedLine.Text.Trim())) ErrorMessage += "成团人数输入有误"; if (String.IsNullOrEmpty(TextBox_Brief.Text.Trim())) ErrorMessage += "产品简介不能为空\\n"; if (String.IsNullOrEmpty(FileUpload_Image.FileName.Trim())) ErrorMessage += "产品图片不能为空\\n"; if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } int GroupProductID = CommDataHelper.GetNewSerialNum(AppType.GroupShopping); string[] FileNames = new string[3]; if (GroupShoppingImageRule.SaveImage(GroupProductID, FileUpload_Image.PostedFile, out FileNames)) { GroupProductModel model = new GroupProductModel(); model.ProductID = GroupProductID; model.ProductName = TextBox_ProductName.Text.Trim(); model.ProductType = Convert.ToInt32(DropDown_ProductType.SelectedValue); model.ProductCode = TextBox_ProductCode.Text.Trim(); model.MarketPrice = Convert.ToDecimal(TextBox_MarketPrice.Text.Trim()); model.GroupPrice = Convert.ToDecimal(TextBox_GroupPrice.Text.Trim()); model.PrePaidPrice = Convert.ToDecimal(TextBox_PrePaidPrice.Text.Trim()); model.SuccedLine = Convert.ToInt32(TextBox_SuccedLine.Text.Trim()); model.IsRecommend = CheclBox_Recommend.Checked; model.Detail = TextBox_Detail.Text.Trim(); model.Description = TextBox_Brief.Text; model.SmallImage = FileNames[0]; model.MediumImage = FileNames[1]; model.LargeImage = FileNames[2]; model.InsertTime = DateTime.Now; model.ChangeTime = DateTime.Now; model.Status = (int)GroupShoppingProductStatus.正在团购; new GroupProductBll().Add(model); Response.Redirect("List.aspx"); } else { MessageBox.Show(this, "图片上传失败,请检查后重新选择!"); return; } }
public DataTable GetProductList(int CategoryID, int PageIndex, int BrandID, decimal[] PriceRange, int OrderType, Hashtable Parameters, out int RecordCount, out int PageCount) { string where = String.Empty; int i = 0; if (Parameters != null) { foreach (string key in Parameters.Keys) { CategoryParaModel para = new CategoryParaModelBll().GetModel(Convert.ToInt32(key), CategoryID); if (i == Parameters.Count - 1) { where += String.Format(" and (pdproductpara.paraid = {0} and pdproductpara.paravalue like '%{1}%') ", key, para.ParaValues.Split(',')[Convert.ToInt32(Parameters[key])]); } else { where += String.Format(" and (pdproductpara.paraid = {0} and pdproductpara.paravalue like '%{1}%') ", key, para.ParaValues.Split(',')[Convert.ToInt32(Parameters[key])]); } i++; } } if (BrandID != 0) { where += " and pdproduct.brandid=" + BrandID; } if (PriceRange != null && PriceRange.Length == 2) { where += String.Format(" and pdproduct.merchantprice >= {0} and pdproduct.merchantprice <= {1}", PriceRange[0], PriceRange[1] + 0.99M); } string CategoryPath = Convert.ToString(GetCategoryInfo(CategoryID)["catepath"]); where += String.Format(" and pdproduct.catepath like '{0}%'", CategoryPath); where += " and pdproduct.status = 1"; SearchPageInfo pageInfo = new SearchPageInfo(); pageInfo.TableName = "pdproductpara"; pageInfo.PriKeyName = "productid"; pageInfo.FieldNames = "pdproduct.productid,paraid,paravalue,productname,pdcategory.cateid,pdcategory.catepath,tradeprice,merchantprice,reduceprice,stock,smallimage,mediumimage,largeimage,keywords,brief,pageview,inserttime,changetime,pdproduct.status,score"; pageInfo.TotalFieldStr = ""; pageInfo.PageSize = Config.ListPageSize; pageInfo.PageIndex = PageIndex; pageInfo.OrderType = GetOrderString(OrderType); pageInfo.StrWhere = "1=1 " + where; pageInfo.StrJoin = " inner join pdproduct on pdproduct.productid=pdproductpara.productid inner join pdcategory on pdproduct.cateid=pdcategory.cateid "; DataTable dt = CommDataHelper.GetDataFromMultiTablesByPage(pageInfo).Tables[0]; RecordCount = pageInfo.TotalItem; PageCount = pageInfo.TotalPage; return(dt); }
private void BindList() { DataSet ds = CommDataHelper.GetDataFromSingleTableByPage(SearPageInfo); rpProducts.DataSource = ds.Tables[0]; rpProducts.DataBind(); //panNoResult.Visible = ds.Tables[0].Rows.Count == 0; pageNav.CurrentPageIndex = SearPageInfo.PageIndex; pageNav.PageSize = SearPageInfo.PageSize; pageNav.RecordCount = SearPageInfo.TotalItem; }
/// <summary> /// 增加一条数据 /// </summary> public void Save(ScenceModel model) { if (model.ScenceId == 0) { model.ScenceId = CommDataHelper.GetNewSerialNum(AppType.Solution); } DbCommand dbCommand = dbw.GetStoredProcCommand("UP_slScence_Save"); dbw.AddInParameter(dbCommand, "ScenceId", DbType.Int32, model.ScenceId); dbw.AddInParameter(dbCommand, "ScenceName", DbType.AnsiString, model.ScenceName); dbw.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark); dbw.AddInParameter(dbCommand, "SenceImg", DbType.AnsiString, model.SenceImg); dbw.AddInParameter(dbCommand, "SenceType", DbType.Byte, model.SenceType); dbw.AddInParameter(dbCommand, "IsActive", DbType.Boolean, model.IsActive); dbw.ExecuteNonQuery(dbCommand); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Member.FavoriteModel model) { Database db = CommDataAccess.DbWriter; if (!this.Exists(model.UserId, model.ContentId, model.ContentType)) { model.FavoriteId = CommDataHelper.GetNewSerialNum(AppType.Other); DbCommand dbCommand = db.GetStoredProcCommand("UP_umFavorite_ADD"); db.AddInParameter(dbCommand, "UserId", DbType.AnsiString, model.UserId); db.AddInParameter(dbCommand, "FavoriteId", DbType.Int32, model.FavoriteId); db.AddInParameter(dbCommand, "FavoriteUrl", DbType.AnsiString, model.FavoriteUrl); db.AddInParameter(dbCommand, "FavoriteName", DbType.AnsiString, model.FavoriteName); db.AddInParameter(dbCommand, "ContentId", DbType.Int32, model.ContentId); db.AddInParameter(dbCommand, "ContentType", DbType.Byte, model.ContentType); db.ExecuteNonQuery(dbCommand); } }
internal override string SaveOrderInfo() { string sql = "orders_Save_Suit"; DbCommand comm = CommDataAccess.DbWriter.GetStoredProcCommand(sql); if (!String.IsNullOrEmpty(this.OrderId) && this.Exists()) { throw new NoName.NetShop.Common.ShopException("订单已经被存储过了"); } else { this.OrderId = CommDataHelper.GetNewSerialStr(AppType.Order); CommDataAccess.DbWriter.AddInParameter(comm, "OrderID", DbType.String, this.OrderId); CommDataAccess.DbWriter.AddInParameter(comm, "PayMethod", DbType.Int32, PayMethodId); CommDataAccess.DbWriter.AddInParameter(comm, "ShipMethod", DbType.Int32, ShipMethodId); CommDataAccess.DbWriter.AddInParameter(comm, "PaySum", DbType.Decimal, TotalSum); CommDataAccess.DbWriter.AddInParameter(comm, "ShipFee", DbType.Decimal, this.ShipFee); CommDataAccess.DbWriter.AddInParameter(comm, "ProductFee", DbType.Decimal, ProductSum); CommDataAccess.DbWriter.AddInParameter(comm, "DerateFee", DbType.Decimal, this.DerateFee); CommDataAccess.DbWriter.AddInParameter(comm, "isNeedInvoice", DbType.Boolean, !String.IsNullOrEmpty(Invoice)); CommDataAccess.DbWriter.AddInParameter(comm, "InvoiceTitle", DbType.String, Invoice); CommDataAccess.DbWriter.AddInParameter(comm, "UserNotes", DbType.String, UserNotes); CommDataAccess.DbWriter.AddInParameter(comm, "serverip", DbType.String, ServerIp); CommDataAccess.DbWriter.AddInParameter(comm, "ClientIp", DbType.String, ClientIp); CommDataAccess.DbWriter.AddInParameter(comm, "OrderType", DbType.Int32, (int)OpType); CommDataAccess.DbWriter.AddInParameter(comm, "userId", DbType.String, Address.UserId); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverName", DbType.String, Address.RecieverName); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverEmail", DbType.String, Address.Email); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCountry", DbType.String, Address.Country); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverProvince", DbType.String, Address.Province); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCity", DbType.String, Address.City); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCounty", DbType.String, Address.County); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverPhone", DbType.String, (Address.Telephone + " " + Address.Mobile).Trim()); CommDataAccess.DbWriter.AddInParameter(comm, "AddressDetial", DbType.String, Address.AddressDetail); CommDataAccess.DbWriter.AddInParameter(comm, "PostalCode", DbType.String, Address.Postalcode); CommDataAccess.DbWriter.AddInParameter(comm, "SuitId", DbType.Int32, this.SuitId); CommDataAccess.DbWriter.ExecuteNonQuery(comm); return(this.OrderId); } }
public DataTable GetProductList(int CategoryID, int PageIndex, int BrandID, decimal[] PriceRange, int OrderType, out int RecordCount, out int PageCount) { SearchPageInfo pageinfo = new SearchPageInfo(); string CategoryPath = Convert.ToString(GetCategoryInfo(CategoryID)["catepath"]); string where = String.Format(" catepath like '{0}%'", CategoryPath); where += " and status = " + (int)ProductStatus.架; if (BrandID != 0) { where += " and pdproduct.brandid=" + BrandID; } if (PriceRange != null && PriceRange.Length == 2) { if (PriceRange[1] == 0) { where += String.Format(" and pdproduct.merchantprice >= {0} ", PriceRange[0]); } else { where += String.Format(" and pdproduct.merchantprice >= {0} and pdproduct.merchantprice <= {1}", PriceRange[0], PriceRange[1] + 0.99M); } } pageinfo.FieldNames = "[ProductId],[ProductName],[ProductCode],[CatePath],[CateId],[TradePrice],[MerchantPrice],[ReducePrice],[Stock],[SmallImage],[MediumImage],[LargeImage],[Keywords],[Brief],[PageView],[InsertTime],[ChangeTime],[Status],[SortValue],[Score]"; pageinfo.OrderType = "SortValue asc"; pageinfo.PageIndex = PageIndex; pageinfo.PageSize = Config.ListPageSize; pageinfo.PriKeyName = "ProductId"; pageinfo.StrWhere = where; pageinfo.TableName = "pdproduct"; pageinfo.OrderType = GetOrderString(OrderType); pageinfo.TotalFieldStr = ""; pageinfo.TotalItem = 0; pageinfo.TotalPage = 0; DataTable dt = CommDataHelper.GetDataFromSingleTableByPage(pageinfo).Tables[0]; RecordCount = pageinfo.TotalItem; PageCount = pageinfo.TotalPage; return(dt); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Comment.QuestionModel model) { Database db = CommDataAccess.DbReader; if (model.QuestionId == 0) { model.QuestionId = CommDataHelper.GetNewSerialNum(AppType.Other); } DbCommand dbCommand = db.GetStoredProcCommand("UP_qaQuestion_ADD"); db.AddInParameter(dbCommand, "QuestionId", DbType.Int32, model.QuestionId); db.AddInParameter(dbCommand, "UserId", DbType.AnsiString, model.UserId); db.AddInParameter(dbCommand, "ContentId", DbType.Int32, model.ContentId); db.AddInParameter(dbCommand, "Title", DbType.AnsiString, model.Title); db.AddInParameter(dbCommand, "Content", DbType.AnsiString, model.Content); db.AddInParameter(dbCommand, "@contentType", DbType.Int16, (int)model.ContentType); db.ExecuteNonQuery(dbCommand); }
public DataTable GetList(int PageIndex, int PageSize, string Condition, out int RecordCount) { SearchPageInfo info = new SearchPageInfo(); info.FieldNames = "*"; info.OrderType = " newsid desc"; info.PageIndex = PageIndex; info.PageSize = PageSize; info.PriKeyName = "newsid"; info.StrJoin = ""; info.StrWhere = " 1=1 " + Condition; info.TableName = "nenews"; info.TotalFieldStr = ""; DataTable dt = CommDataHelper.GetDataFromSingleTableByPage(info).Tables[0]; RecordCount = info.TotalItem; return(dt); }
public DataSet GetList(int PageIndex, int PageSize, string Condition, out int RecordCount) { SearchPageInfo info = new SearchPageInfo(); info.FieldNames = "*"; info.OrderType = " showorder desc"; info.PageIndex = PageIndex; info.PageSize = PageSize; info.PriKeyName = "brandid"; info.StrJoin = ""; info.StrWhere = " 1=1 " + Condition; info.TableName = "pdbrand"; info.TotalFieldStr = ""; DataSet ds = CommDataHelper.GetDataFromSingleTableByPage(info); RecordCount = info.TotalItem; return ds; }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtBrandName.Text == "") { strErr += "品牌名称不能为空!\\n"; } if (this.fulBrandLogo.FileName == "") { strErr += "品牌标志不能为空!\\n"; } if (this.txtBrief.Text == "") { strErr += "简要介绍不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } if (bll.Exists(txtBrandName.Text)) { MessageBox.Show(this, "该品牌已存在"); return; } BrandModel model = new BrandModel(); model.BrandId = CommDataHelper.GetNewSerialNum("pd"); model.BrandName = txtBrandName.Text; model.BrandLogo = UploadBrandLogo(model.BrandId, fulBrandLogo); model.Brief = txtBrief.Text; model.ShowOrder = model.BrandId; bll.Add(model); Response.Redirect("List.aspx"); }
/// <summary> /// 增加一条数据 /// </summary> public void Save(SuiteModel model) { if (model.SuiteId == 0) { model.SuiteId = CommDataHelper.GetNewSerialNum(AppType.Product); // 因为图片部分与商品类似,因此这里的id也采用了商品一致的id序列 } DbCommand dbCommand = dbw.GetStoredProcCommand("UP_slSuite_Save"); dbw.AddInParameter(dbCommand, "SuiteId", DbType.Int32, model.SuiteId); dbw.AddInParameter(dbCommand, "ScenceId", DbType.Int32, model.ScenceId); dbw.AddInParameter(dbCommand, "SuiteName", DbType.AnsiString, model.SuiteName); dbw.AddInParameter(dbCommand, "LargeImage", DbType.AnsiString, model.LargeImage); dbw.AddInParameter(dbCommand, "SmallImage", DbType.AnsiString, model.SmallImage); dbw.AddInParameter(dbCommand, "MediumImage", DbType.AnsiString, model.MediumImage); dbw.AddInParameter(dbCommand, "Price", DbType.Decimal, model.Price); dbw.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark); dbw.AddInParameter(dbCommand, "Score", DbType.Int32, model.Score); dbw.AddInParameter(dbCommand, "DerateFee", DbType.Decimal, model.DerateFee); dbw.AddInParameter(dbCommand, "ProductFee", DbType.Decimal, model.ProductFee); dbw.ExecuteNonQuery(dbCommand); }
internal override string SaveOrderInfo() { string sql = "orders_Save_gift"; DbCommand comm = CommDataAccess.DbWriter.GetStoredProcCommand(sql); if (!String.IsNullOrEmpty(this.OrderId) && this.Exists()) { throw new NoName.NetShop.Common.ShopException("订单已经被存储过了"); } else { this.OrderId = CommDataHelper.GetNewSerialStr(AppType.Order); CommDataAccess.DbWriter.AddInParameter(comm, "userId", DbType.String, Address.UserId); CommDataAccess.DbWriter.AddInParameter(comm, "OrderID", DbType.String, this.OrderId); CommDataAccess.DbWriter.AddInParameter(comm, "ShipMethod", DbType.Int32, ShipMethodId); CommDataAccess.DbWriter.AddInParameter(comm, "TotalScore", DbType.Int32, TotalScore); CommDataAccess.DbWriter.AddInParameter(comm, "UserNotes", DbType.String, UserNotes); CommDataAccess.DbWriter.AddInParameter(comm, "serverip", DbType.String, ServerIp); CommDataAccess.DbWriter.AddInParameter(comm, "ClientIp", DbType.String, ClientIp); CommDataAccess.DbWriter.AddInParameter(comm, "OrderType", DbType.Int32, (int)OpType); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverName", DbType.String, Address.RecieverName); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverEmail", DbType.String, Address.Email); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCountry", DbType.String, Address.Country); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverProvince", DbType.String, Address.Province); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCity", DbType.String, Address.City); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverCounty", DbType.String, Address.County); CommDataAccess.DbWriter.AddInParameter(comm, "RecieverPhone", DbType.String, (Address.Telephone + " " + Address.Mobile).Trim()); CommDataAccess.DbWriter.AddInParameter(comm, "AddressDetial", DbType.String, Address.AddressDetail); CommDataAccess.DbWriter.AddInParameter(comm, "PostalCode", DbType.String, Address.Postalcode); CommDataAccess.DbWriter.ExecuteNonQuery(comm); MemberInfo.LogScore(Address.UserId, NoName.NetShop.Common.ScoreType.Gift, -this.TotalScore, this.OrderId, "积分礼品兑换订单生成"); return(this.OrderId); } }
protected void Button_Add_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (TextBox_ParaName.Text == String.Empty) { ErrorMessage += "属性名称不可为空\\n"; } if (TextBox_ParaValue.Text == String.Empty) { ErrorMessage += "属性值不可为空\\n"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } CategoryParaModel model = new CategoryParaModel(); model.ParaId = CommDataHelper.GetNewSerialNum("pd");; model.ParaName = TextBox_ParaName.Text; model.CateId = CategoryID; model.DefaultValue = ""; model.ParaGroupId = 0; model.ParaType = Convert.ToInt32(DropDown_ParaType.SelectedValue); model.ParaValues = TextBox_ParaValue.Text.Replace(",", ","); model.Status = Convert.ToInt32(DropDownList_Status.SelectedValue); bll.Add(model); //判断是否存在子类,若该分类有子类,则同时为所有子类添加 AddChildCategoryParameter(model); //MessageBox.Show(this,"添加成功!"); Response.Redirect("List.aspx?cid=" + CategoryID); }
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)); } } }
protected void Button_Submit_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_TopicTitle.Text.Trim())) { ErrorMessage += "主题标题不能为空;"; } if (String.IsNullOrEmpty(TextBox_TopicContent.Text.Trim())) { ErrorMessage += "主题内容不能为空"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } TopicModel model = new TopicModel(); model.TopicId = CommDataHelper.GetNewSerialNum(AppType.Other); model.Title = TextBox_TopicTitle.Text.Trim(); model.Content = TextBox_TopicContent.Text.Trim(); model.UserId = GetUserID(); model.InsertTime = DateTime.Now; model.ContentId = ProductID; model.ContentType = NoName.NetShop.Common.ContentType.Product; //model.LastReplyId = model.UserId; //model.LastReplyTime = ""; //model.ReplyNum = ""; model.Status = true; topicBll.Add(model); Response.Redirect(Request.RawUrl); }
public DataTable GetNewsList(int PageIndex, int PageSize, int CategoryID, out int RecordCount, out int PageCount) { SearchPageInfo pageinfo = new SearchPageInfo(); string where = String.Format(" dbo.GetNewsCategoryPath(cateid)+'/' like dbo.GetNewsCategoryPath({0})+'/%'", CategoryID); pageinfo.FieldNames = "*"; pageinfo.OrderType = "newsid desc"; pageinfo.PageIndex = PageIndex; pageinfo.PageSize = PageSize; pageinfo.PriKeyName = "newsid"; pageinfo.StrWhere = where; pageinfo.TableName = "nenews"; pageinfo.TotalFieldStr = ""; pageinfo.TotalItem = 0; pageinfo.TotalPage = 0; DataTable dt = CommDataHelper.GetDataFromSingleTableByPage(pageinfo).Tables[0]; RecordCount = pageinfo.TotalItem; PageCount = pageinfo.TotalPage; return(dt); }
private static void AddProductMultiImage(int ProductID, string CatePath, string ImageRelativeURL) { string ImageFullURL = UrlPrefix + ImageRelativeURL; FileInfo ImageFile = DownloadImage(ImageFullURL); if (!ImageFile.Directory.Exists) { Directory.CreateDirectory(ImageFile.Directory.FullName); } string[] MultiImages; ProductMultiImageRule.SaveProductMultiImage(ProductID, CatePath, ImageFile, out MultiImages); ProductImageModel model = new ProductImageModel(); model.ImageId = CommDataHelper.GetNewSerialNum("pd"); model.ProductId = ProductID; model.LargeImage = MultiImages[1]; model.OriginImage = MultiImages[2]; model.SmallImage = MultiImages[0]; model.Title = String.Empty; imgBll.Add(model); }
protected void Button_Add_Click(object sender, EventArgs e) { string ErrorMessage = String.Empty; if (String.IsNullOrEmpty(TextBox_RentName.Text)) { ErrorMessage += "商品名称不能为空\\n"; } if (String.IsNullOrEmpty(TextBox_Stock.Text) || !PageValidate.IsNumber(TextBox_Stock.Text)) { ErrorMessage += "商品数量不正确\\n"; } if (String.IsNullOrEmpty(TextBox_Keywords.Text)) { ErrorMessage += "关键词不能为空\\n"; } if (String.IsNullOrEmpty(TextBox_RentPrice.Text) || !PageValidate.IsDecimal(TextBox_RentPrice.Text)) { ErrorMessage += "出租价格不正确\\n"; } if (String.IsNullOrEmpty(TextBox_CashPledge.Text) || !PageValidate.IsDecimal(TextBox_CashPledge.Text)) { ErrorMessage += "出租押金不正确\\n"; } if (String.IsNullOrEmpty(TextBox_MaxRentDays.Text) || !PageValidate.IsNumber(TextBox_MaxRentDays.Text)) { ErrorMessage += "最大出租时间不正确\\n"; } if (String.IsNullOrEmpty(TextBox_Brief.Text)) { ErrorMessage += "商品简介不能为空\\n"; } if (String.IsNullOrEmpty(FileUpload_MainImage.FileName)) { ErrorMessage += "商品图片不能为空\\n"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } int RentID = CommDataHelper.GetNewSerialNum(AppType.MagicWorld); string[] ProductImages; if (MagicWorldImageRule.SaveProductMainImage(RentID, FileUpload_MainImage.PostedFile, out ProductImages)) { RentProductModel model = new RentProductModel(); model.RentID = RentID; model.RentName = TextBox_RentName.Text; model.Stock = Convert.ToInt32(TextBox_Stock.Text); model.Keywords = TextBox_Keywords.Text.Replace(",", ","); model.CashPledge = Convert.ToDecimal(TextBox_CashPledge.Text); model.RentPrice = Convert.ToDecimal(TextBox_RentPrice.Text); model.MaxRentTime = Convert.ToInt32(TextBox_MaxRentDays.Text); model.Brief = TextBox_Brief.Text; model.SmallImage = ProductImages[0]; model.MediumImage = ProductImages[1]; model.CategoryID = CategoryID; model.CategoryPath = Hidden_CategoryPath.Value; model.CreateTime = DateTime.Now; model.UpdateTime = DateTime.Now; model.Status = (int)RentProductStatus.申请中; new RentProductBll().Add(model); PageControler.Publish(7, true); Response.Redirect("List.aspx"); } else { MessageBox.Show(this, "图片上传失败!"); } }
public void AddComment(HttpContext CurrentContext, int AppCode, int TargetID, string Content, string ValidateCode) { string AppName = String.Empty; switch (AppCode) { case 1: AppName = AppType.Member; break; case 2: AppName = AppType.News; break; case 3: AppName = AppType.Order; break; case 4: AppName = AppType.Address; break; case 5: AppName = AppType.Product; break; case 6: AppName = AppType.MagicWorld; break; default: break; } if (CurrentUser == null) { CurrentContext.Response.Write(FormatResult(false, "请登录后评论!")); return; } if (new ValidateHelper().Validate(ValidateCode, true)) { CommentBll bll = new CommentBll(); CommentModel Comment = new CommentModel(); Comment.CommentID = CommDataHelper.GetNewSerialNum(AppName); Comment.AppType = AppName; Comment.Content = StringUtility.RemoveHtmlTags(Content); Comment.CreateTime = DateTime.Now; Comment.TargetID = TargetID; Comment.UserID = GetUserID(); bll.Add(Comment); CurrentContext.Response.Write(FormatResult(true, "添加成功")); } else { CurrentContext.Response.Write(FormatResult(false, "添加失败,验证码错误")); } }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCateName.Text.Trim() == "") { strErr += "分类名称不能为空!\\n"; } if (this.txtSearchPriceRange.Text.Trim() == "") { strErr += "分类搜索价格区间不能为空!\\n"; } if (this.txtSearchPriceRange.Text.Trim() != "") { string validateString = txtSearchPriceRange.Text.Trim().Replace(",", ",").Replace("~", "~"); if (validateString.Contains(",")) { foreach (string s in validateString.Split(',')) { int r1 = 0, r2 = 0; if (!s.Contains("~") || !int.TryParse(s.Split('~')[0], out r1) || !int.TryParse(s.Split('~')[1], out r2)) { strErr += "价格区间填写有误!\\n"; break; } } } else { int r1 = 0, r2 = 0; if (!validateString.Contains("~") || !int.TryParse(validateString.Split('~')[0], out r1) || !int.TryParse(validateString.Split('~')[1], out r2)) { strErr += "价格区间填写有误!\\n"; } } } if (strErr != "") { MessageBox.Show(this, strErr); return; } string CateName = this.txtCateName.Text; int Status = Convert.ToInt32(drpStatus.SelectedValue); //string PriceRange = this.txtPriceRange.Text; bool IsHide = this.chkIsHide.Checked; CategoryModel model = new CategoryModel(); model.CateId = CommDataHelper.GetNewSerialNum("pd"); model.CateName = CateName; model.Status = Status; model.IsHide = IsHide; model.ShowOrder = model.CateId; model.SearchPriceRange = txtSearchPriceRange.Text.Trim().EndsWith(",") ? txtSearchPriceRange.Text.Trim().Substring(0, txtSearchPriceRange.Text.Trim().Length - 1) : txtSearchPriceRange.Text.Trim(); if (ParentID != 0) { CategoryModel ParentCategory = bll.GetModel(ParentID); model.ParentID = ParentID; model.CateLevel = ParentCategory.CateLevel + 1; } else { model.ParentID = 0; model.CateLevel = 1; } bll.Add(model); //判断父类是否存在属性,存在则继承父类属性 //if (pBll.ExistsCategoryParameter(model.ParentID)) //{ // List<CategoryParaModel> ParentParaList = pBll.GetModelList(" cateid="+model.ParentID+" "); // foreach (CategoryParaModel pModel in ParentParaList) // { // pModel.ParaId = CommDataHelper.GetNewSerialNum("pd"); // pModel.CateId = model.CateId; // pBll.Add(pModel); // } //} Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">window.parent.location=window.parent.location+'?_=" + DateTime.Now.Ticks + "'</script>"); }
private void SaveData() { string strErr = ""; if (this.txtProductName.Text == "") { strErr += "产品名称不能为空!\\n"; } if (!PageValidate.IsDecimal(txtTradePrice.Text)) { strErr += "市场价输入有误!\\n"; } if (!PageValidate.IsDecimal(txtMerchantPrice.Text)) { strErr += "销售价输入有误!\\n"; } if (!PageValidate.IsDecimal(txtReducePrice.Text)) { strErr += "直降价输入有误!\\n"; } if (!PageValidate.IsNumber(txtScore.Text)) { strErr += "商品积分输入有误!\\n"; } if (!PageValidate.IsDecimal(txtWeight.Text)) { strErr += "商品重量输入有误!\\n"; } if (this.txtKeywords.Text == "") { strErr += "关键词不能为空!\\n"; } if (this.TextBox_Brief.Text == "") { strErr += "商品简介不能为空!\\n"; } if (!PageValidate.IsNumber(drpStatus.SelectedValue)) { strErr += "商品状态选择有误!\\n"; } int TempNewsID = 0; if (!String.IsNullOrEmpty(txtNewsID.Text) && !int.TryParse(txtNewsID.Text, out TempNewsID)) { strErr += "关联资讯ID输入有误"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } ProductModel product = bll.GetModel(ProductID); product.ProductName = txtProductName.Text; product.ProductCode = txtProductCode.Text; product.CateId = Convert.ToInt32(txtCategoryID.Value); product.TradePrice = Convert.ToDecimal(txtTradePrice.Text); product.MerchantPrice = Convert.ToDecimal(txtMerchantPrice.Text); product.ReducePrice = Convert.ToDecimal(txtReducePrice.Text); product.Status = Convert.ToInt32(drpStatus.SelectedValue); product.Keywords = txtKeywords.Text; product.Brief = TextBox_Brief.Text; product.BrandID = Convert.ToInt32(DropDown_Brand.SelectedValue); product.Specifications = TextBox_Specification.Text; product.OfferSet = TextBox_OfferSet.Text; product.PackingList = TextBox_Packing.Text; product.AfterSaleService = TextBox_Service.Text; product.Weight = Convert.ToDecimal(txtWeight.Text); product.StockTip = GetStockTip(); product.RelateProducts = txtRelateProduct.Text.Replace(",", ","); product.ChangeTime = DateTime.Now; if (fulImage.FileName != String.Empty) { string[] MainImages; ProductMainImageRule.SaveProductMainImage(ProductID, product.CatePath, fulImage.PostedFile, out MainImages); product.SmallImage = MainImages[0]; product.MediumImage = MainImages[1]; product.LargeImage = MainImages[2]; } //更新检索属性 foreach (GridViewRow row in GridView_Parameter.Rows) { RadioButtonList ParameterValueList = ((RadioButtonList)row.Cells[0].FindControl("RadioList_ParameterValue")); if (!String.IsNullOrEmpty(ParameterValueList.SelectedValue)) { int ParameterID = Convert.ToInt32(((HiddenField)row.Cells[0].FindControl("Hidden_ParameterID")).Value); string ParameterValue = Convert.ToString(ParameterValueList.SelectedItem.Text); ProductParaModel para = new ProductParaModel(); para.ParaId = ParameterID; para.ProductId = product.ProductId; para.ParaValue = ParameterValue; pvBll.Save(para); } } //更新基本属性 foreach (GridViewRow row in GridView_Specification.Rows) { RadioButtonList ParameterValueList = ((RadioButtonList)row.Cells[0].FindControl("RadioList_SpecificationValue")); if (!String.IsNullOrEmpty(ParameterValueList.SelectedValue)) { int ParameterID = Convert.ToInt32(((HiddenField)row.Cells[0].FindControl("Hidden_SpecificationID")).Value); string ParameterValue = Convert.ToString(ParameterValueList.SelectedItem.Text); ProductParaModel para = new ProductParaModel(); para.ParaId = ParameterID; para.ProductId = product.ProductId; para.ParaValue = ParameterValue; pvBll.Save(para); } } //添加商品多图 foreach (string s in Request.Files.AllKeys) { if (s.StartsWith("multiImageUpload") && Request.Files[s].ContentLength > 0) { string[] FileNames; ProductMultiImageRule.SaveProductMultiImage(ProductID, product.CatePath, Request.Files[s], out FileNames); if (FileNames != null) { ProductImageModel model = new ProductImageModel(); model.ImageId = CommDataHelper.GetNewSerialNum("pd"); model.ProductId = ProductID; model.LargeImage = FileNames[1]; model.OriginImage = FileNames[2]; model.SmallImage = FileNames[0]; model.Title = String.Empty; new ProductImageModelBll().Add(model); } } } //更新关联资讯ID new ProductNewsBll().Save(new ProductNewsModel() { ProdutID = product.ProductId, NewsID = TempNewsID }); bll.Update(product); //重建索引 try { DataIndexerProduct SearchIndexer = new DataIndexerProduct(Config.Searches["product"]); SearchIndexer.DeleteSingleIndex(product.ProductId); SearchIndexer.CreateSingleIndex(new Search.Entities.ProductModel() { EntityIdentity = product.ProductId, CategoryID = product.CateId, CategoryPath = product.CatePath, CreateTime = product.InsertTime, Description = product.Brief, Keywords = product.Keywords, Price = product.MerchantPrice, ProcessType = NoName.NetShop.Search.Entities.EntityProcessType.insert, ProductImage = product.MediumImage, ProductName = product.ProductName, UpdateTime = product.ChangeTime }); } catch { } }
protected void Button_Submit_Click(object sender, EventArgs e) { bool isEndCate = false; int SelectedParentCategoryID = NewsCategorySelect1.GetSelectedRegionInfo(out isEndCate).CateID; string strErr = String.Empty; if (TextBox_Title.Text == String.Empty) { strErr += "新闻标题不能为空!\\n"; } if (TextBox_Author.Text == String.Empty) { strErr += "新闻作者不能为空!\\n"; } if (TextBox_NewsFrom.Text == String.Empty) { strErr += "新闻来源不能为空!\\n"; } if (TextBox_Tags.Text == String.Empty) { strErr += "新闻标签不能为空!\\n"; } if (!isEndCate) { strErr += "新闻不能添加在非末级分类下!\\n"; } if (strErr != String.Empty) { MessageBox.Show(this, strErr); return; } int NewsID = CommDataHelper.GetNewSerialNum("ne"); NewsModel model = new NewsModel(); model.NewsId = NewsID; model.Title = TextBox_Title.Text; model.SubTitle = TextBox_SubTitle.Text; model.Author = TextBox_Author.Text; model.From = TextBox_NewsFrom.Text; model.CategoryID = SelectedParentCategoryID; model.Tags = TextBox_Tags.Text; model.Brief = TextBox_Brief.Text; model.Content = TextBox_Content.Text; model.InsertTime = DateTime.Now; model.ModifyTime = DateTime.Now; model.ProductId = String.IsNullOrEmpty(TextBox_ProductID.Text) ? "0" : TextBox_ProductID.Text; model.NewsType = 1; model.Status = 1; model.ImageUrl = ""; model.SmallImageUrl = ""; model.VideoUrl = ""; if (!String.IsNullOrEmpty(FileUpload_Image.FileName)) { string ImageUrl = String.Empty; if (NewsImageRule.SaveNewsImage(NewsID, FileUpload_Image.PostedFile, out ImageUrl)) { model.ImageUrl = ImageUrl; } else { MessageBox.Show(this, "图片上传失败,请检查格式及大小是否正确。"); return; } } if (!String.IsNullOrEmpty(FileUpload_Video.FileName)) { string VideoUrl = String.Empty; if (NewsVideoRule.SaveNewsVideo(NewsID, FileUpload_Video.PostedFile, out VideoUrl)) { model.VideoUrl = VideoUrl; } else { MessageBox.Show(this, "视频上传失败,请检查格式及大小是否正确。"); return; } } bll.Add(model); PageControler.Publish(6, true); Response.Redirect("List.aspx"); }