示例#1
0
        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);
        }
示例#2
0
        public bool DeleteOrg(int orgId)
        {
            using (var db = DbAccess.DbFrameworkContext.Create())
            {
                var helper = new BLL.OrgHelper(db, this.svrUser);
                var org    = helper.GetOrgInfoById(orgId);

                if (org == null)
                {
                    throw new UIValidateException(string.Format("机构不存在或已被删除ORGID={0}", orgId));
                }

                //删除
                org.Deleted();

                db.SaveChanges();
            }
            return(true);
        }