public void btnPost_Click(object sender, EventArgs e) { ProductBrand brand = null; if (brandID == 0) { brand = new ProductBrand(); } else { brand = ProductBrands.GetProductBrand(brandID); } brand.BrandAbstract = this.txtBrandAbstract.Text; brand.BrandContent = this.txtBrandContent.Text; if (ddlBrandGroup.SelectedIndex == 0) { brand.BrandGroup = this.txtBrandGroup.Text; } else { brand.BrandGroup = this.ddlBrandGroup.Text; } brand.BrandName = this.txtBrandName.Text; brand.BrandTitle = this.txtBrandTitle.Text; brand.DisplayOrder = Convert.ToInt32(this.txtDisplayOrder.Text); brand.BrandStatus = csBrand.SelectedValue; if (fuLogo.PostedFile != null && fuLogo.PostedFile.ContentLength > 0) { brand.BrandLogo = Path.GetFileName(fuLogo.PostedFile.FileName); } DataActionStatus status; if (brandID == 0) { status = ProductBrands.Create(brand, fuLogo.PostedFile.InputStream); switch (status) { case DataActionStatus.DuplicateName: mbMessage.ShowMsg("新增产品品牌失败,存在同名产品品牌!", Color.Red); break; case DataActionStatus.UnknownFailure: mbMessage.ShowMsg("新增产品品牌失败,请联系管理员!", Color.Red); break; case DataActionStatus.Success: default: mbMessage.ShowMsg("新增产品品牌成功,可继续填写新品牌信息,若完成请返回!", Color.Navy); break; } } else { status = ProductBrands.Update(brand, fuLogo.PostedFile.InputStream); switch (status) { case DataActionStatus.DuplicateName: mbMessage.ShowMsg("修改产品品牌失败,存在同名产品品牌!", Color.Red); break; case DataActionStatus.UnknownFailure: mbMessage.ShowMsg("修改产品品牌失败,请联系管理员!", Color.Red); break; case DataActionStatus.Success: default: mbMessage.ShowMsg("修改产品品牌成功,可继续修改品牌信息,若完成请返回!", Color.Navy); break; } //if (status == DataActionStatus.Success) //{ // BindGroupList(); // BindData(); //} } if (status == DataActionStatus.Success) { BindGroupList(); BindData(); } }