protected void ImageButtonNext_Click(object sender, ImageClickEventArgs e) { // 添加分类信息 Wis.Website.DataManager.Category category = new Wis.Website.DataManager.Category(); Wis.Website.DataManager.CategoryManager categoryManager = new Wis.Website.DataManager.CategoryManager(); // 1 判断分类名称 if (string.IsNullOrEmpty(TextBoxCategoryName.Text.Trim())) { return; } // 2 判断排序号 int rank = 0; if (int.TryParse(TextBoxCategoryRank.Text.Trim(), out rank) == false) { return; } // 3 入库 category.CategoryName = TextBoxCategoryName.Text; category.Rank = rank; categoryManager.AddNew(category); }
protected void Page_Load(object sender, EventArgs e) { // 图片保存的路径 /Uploads/Files/年-月-日/文件编号.htm this.ImagePath = Request["ImagePath"]; if (System.IO.File.Exists(this.ImagePath) == false) { Wis.Toolkit.ClientScript.Window.Alert("图片不存在"); Wis.Toolkit.ClientScript.Window.Close(); return; } // 获取分类编号 string requestCategoryGuid = Request.QueryString["CategoryGuid"]; if (categoryManager == null) categoryManager = new Wis.Website.DataManager.CategoryManager(); // 获取分类的信息 if (Wis.Toolkit.Validator.IsGuid(requestCategoryGuid)) { Guid categoryGuid = new Guid(requestCategoryGuid); category = categoryManager.GetCategoryByCategoryGuid(categoryGuid); if (string.IsNullOrEmpty(category.CategoryName)) { // TODO:关闭本层 // TODO:弹出消息层 this.MessageBox("缺少参数", "未传递分类编号"); return; } if(category.ThumbnailWidth.HasValue) this.w.Text = category.ThumbnailWidth.ToString(); if (category.ThumbnailHeight.HasValue) this.h.Text = category.ThumbnailHeight.ToString(); if (this.w.Text.Trim() == "" || this.h.Text.Trim() == "") { this.MessageBox("配置不全", "分类编号为 {0} 的分类需要配置缩略图的宽度和高度"); return; } this.ImageWidth = category.ThumbnailWidth.Value; this.ImageHeight = category.ThumbnailHeight.Value; } if (!Page.IsPostBack) { //string ToWidth = "360";//从数据库中读取需要切图的大小 //string ToHeight = "270"; //this.w.Text = this.tow.Value = ToWidth; //this.h.Text = this.toh.Value = ToHeight; //this.PhotoUrl.Value = imagePath; } }