protected void btnSave_Click(object sender, EventArgs e) { if (this.txtAreaID.Text.Trim().Length == 0)//新增 { objArea.WH_CODE = this.txtWhCode.Text; objArea.AREACODE = this.txtAreaCode.Text; objArea.AREANAME = this.txtAreaName.Text.Trim().Replace("\'", "\''"); objArea.SHORTNAME = this.txtShortName.Text.Trim().Replace("\'", "\''"); objArea.ISACTIVE = this.ddlActive.SelectedValue; objArea.AREATYPE = this.txtAreaType.Text; objArea.MEMO = this.txtMemo.Text.Trim().Replace("\'", "\''"); objArea.Insert(); this.txtAreaID.Text = ""; this.txtAreaCode.Text = objArea.GetNewAreaCode(this.txtWhCode.Text); this.txtAreaName.Text = ""; this.txtShortName.Text = ""; this.ddlActive.SelectedIndex = 0; this.txtMemo.Text = ""; this.txtAreaCode.ReadOnly = false; this.btnDelete.Enabled = false; JScript.Instance.RegisterScript(this, "ReloadParent();"); } else { objArea.AREA_ID = Convert.ToInt32(this.txtAreaID.Text); objArea.WH_CODE = this.txtWhCode.Text; objArea.AREACODE = this.txtAreaCode.Text; objArea.AREANAME = this.txtAreaName.Text.Trim().Replace("\'", "\''"); objArea.SHORTNAME = this.txtShortName.Text.Trim().Replace("\'", "\''"); objArea.ISACTIVE = this.ddlActive.SelectedValue; objArea.AREATYPE = this.txtAreaType.Text.Trim(); objArea.MEMO = this.txtMemo.Text.Trim().Replace("\'", "\''"); objArea.Update(); JScript.Instance.RegisterScript(this, "UpdateParent();"); } }