protected void btnSave_ServerClick(object sender, EventArgs e) { string strName = txt_Name.Value.Trim(); if (nId <= 0 && SystemOrganizationType.Exist(strName)) { PageUtil.PageAlert(this.Page, "该类型已存在!"); return; } SystemOrganizationType addItem = SystemOrganizationType.Get(nId); if (null == addItem) { addItem = new SystemOrganizationType(); } addItem.Name = strName; addItem.ParentId = TypeUtil.ParseInt(sel_OrganizationTypeId.SelectedValue, -1); addItem.Remark = txt_Remark.Text; int nAddId = SystemOrganizationType.Save(addItem); PageUtil.PageAlert(this.Page, nAddId > 0 ? "保存成功!" : "保存失败!"); }
public static int Save(SystemOrganizationType _Entity) { int result; if (null == _Entity) { result = -1; } else { result = EntityAccess<SystemOrganizationType>.Access.Save(_Entity); } return result; }