Example #1
0
        public static UserAccessLevelVM SetSubDataAdmin(UserAccessLevel model)
        {
            var data = UserAccessLevelVM.MToVM(model);

            data.AccessLevel  = StatusTypesReferencesVM.MToVM(StatusTypesReferencesService.GetByID(model.AccessLevelID));
            data.DateTimeData = DateTimeStorageVM.MToVM(DateTimeStorageService.GetByID(model.DateTimeStorageID));
            data.Application  = ApplicationInformationVM.MToVM(ApplicationInformationService.GetByID(model.ApplicationID));
            return(data);
        }
        public async Task <JsonResult> UInsert()
        {
            var dtid = Guid.Parse(Request.Form["dtid"]);

            try {
                var id             = Guid.Parse(Request.Form["id"]);
                var fname          = Request.Form["fname"];
                var lname          = Request.Form["lname"];
                var mname          = Request.Form["mname"];
                var add            = Request.Form["add"];
                var email          = Request.Form["email"];
                var pass           = Request.Form["pass"];
                var repass         = Request.Form["rpass"];
                var cnum           = Request.Form["cnum"];
                var isAllow        = Boolean.Parse(Request.Form["ia"]);
                var areg           = Guid.Parse(Request.Form["areg"]);
                var profID         = Guid.Parse(Request.Form["profid"]);
                var aid            = Guid.Parse(Request.Form["aid"]);
                var hashedPassword = UsersService.GenerateHashPassword(pass);
                if (ApplicationInformationService.GetByID(areg) == null)
                {
                    DateTimeStorageService.RemoveAdmin(dtid);
                    return(Failed("Please do not modify link to complete the signup process " + areg));
                }
                if (!pass.Equals(repass))
                {
                    DateTimeStorageService.RemoveAdmin(dtid);
                    return(Failed("Make sure password matches retype password"));
                }
                if (ValidateEmailAddress(email))
                {
                    if (ValidateContactNumber(cnum))
                    {
                        if (UsersService.Insert(id, fname, lname, mname, add, email, hashedPassword, cnum, isAllow, areg, profID, dtid))
                        {
                            InsertNewUserInformation(id, aid, Guid.Parse("7d789492-1c6c-4ea2-9e1e-893a68620d1e"));
                            return(Success(id.ToString()));
                        }
                    }
                    else
                    {
                        DateTimeStorageService.RemoveAdmin(dtid);
                        return(Failed(MessageUtilityService.InUse("Mobile Number")));
                    }
                }
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.FailedInsert("Signup")));
            } catch {
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.ServerError()));
            }
        }
Example #3
0
        public override IWoxResultFinder PrepareContext()
        {
            IQueryService                  queryService                  = new QueryService();
            IResultService                 resultService                 = new ResultService(WoxContextService);
            ISystemWebAppService           systemWebAppService           = new SystemWebAppService("Wox.WebApp");
            IDataAccessService             dataAccessService             = new DataAccessService(systemWebAppService);
            IWebAppItemRepository          webAppItemRepository          = new WebAppItemRepository(dataAccessService);
            IWebAppConfigurationRepository webAppConfigurationRepository = new WebAppConfigurationRepository(dataAccessService);
            IFileGeneratorService          fileGeneratorService          = new FileGeneratorService();
            IFileReaderService             fileReaderService             = new FileReaderService();
            IHelperService                 helperService                 = new HelperService();
            IWebAppService                 webAppService                 = new WebAppService(dataAccessService, webAppItemRepository, webAppConfigurationRepository, systemWebAppService, fileGeneratorService, fileReaderService, helperService);
            IApplicationInformationService applicationInformationService = new ApplicationInformationService(systemWebAppService);
            IWoxResultFinder               woxWebAppResultFinder         = new WebAppResultFinder(WoxContextService, webAppService, helperService, applicationInformationService, systemWebAppService);

            return(woxWebAppResultFinder);
        }
 private static bool InsertUserAccessLevel(Guid aid, Guid uid)
 {
     try {
         var dtid  = Guid.NewGuid();
         var ualID = Guid.NewGuid();
         DateTimeStorageService.Insert(dtid, ualID, aid, DateTime.Now, DateTime.Now, Guid.Parse("c4926f90-2be8-4c62-94ed-5399be276f11"));
         //check if application exist and user exist
         if (ApplicationInformationService.IsApplicationExist(aid) && UsersService.IsUserExist(uid))
         {
             //insert new user access level for this user
             var ual = Guid.Parse("a2e2d83d-dd8d-4a66-bacf-94ad90344ca7");
             UserAccessLevelService.Insert(ualID, uid, ual, aid, dtid, false);
         }
         return(true);
     }
     catch { return(false); }
 }