protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //���ؿؼ� SCoprationBB coprationBB = new SCoprationBB(); SCoprationData coprationData = new SCoprationData(); try { coprationData = coprationBB.GetModel(); if (coprationData != null) { this.State = "2"; this.ShowInfo(coprationData); } else { this.State = "1"; } } finally { coprationBB.Dispose(); } } }
protected void btnAdd_Click(object sender, EventArgs e) { SCoprationData model = new SCoprationData(); SCoprationBB coprationBB = new SCoprationBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; coprationBB.AddRecord(model); this.State = "2"; } else if (this.State == "2") { model = coprationBB.GetModel(); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; coprationBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { coprationBB.Dispose(); } }