protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.VerificationUtility ver = new Utility.VerificationUtility(); ver.JudgeOperate(this.Page, 24, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 }); this.navigation1.Routes.Add("品种管理", string.Format("{0}BasicData/AssetList.aspx", NFMT.Common.DefaultValue.NftmSiteName)); this.navigation1.Routes.Add("品种修改", string.Empty); int id = 0; if (!string.IsNullOrEmpty(Request.QueryString["id"])) { if (int.TryParse(Request.QueryString["id"], out id)) { if (id == 0) Response.Redirect("AssetList.aspx"); NFMT.Data.BLL.AssetBLL cyBLL = new NFMT.Data.BLL.AssetBLL(); var result = cyBLL.Get(Utility.UserUtility.CurrentUser, id); if (result.ResultStatus != 0) Response.Redirect("AssetList.aspx"); asset = result.ReturnValue as NFMT.Data.Model.Asset; if (asset != null) { this.txbAssetName.Value = asset.AssetName; this.HidNo.Value = asset.MUId.ToString(); this.hid.Value = Convert.ToString(asset.AssetId); this.txbAssetStatus.Value = ((int)asset.AssetStatus).ToString(); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.VerificationUtility ver = new Utility.VerificationUtility(); ver.JudgeOperate(this.Page, 24, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.冻结, NFMT.Common.OperateEnum.解除冻结 }); this.navigation1.Routes.Add("品种管理", string.Format("{0}BasicData/AssetList.aspx", NFMT.Common.DefaultValue.NftmSiteName)); this.navigation1.Routes.Add("品种明细", string.Empty); int id = 0; if (!string.IsNullOrEmpty(Request.QueryString["id"])) { if (int.TryParse(Request.QueryString["id"], out id)) { if (id == 0) Response.Redirect("AssetList.aspx"); NFMT.Data.BLL.AssetBLL currencyBLL = new NFMT.Data.BLL.AssetBLL(); var result = currencyBLL.Get(Utility.UserUtility.CurrentUser, id); if (result.ResultStatus != 0) Response.Redirect("AssetList.aspx"); assrt = result.ReturnValue as NFMT.Data.Model.Asset; if (assrt != null) { this.txbAssetName.InnerText = assrt.AssetName; NFMT.Data.Model.MeasureUnit mu = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == assrt.MUId); this.txbMUName.InnerText = mu.MUName; this.hidId.Value = Convert.ToString(assrt.AssetId); this.txbAssetStatus.InnerText =Convert.ToString(assrt.AssetStatus); } } } } }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; context.Response.ContentType = "text/plain"; string assetName = context.Request.Form["assetName"]; string muid = context.Request.Form["muid"]; int id = 0; int assetStatus = 0; string resultStr = "修改失败"; int amountPerHand = 0; if (string.IsNullOrEmpty(context.Request.Form["hands"]) || !int.TryParse(context.Request.Form["hands"], out amountPerHand) || amountPerHand <= 0) { resultStr = "每手重量错误"; context.Response.Write(resultStr); context.Response.End(); } 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 (string.IsNullOrEmpty(assetName)) { resultStr = "币种名称不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (string.IsNullOrEmpty(muid)) { resultStr = "基本单位名称不能为空"; context.Response.Write(resultStr); context.Response.End(); } NFMT.Data.BLL.AssetBLL cyBLL = new NFMT.Data.BLL.AssetBLL(); NFMT.Common.ResultModel result = cyBLL.Get(user, id); if (result.ResultStatus != 0) { resultStr = "获取数据错误"; context.Response.Write(resultStr); context.Response.End(); } if (!int.TryParse(context.Request.Form["assetStatus"], out assetStatus) || assetStatus <= 0) { resultStr = "必须选择数据状态"; context.Response.Write(resultStr); context.Response.End(); } NFMT.Data.Model.Asset cy = result.ReturnValue as NFMT.Data.Model.Asset; if (cy != null) { cy.AssetName = assetName; cy.MUId =Convert.ToInt32(muid); cy.AssetStatus = (NFMT.Common.StatusEnum)assetStatus; cy.AmountPerHand = amountPerHand; result = cyBLL.Update(user, cy); resultStr = result.Message; } context.Response.Write(resultStr); context.Response.End(); }