public bool UpdateOrg(int oldParentId, SvrModels.SvrOrgInfo info) { using (var db = DbAccess.DbFrameworkContext.Create()) { var helper = new BLL.OrgHelper(db, this.svrUser); var org = helper.GetOrgInfoById(info.OrgId); if (org == null) { throw new UIValidateException(string.Format("机构不存在orgId={0}", info.OrgId.ToString())); } org.UpdateOrgInfo(oldParentId, info); db.SaveChanges(); } return(true); }
/// <summary> /// 创建机构节点 /// </summary> /// <param name="info"></param> /// <returns></returns> public int CreateOrg(SvrModels.SvrOrgInfo info) { if (info.OrgCode.StrValidatorHelper().StrIsNullOrEmpty()) { var common = new SeqServices(this.svrUser); info.OrgCode = common.CreateNewSeqNo("system.orgcode"); } using (var db = DbAccess.DbFrameworkContext.Create()) { var helper = new Services.BLL.OrgHelper(db, this.svrUser); var org = helper.CreateOrgInfo(info); //提交 db.SaveChanges(); return(org.GetOrgId()); } }