// Use this for initialization
 void Awake()
 {
     indicator.GetComponent <IndicatorController>().player = player;
     activator      = indicator.GetComponent <IndicatorController>().activateObject.GetComponent <ActivateController>();
     activator.type = type;
     activator.interactableObject = gameObject;
     activator.player             = player;
 }
Example #2
0
 public override void Given()
 {
     base.Given();
     this.BadgeToBeActivated = new Badge {
         Nbr = "333333333"
     };
     Owner   = DomainStubFactory.CreateOwner();
     Subject = new ActivateController(this.ApplicationFacade);
     MockedSessionService.Stub(x => x["badgeNbr"]).Return(new List <Badge>(Owner.Badges)[0].Nbr);
     MockedSessionService.Stub(x => x["owner"]).Return(Owner);
     MockedBadgeRepository.Stub(x => x.GetBy(n => n.Nbr == new List <Badge>(Owner.Badges)[0].Nbr)).IgnoreArguments().Return(this.BadgeToBeActivated);
     MockedMapperService.Stub(x => x.MapToOwner(Owner, new ActivateMobileRequest())).IgnoreArguments().Return(Owner);
     MockedDistributorService.Stub(x => x.SendActivationConfirmation(this.BadgeToBeActivated));
 }
Example #3
0
        public override void Given()
        {
            base.Given();
            Subject  = new ActivateController(this.ApplicationFacade);
            _request = new ActivateIndexRequest
            {
                Gender = Gender.Male,
                Email  = "*****@*****.**",
                Email2 = "*****@*****.**",
                //todo:remove magic const
                ConfirmEmail    = "*****@*****.**",
                Password        = "******",
                ConfirmPassword = "******",
            };
            _owner = DomainStubFactory.CreateOwner();
            MockedMapperService.Stub(n => n.MapToOwner(_owner, _request)).Return(_owner).IgnoreArguments();
            MockedSessionService.Stub(n => n["badgeNbr"]).Return(new List <Badge>(DomainStubFactory.CreateOwner().Badges)[0].Nbr);
            string salt;

            MockedSecurityService.Stub(n => n.Hash(_request.Password, out salt)).Return("hasedPassword").OutRef("theSalt");
        }
        public int checkLoginAvalability(int posId, string deviceCode, string userName, string password)
        {
            // 1 :  can login-
            //  0 : error
            // -1 : package is expired
            // -2 : device code is not correct
            // -3 : serial is not active
            // -4 : customer server code is wrong
            // -5 : login date is before last login date

            try
            {
                using (incposdbEntities entity = new incposdbEntities())
                {
                    //check support user
                    if (userName == "Support@Increase")
                    {
                        var suppUser = entity.users.Where(u => u.isActive == 1 && u.username == userName && u.password == password && u.isAdmin == true).FirstOrDefault();
                        if (suppUser != null)
                        {
                            return(1);
                        }
                    }
                    //compair login date with last login date for this user
                    var user = entity.users.Where(x => x.username == userName && x.password == password && x.isActive == 1).FirstOrDefault();
                    if (user != null)
                    {
                        var logs = entity.usersLogs.Where(x => x.userId == user.userId).OrderByDescending(x => x.sInDate).FirstOrDefault();
                        if (logs != null && logs.sInDate > DateTime.Now)
                        {
                            return(-5);
                        }
                    }
                    ActivateController ac = new ActivateController();
                    int active            = ac.CheckPeriod();
                    if (active == 0)
                    {
                        return(-1);
                    }
                    else
                    {
                        var tmpObject = entity.posSetting.Where(x => x.posId == posId).FirstOrDefault();
                        if (tmpObject != null)
                        {
                            // check customer code
                            if (tmpObject.posDeviceCode != deviceCode)
                            {
                                return(-2);
                            }
                            //check customer server code
                            ProgramDetailsController pc = new ProgramDetailsController();
                            var programD = pc.getCustomerServerCode();
                            if (programD == null || programD.customerServerCode != ac.ServerID())
                            {
                                return(-4);
                            }
                        }
                        // check serial && package avalilability
                        var serial         = entity.posSetting.Where(x => x.posId == posId && x.posSerials.isActive == true).FirstOrDefault();
                        var programDetails = entity.ProgramDetails.Where(x => x.isActive == true).FirstOrDefault();
                        if (serial == null || programDetails == null)
                        {
                            return(-3);
                        }
                    }

                    return(1);
                }
            }
            catch
            {
                return(0);
            }
        }