public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string brandName = context.Request.Form["brandName"]; string brandFullName = context.Request.Form["brandFullName"]; string brandInfo = context.Request.Form["brandInfo"]; string producerName = context.Request.Form["producerName"]; string resultStr = "添加失败"; if (string.IsNullOrEmpty(brandName)) { resultStr = "品牌名称不可为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(brandFullName)) { resultStr = "品牌全称不可为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(brandInfo)) { resultStr = "品牌备注不可为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(producerName)) { resultStr = "生产商名称"; context.Response.Write(resultStr); context.Response.End(); } NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Data.BLL.BrandBLL bdBLL = new NFMT.Data.BLL.BrandBLL(); NFMT.Data.Model.Brand bd = new NFMT.Data.Model.Brand(); bd.BrandName = brandName; bd.BrandFullName = brandFullName; bd.BrandInfo = brandInfo; bd.ProducerId = Convert.ToInt32(producerName); bd.BrandStatus = NFMT.Common.StatusEnum.已录入; NFMT.Common.ResultModel result = bdBLL.Insert(user, bd); context.Response.Write(result.Message); }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; context.Response.ContentType = "text/plain"; int id = 0; int operateId = 0; if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0) { context.Response.Write("序号错误"); context.Response.End(); } if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0) { context.Response.Write("操作错误"); context.Response.End(); } NFMT.Data.BLL.BrandBLL bBll = new NFMT.Data.BLL.BrandBLL(); NFMT.Data.Model.Brand brand = new NFMT.Data.Model.Brand() { BrandId = id, LastModifyId = user.EmpId }; NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); switch (operateEnum) { case NFMT.Common.OperateEnum.冻结: result = bBll.Freeze(user, brand); break; case NFMT.Common.OperateEnum.解除冻结: result = bBll.UnFreeze(user, brand); break; } context.Response.Write(result.Message); }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; context.Response.ContentType = "text/plain"; string brandName = context.Request.Form["brandName"]; string brandFullName = context.Request.Form["brandFullName"]; string brandInfo = context.Request.Form["brandInfo"]; int producerName = 0; int id = 0; int brandStatusName = 0; string resultStr = "修改失败"; if (string.IsNullOrEmpty(context.Request.Form["id"])) { resultStr = "id未知"; context.Response.Write(resultStr); context.Response.End(); } if (!int.TryParse(context.Request.Form["id"], out id)) { resultStr = "id未知"; context.Response.Write(resultStr); context.Response.End(); } if (!int.TryParse(context.Request.Form["producerName"], out producerName)) { resultStr = "生产商名称序号不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (!int.TryParse(context.Request.Form["brandStatusName"], out brandStatusName)) { resultStr = "品牌状态序号不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(brandName)) { resultStr = "品牌名称不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(brandFullName)) { resultStr = "品牌全称不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(brandInfo)) { resultStr = "品牌备注不能为空"; context.Response.Write(resultStr); context.Response.End(); } NFMT.Data.BLL.BrandBLL brandBLL = new NFMT.Data.BLL.BrandBLL(); NFMT.Data.Model.Brand brand = new NFMT.Data.Model.Brand() { BrandName = brandName, BrandFullName = brandFullName, BrandInfo = brandInfo, BrandId = id, ProducerId = producerName, BrandStatus = (NFMT.Common.StatusEnum)brandStatusName }; NFMT.Common.ResultModel result = brandBLL.Update(user, brand); if (result.ResultStatus == 0) context.Response.Write("修改成功"); else context.Response.Write(resultStr); }