/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strInfo = ""; if (!this.ValidateData(out strInfo)) { strInfo = strInfo.Replace("\"", "'").Replace("\n", ""); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true); return; } TSOutInTypeData model = new TSOutInTypeData(); TSOutInTypeBB tsOutInTypeBB = new TSOutInTypeBB(); try { if (this.State == "1") { this.SetModel(ref model); this.IdValue = tsOutInTypeBB.AddRecord(model); } else if (this.State == "2") { model = tsOutInTypeBB.GetModel(this.IdValue); this.SetModel(ref model); tsOutInTypeBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { tsOutInTypeBB.Dispose(); } Response.Redirect("LTsOutInList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { TSOutInTypeBB noPassReasonBB = new TSOutInTypeBB(); TSOutInTypeData model = new TSOutInTypeData(); try { model = noPassReasonBB.GetModel(id); this.tbOutInName.Text = model.outInTypeName; this.ddlCheckItem.SelectedValue = model.outInType; } finally { noPassReasonBB.Dispose(); } }