private void _BindData() { SystemOrganization oModule = new SystemOrganization(); SystemOrganization[] al = SystemOrganization.List(); rptItems.DataSource = al; rptItems.DataBind(); }
protected void btnSave_ServerClick(object sender, EventArgs e) { string strName = txt_Name.Value.Trim(); if (nId <= 0 && SystemOrganization.Exist(strName)) { PageUtil.PageAlert(this.Page, "该组织机构名称已存在!"); return; } SystemOrganization addItem = SystemOrganization.Get(nId); if (null == addItem) { addItem = new SystemOrganization(); } addItem.Name = strName; addItem.TypeId = TypeUtil.ParseInt(sel_OrganizationTypeId.SelectedValue, -1); addItem.Remark = txt_Remark.Text; if (SystemOrganization.Save(addItem) > 0) { PageUtil.PageAlert(this.Page, "保存成功!"); } }
public static int Save(SystemOrganization _Entity) { int result; if (null == _Entity) { result = -1; } else { result = EntityAccess<SystemOrganization>.Access.Save(_Entity); } return result; }
public static bool Exist(string _strName) { bool result; if (string.IsNullOrEmpty(_strName)) { result = true; } else { SystemOrganization oExist = new SystemOrganization(); oExist.Name = _strName; SystemOrganization[] alist = EntityAccess<SystemOrganization>.Access.List(oExist); if (null == alist) { result = false; } else { if (alist.Length > 1) { throw new Exception(string.Format("{0}-{1}:{2} exist mutil records", EntityAccess<SystemOrganization>.Meta.EntityName, "Key", _strName)); } result = (alist.Length == 1); } } return result; }