void Start()
    {
        GameObject   gameController = GameObject.Find("GameController");
        PositionRepo repo           = gameController.GetComponent <PositionRepo> ();

        repo.addPosition(transform.position, this);
    }
        /// <summary>
        /// 删除Position信息
        /// </summary>
        /// <param name="ids">要删除的Id编号</param>
        /// <returns>业务操作结果</returns>
        public async Task <OperationResult> DeletePositions(params int[] ids)
        {
            ids.CheckNotNull("ids");
            await PositionRepo.RecycleAsync(p => ids.Contains(p.Id));

            return(new OperationResult(OperationResultType.Success, "删除成功"));
        }
示例#3
0
        // GET: Resume
        public ActionResult Index()
        {
            ViewBag.Degrees  = new SelectList(DegreeRepo.GetAll(), "Id", "Name");
            ViewBag.Genders  = new SelectList(GenderRepo.GetAll(), "Id", "Name");
            ViewBag.Positons = new SelectList(PositionRepo.GetAll(), "Id", "Name");

            return(View());
        }
示例#4
0
        public TeacherList(string apiEndpoint)
        {
            ApiEndpoint = apiEndpoint;
            InitializeComponent();

            tRepo   = new TeacherRepo(ApiEndpoint);
            pRepo   = new PositionRepo(ApiEndpoint);
            expRepo = new ExperienceRepo(ApiEndpoint);
            eduRepo = new EducationRepo(ApiEndpoint);
            adRepo  = new AcademicDegreeRepo(ApiEndpoint);
            arRepo  = new AcademicRankRepo(ApiEndpoint);
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            positionList.Items.Clear();
            //Position position = new Position();
            //position.Name = positionNameTxtBox.Text;
            IEnumerable <Position> positions = PositionRepo.GetAll();

            foreach (Position position in positions)
            {
                positionList.Items.Add(position.Name);
            }
        }
    public int ammo = 3;     //change later
    // Use this for initialization
    void Start()
    {
        gameController = gameObject.GetComponent <GameController> ();
        animator       = gameObject.GetComponent <Animator>();

        //change model if needed
        //PlayerPrefs.SetInt ("player", 0);
        checkAndChangePlayer();

        tileRepo           = GameObject.Find("GameController").GetComponent <PositionRepo> ();
        Physics.gravity    = new Vector3(0, -50.0F, 0);
        Screen.orientation = ScreenOrientation.LandscapeLeft;
    }
示例#7
0
        /// <summary>
        /// 保存UserInfo信息(新增/更新)
        /// </summary>
        /// <param name="updateForeignKey">更新时是否更新外键信息</param>
        /// <param name="dtos">要保存的UserInfoDto信息</param>
        /// <returns>业务操作集合</returns>
        public async Task <OperationResult> SaveUserInfos(bool updateForeignKey = false, params UserInfoDto[] dtos)
        {
            try
            {
                dtos.CheckNotNull("dtos");
                var addDtos    = dtos.Where(p => p.Id == 0).ToArray();
                var updateDtos = dtos.Where(p => p.Id != 0).ToArray();

                UserInfoRepo.UnitOfWork.TransactionEnabled = true;

                Action <UserInfoDto> checkAction = null;
                Func <UserInfoDto, UserInfo, UserInfo> updateFunc = (dto, entity) =>
                {
                    if (dto.Id == 0 || updateForeignKey)
                    {
                        entity.Region    = RegionRepo.GetByKey(dto.RegionId);
                        entity.SysUser   = SysUserRepo.GetByKey(dto.SysUserId);
                        entity.Position  = PositionRepo.GetByKey(dto.PositionId);
                        entity.Education = EducationRepo.GetByKey(dto.EducationId);
                    }
                    return(entity);
                };
                if (addDtos.Length > 0)
                {
                    UserInfoRepo.Insert(addDtos, checkAction, updateFunc);
                }
                if (updateDtos.Length > 0)
                {
                    UserInfoRepo.Update(updateDtos, checkAction, updateFunc);
                }
                await UserInfoRepo.UnitOfWork.SaveChangesAsync();

                return(new OperationResult(OperationResultType.Success, "保存成功"));
            }
            catch (Exception e)
            {
                return(new OperationResult(OperationResultType.Error, e.Message));
            }
        }
示例#8
0
 public PositionController(PositionRepo repo)
 {
     _repo = repo;
 }
 // Use this for initialization
 void Start()
 {
     gameController = gameObject.GetComponent <GameController> ();
     animator       = gameObject.GetComponent <Animator>();
     tileRepo       = GameObject.Find("GameController").GetComponent <PositionRepo> ();
 }
示例#10
0
        /// <summary>
        /// 验证用户注册
        /// </summary>
        /// <param name="dto">用户注册信息</param>
        /// <param name="validateCode">验证码</param>
        /// <returns>业务操作结果</returns>
        public async Task <OperationResult> ValidateRegister(UserInfoRegistDto dto, string validateCode)
        {
            dto.CheckNotNull("dto");
            validateCode.CheckNotNullOrEmpty("validateCode");
            //验证码
            var severCode = GetValidateCode(dto.UserName, CodeType.用户注册);

            if (severCode == null || severCode.Code != validateCode)
            {
                return(BodeResult.ValidError("验证码错误"));
            }
            if (SysUserRepo.CheckExists(p => p.UserName == dto.UserName))
            {
                return(BodeResult.ValidError("账号已被使用"));
            }
            try
            {
                UserInfoRepo.UnitOfWork.TransactionEnabled = true;
                //验证密码格式
                IdentityResult result = await UserManager.PasswordValidator.ValidateAsync(dto.Password);

                if (!result.Succeeded)
                {
                    return(result.ToOperationResult());
                }

                SysUser sUser = new SysUser()
                {
                    UserName     = dto.UserName,
                    NickName     = dto.NickName,
                    PasswordHash = UserManager.PasswordHasher.HashPassword(dto.Password),//密码加密
                    UserType     = UserType.App用户
                };
                if (severCode.ValidateType == ValidateType.手机)
                {
                    sUser.PhoneNumber          = dto.UserName;
                    sUser.PhoneNumberConfirmed = true;
                }
                else
                {
                    sUser.Email          = dto.UserName;
                    sUser.EmailConfirmed = true;
                }
                await UserManager.CreateAsync(sUser);

                var userInfo = Mapper.Map <UserInfo>(dto);
                userInfo.SysUser   = sUser;
                userInfo.Region    = RegionRepo.GetByKey(dto.RegionId);
                userInfo.Education = EducationRepo.GetByKey(dto.EducationId);
                userInfo.Position  = PositionRepo.GetByKey(dto.PositionId);
                await UserInfoRepo.InsertAsync(userInfo);

                await UserInfoRepo.UnitOfWork.SaveChangesAsync();

                return(BodeResult.Success("注册成功", userInfo.Id));
            }
            catch (Exception e)
            {
                return(BodeResult.NoChanged("注册失败"));
            }
        }