Example #1
0
        /// <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());
            }
        }
Example #2
0
        public int CreateRole(SvrModels.SvrRoleInfo svrModel)
        {
            //生产角色编号
            if (svrModel.RoleCode.StrValidatorHelper().StrIsNullOrEmpty())
            {
                var common = new SeqServices(this.svrUser);
                svrModel.RoleCode = common.CreateNewSeqNo("system.rolecode");
            }

            using (var db = DbAccess.DbFrameworkContext.Create())
            {
                var helper = new BLL.RoleHelper(db, this.svrUser);

                var role = helper.CreateRole(svrModel);

                db.SaveChanges();
                return(role.GetRoleId());
            }
        }