protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToLower() == "d") { int ProductID = Convert.ToInt32(e.CommandArgument); bll.Delete(ProductID); BindData(AspNetPager.CurrentPageIndex); MessageBox.Show(this, "删除成功!"); PageControler.Publish(7, true); } if (e.CommandName.ToLower() == "f") { int ProductID = Convert.ToInt32(e.CommandArgument); bll.ChangeStatus(ProductID, (int)PawnProductStatus.冻结); BindData(AspNetPager.CurrentPageIndex); PageControler.Publish(7, true); } if (e.CommandName.ToLower() == "m") { int ProductID = Convert.ToInt32(e.CommandArgument); bll.ChangeStatus(ProductID, (int)PawnProductStatus.尚未收当); BindData(AspNetPager.CurrentPageIndex); PageControler.Publish(7, true); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "d") { int RentID = Convert.ToInt32(e.CommandArgument); bll.Delete(RentID); PageControler.Publish(7, true); } }
protected void Button_Publish_Click(object sender, EventArgs e) { for (int i = 0; i < GridView1.Rows.Count; i++) { if (((CheckBox)GridView1.Rows[i].FindControl("chkItem")).Checked == true) { string ServerID = GridView1.Rows[i].Cells[2].Text; int TagID = int.Parse(GridView1.Rows[i].Cells[3].Text); string TagTitle = ((DataBoundLiteralControl)GridView1.Rows[i].Cells[1].Controls[0]).Text; string Content = ((TextBox)(editWrap.FindControl(ServerID + "-Eidtor").FindControl("TextBox_Content"))).Text; TagContentModel TagContent = new TagContentModel(); TagContent.PageID = PageID; TagContent.ServerID = ServerID; TagContent.TagID = TagID; TagContent.Content = Content; TagControler.TagContentImport(TagContent); } } PageControler.Publish(PageID); MessageBox.Show(this, "发布成功!"); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "d") { int NewsID = Convert.ToInt32(e.CommandArgument); bll.Delete(NewsID); BindData(AspNetPager.CurrentPageIndex); PageControler.Publish(6, true); } if (e.CommandName == "ss") { int NewsID = Convert.ToInt32(e.CommandArgument); bll.SetSplendid(NewsID, true); BindData(AspNetPager.CurrentPageIndex); PageControler.Publish(6, true); } if (e.CommandName == "ds") { int NewsID = Convert.ToInt32(e.CommandArgument); bll.SetSplendid(NewsID, false); BindData(AspNetPager.CurrentPageIndex); PageControler.Publish(6, true); } }
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, "图片上传失败!"); } }
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"); }
protected void Button_Edit_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_MaxRentDays.Text) || !PageValidate.IsNumber(TextBox_MaxRentDays.Text)) { ErrorMessage += "最大出租天数不正确\\n"; } if (String.IsNullOrEmpty(TextBox_Brief.Text)) { ErrorMessage += "商品简介不能为空\\n"; } if (!String.IsNullOrEmpty(ErrorMessage)) { MessageBox.Show(this, ErrorMessage); return; } RentProductModel rent = bll.GetModel(RentID); if (!String.IsNullOrEmpty(FileUpload_MainImage.FileName)) { string[] ProductImages; if (MagicWorldImageRule.SaveProductMainImage(rent.RentID, FileUpload_MainImage.PostedFile, out ProductImages)) { rent.SmallImage = ProductImages[0]; rent.MediumImage = ProductImages[1]; } else { MessageBox.Show(this, "图片上传失败"); return; } } rent.RentName = TextBox_RentName.Text; rent.RentPrice = Convert.ToDecimal(TextBox_RentPrice.Text); rent.MaxRentTime = Convert.ToInt32(TextBox_MaxRentDays.Text); rent.Stock = Convert.ToInt32(TextBox_Stock.Text); rent.Keywords = TextBox_Keywords.Text; rent.Brief = TextBox_Brief.Text; bll.Update(rent); PageControler.Publish(7, true); Response.Redirect("List.aspx"); }
protected void Button_Submit_Click(object sender, EventArgs e) { NewsModel model = bll.GetModel(NewsID); bool IsEndClass; int SelectedParentCategoryID = NewsCategorySelect1.GetSelectedRegionInfo(out IsEndClass).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 (!IsEndClass) { strErr += "新闻不能添加在非末级分类下!\\n"; } if (strErr != String.Empty) { MessageBox.Show(this, strErr); return; } 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.ModifyTime = DateTime.Now; model.ProductId = String.IsNullOrEmpty(TextBox_ProductID.Text) ? "0" : TextBox_ProductID.Text; 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.Update(model); PageControler.Publish(6, true); Response.Redirect("List.aspx?page=" + CurrentPageIndex); }