Ejemplo n.º 1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateProfile cp = new CreateProfile(this);

            cp.ShowDialog();
            cp.FormClosed += new FormClosedEventHandler(On_NPFC);
        }
Ejemplo n.º 2
0
        public void saveKey()
        {
            var filepath = "Data/ProfileData/licence.csv";

            if (!System.IO.Directory.Exists("Data/ProfileData"))
            {
                System.IO.Directory.CreateDirectory("Data/ProfileData");//.Dispose();
            }
            if (!System.IO.File.Exists(filepath))
            {
                System.IO.File.Create(filepath).Close();//.Dispose();
            }
            using (StreamReader sr = new StreamReader(filepath))
            {
                CreateProfile p = new CreateProfile(null);
                if (!p.CheckExisting("licence.csv", key.Text))
                {
                    sr.Dispose();
                    var csv = new StringBuilder();

                    //in your loop
                    var newLine = string.Format("{0},{1}",
                                                key.Text, DateTime.Now.ToString()
                                                );
                    csv.AppendLine(newLine);
                    //after your loop
                    File.AppendAllText(filepath, csv.ToString());
                }
            }
        }
        public void CreateProfileShouldRedirectCorrectlyWhenErroring()
        {
            //ARRANGE
            var model = new CreateProfile {
                Day = 13, Month = 09, Year = 1984, Answer = "test"
            };
            const string userName = "******";
            var          user     = new User();

            var userMock = new Mock <IPrincipal>();

            userMock
            .Setup(p => p.Identity.Name)
            .Returns(userName);

            var context = new Mock <HttpContextBase>();

            context
            .Setup(ctx => ctx.User)
            .Returns(userMock.Object);

            var controllerContext = new Mock <ControllerContext>();

            controllerContext
            .Setup(con => con.HttpContext)
            .Returns(context.Object);

            var userLogic = new Mock <IUserLogic>();

            userLogic
            .Setup(x => x.FindByName(userName))
            .Returns(user)
            .Verifiable("Should get the user.");

            userLogic
            .Setup(x => x.Update(user))
            .Returns(false)
            .Verifiable("Should create the user");

            var encryptionHelper = new Mock <IEncryptionHelper>();

            encryptionHelper
            .Setup(x => x.EncryptString("test", "JellyTank"))
            .Verifiable();

            var controller = new ProfileController(userLogic.Object, null, encryptionHelper.Object)
            {
                ControllerContext = controllerContext.Object
            };

            //ACT
            var result = controller.CreateProfile(model) as ViewResult;

            //ASSERT
            userLogic.Verify();
            encryptionHelper.Verify();

            Assert.NotNull(result);
            Assert.AreEqual("CreateProfile", result.ViewName);
        }
Ejemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     magic = new BlackMagic();
     if (magic.OpenProcessAndThread(SProcess.GetProcessFromProcessName("WoW")))
     {
         handle           = FindWindow(null, "World of Warcraft");
         attachLabel.Text = "Attached to WoW";
         if (profileLoaded && spellsLoaded)
         {
             startButton.Show();
             start = 3;
         }
         attached = true;
         menuButton3.Show();
         newProfile = new CreateProfile(magic, pointsTextBox);
         // //check this
         profileThread = new Thread(newProfile.DoWork);
         profileThread.Start();
         sendMsgBox.Show();
         sendMsgButton.Show();
         sayLabel.Show();
         whisperLabel.Show();
         replyLabel.Show();
         partyLabel.Show();
         guildLabel.Show();
         //testLabel.Text = magic.ReadShort((uint)TbcOffsets.General.Cursor)+"";
     }
     else
     {
         attachLabel.Text = "World of Warcraft does not appear to be running";
     }
 }
Ejemplo n.º 5
0
        private void btn_saveProxies_Click(object sender, RoutedEventArgs e)
        {
            CreateProfile cp = new CreateProfile("");

            if (proxyName.Text != "")
            {
                List <MainWindow.ComboData> ListData = new List <MainWindow.ComboData>();
                ListData.Add(new MainWindow.ComboData {
                    Id = proxyName.Text, Value = proxyName.Text
                });
                //proxy_list.ItemsSource = ListData;
                //proxy_list.DisplayMemberPath = "Value";
                //proxy_list.SelectedValuePath = "Id";
                //proxy_list.SelectedValue = proxyName.Text;
                saveProxies();
                MessageBox.Show("Proxy Created With Name: " + proxyName.Text);
            }
            else if (proxy_list.SelectedIndex != 0)
            {
                editProxies();
                MessageBox.Show("Proxy Saved!!");
            }
            else
            {
                cp.profile_name.BorderBrush = new SolidColorBrush(Colors.Red);
            }
        }
Ejemplo n.º 6
0
        private void UpdateStudentProfile(CreateProfile createProfile)
        {
            var student = _studentRepository.GetById(createProfile.Id);

            student.Password    = _accountService.HashPassword(createProfile.NewPassword);
            student.Identifier  = createProfile.Identifier;
            student.PhoneNumber = createProfile.PhoneNumber;

            _studentRepository.Update(student);
        }
Ejemplo n.º 7
0
    public void ClickToGame(int i)
    {
        LevelLoader LL = (LevelLoader)FindObjectOfType(typeof(LevelLoader));

        CreateProfile CP = (CreateProfile)FindObjectOfType(typeof(CreateProfile));

        // LevelLoader LL2 = Object.FindObjectOfType<LevelLoader>();
        LL.Level = CP.levelNumber;
        LL.LoadLevel(i);
    }
Ejemplo n.º 8
0
 private void button2_Click(object sender, EventArgs e)
 {
     zBox.Checked    = false;
     loopBox.Checked = false;
     pointsTextBox.Clear();
     newProfile.Halt();
     newProfile    = new CreateProfile(magic, pointsTextBox);
     profileThread = new Thread(newProfile.DoWork);
     profileThread.Start();
 }
 public int Create([FromBody] CreateProfile createProfileInfo)
 {
     return(DBFacilitator.GetInteger(
                PostgreSQLConnectionString,
                CREATE_USER,
                new List <Tuple <string, string, NpgsqlDbType> >()
     {
         { new Tuple <string, string, NpgsqlDbType>(":Username", createProfileInfo.Username, NpgsqlDbType.Text) },
         { new Tuple <string, string, NpgsqlDbType>(":ApplicationName", createProfileInfo.AppName, NpgsqlDbType.Text) },
         { new Tuple <string, string, NpgsqlDbType>(":LastActivityDate", DateTime.Now.ToString(), NpgsqlDbType.Date) },
         { new Tuple <string, string, NpgsqlDbType>(":LastUpdatedDate", DateTime.Now.ToString(), NpgsqlDbType.Date) },
         { new Tuple <string, string, NpgsqlDbType>(":IsAnonymous", createProfileInfo.IsAuthenticated ? "N" : "Y", NpgsqlDbType.Char) }
     }
                ).Value);
 }
Ejemplo n.º 10
0
        public ViewResult LoginSuccess(string email, string password, CreateProfile createprofile)
        {
            //if user has an account
            //return login success
            //else
            //return loginFailed

            email    = createprofile.Email;
            password = createprofile.PassWord;
            bool account = false;

            foreach (var ac in Repository.Accounts)
            {
                if (ac.Email == email && ac.PassWord == password)
                {
                    account = true;
                }
            }
            if (account == true)
            {
                return(View());
            }
            else
            {
                return(View("LoginFail"));
            }



            // if (Repository.accounts.Contains(email) && Repository.accounts.Contains(password))
            // {
            //     return View();
            // }
            // else
            // {
            //     return View("LoginFail");
            // }

            // if ()
            // {
            //     return View("LoginSuccess");
            // }
            // else
            // {
            //     return View("LoginFail");
            // }
            //return View(Repository.Accounts);
        }
Ejemplo n.º 11
0
        public virtual ActionResult CreateProfile(CreateProfile createProfile)
        {
            if (!ModelState.IsValid)
            {
                return(View(MVC.Student.Views.ViewNames.CreateProfile));
            }
            if (_accountService.UserIdentifierExist(createProfile.Identifier))
            {
                ModelState.AddModelError("Identifier", WebMessage.GlobalMessage.EMAIL_ALREADY_USED);
                return(View(MVC.Student.Views.ViewNames.CreateProfile));
            }

            UpdateStudentProfile(createProfile);

            return(AuthenticateStudent(createProfile.Id));
        }
Ejemplo n.º 12
0
        public IActionResult ThankYou(string email, string password, CreateProfile account)
        {
            //string account;
            if (IsValidEmail(email) == true && IsValidPassWord(password) == true)
            {
                Repository.AddAccount(account);
                return(View("AccountCreated"));

                //Console.WriteLine("Email is good");
            }
            else
            {
                return(View("AccountFailed"));
                //Console.WriteLine("Email is bad");
            }

            //return View();
        }
Ejemplo n.º 13
0
        public ActionResult Create(CreateProfile profile)
        {
            if (CurrentAccount.Profile != null)
            {
                updateTempMessage("Profile already created!");
                return(RedirectToAction("Detail"));
            }
            if (ModelState.IsValid)
            {
                //insert organization
                _workUnit.OrganizationRepository.InsertEntity(profile.Organization);
                _workUnit.ContactRepository.InsertEntity(profile.Contact);
                _workUnit.saveChanges();

                var p = new Profile()
                {
                    Contact      = profile.Contact,
                    Organization = profile.Organization,
                    UserGroupID  = profile.UserGroupID,
                    CategoryID   = profile.CategoryID,
                    LastUpdate   = DateTime.Now
                };

                _workUnit.ProfileRepository.InsertEntity(p);
                _workUnit.saveChanges();

                var account = CurrentAccount;
                if (account != null)
                {
                    account.Profile        = p;
                    account.Contact        = profile.Contact;
                    account.IsProfileOwner = true;
                    _workUnit.AccountRepository.UpdateEntity(account);
                    _workUnit.saveChanges();
                }

                return(RedirectToAction("ManageTag", "Tag"));
            }
            //error
            profile.Categories = _workUnit.CategoryRepository.Entities.OrderBy(x => x.Name).ToList();
            profile.UserGroups = _workUnit.UserGroupRepository.Entities.OrderBy(x => x.Name).ToList();
            return(View(profile));
        }
Ejemplo n.º 14
0
        private ActionResult <CreatePersonProfilResult> _CreatePersonAndProfil(CreateEntity createEntity)
        {
            if (createEntity.ProfileCibleType == Profile.Referent || createEntity.ProfileCibleType == Profile.Proche)
            {
                if (createEntity.ProfileParentId.HasValue == false)
                {
                    return(new ActionResult <CreatePersonProfilResult>(false, null, "Pour creer un {0} il doit etre ratache un beneficiare via ProfileParentId".ToErrorMessage(createEntity.ProfileCibleType.ToString())));
                }
            }


            var createPerson  = new CreatePerson(createEntity);
            var createProfile = new CreateProfile(createEntity);


            var createPersonProfilResult = new CreatePersonProfilResult();

            if (createProfile.AccountId.HasValue == false)
            {
                var person = _CreatePerson(createPerson);
                createPersonProfilResult.SetFromPersonResult(person.Entity);
                if (person.Succeeded == false || person.Entity.accountId == 0)
                {
                    return(new ActionResult <CreatePersonProfilResult>(false, createPersonProfilResult, person.Messages));
                }
                createProfile.AccountId = person.Entity.accountId;
            }

            var profile = _CreateProfile(createProfile);

            createPersonProfilResult.SetFromProfilResult(profile.Entity);


            if (profile.Succeeded == false)
            {
                return(new ActionResult <CreatePersonProfilResult>(profile.Succeeded, createPersonProfilResult, profile.Messages));
            }



            return(new ActionResult <CreatePersonProfilResult>(profile.Succeeded, createPersonProfilResult, profile.Messages));
        }
Ejemplo n.º 15
0
        public bool saveProxies()
        {
            var filepath = "Data/ProfileData/proxies.csv";

            if (!System.IO.Directory.Exists("Data/ProfileData"))
            {
                System.IO.Directory.CreateDirectory("Data/ProfileData");//.Dispose();
            }
            if (!System.IO.File.Exists(filepath))
            {
                System.IO.File.Create(filepath).Close();//.Dispose();
            }
            bool result = false;

            using (StreamReader sr = new StreamReader(filepath))
            {
                CreateProfile p = new CreateProfile(null);
                if (!p.CheckExisting("proxies.csv", proxyName.Text))
                {
                    sr.Dispose();
                    var    csv      = new StringBuilder();
                    string richText = new TextRange(proxyValues.Document.ContentStart, proxyValues.Document.ContentEnd).Text.Replace("\r\n", "|").Replace(",", "|");

                    //in your loop
                    var newLine = string.Format("{0},{1},{2}",
                                                proxyName.Text, richText, DateTime.Now.ToString()
                                                );
                    csv.AppendLine(newLine);
                    //after your loop
                    File.AppendAllText(filepath, csv.ToString());
                    populateList();
                    result = true;
                }
                else
                {
                    MessageBox.Show("Release Already Exists..");
                    result = false;
                }
            }
            return(result);
        }
Ejemplo n.º 16
0
        public bool saveCaptcha()
        {
            var filepath = "Data/ProfileData/captcha.csv";

            if (!System.IO.Directory.Exists("Data/ProfileData"))
            {
                System.IO.Directory.CreateDirectory("Data/ProfileData");//.Dispose();
            }
            if (!System.IO.File.Exists(filepath))
            {
                System.IO.File.Create(filepath).Close();//.Dispose();
            }
            bool result = false;

            using (StreamReader sr = new StreamReader(filepath))
            {
                CreateProfile p = new CreateProfile(null);
                if (!p.CheckExisting("captcha.csv", account_name.Text))
                {
                    sr.Dispose();
                    var csv = new StringBuilder();

                    //in your loop
                    var newLine = string.Format("{0},{1},{2}",
                                                account_name.Text, proxy.Text.Trim(), DateTime.Now.ToString()
                                                );
                    csv.AppendLine(newLine);
                    //after your loop
                    File.AppendAllText(filepath, csv.ToString());
                    result = true;
                }
                else
                {
                    MessageBox.Show("Release Already Exists..");
                    result = false;
                }
            }
            return(result);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Handle node actions
        /// </summary>
        /// <param name="action">action that was triggered</param>
        /// <param name="status">asynchronous status for updating the console</param>
        protected override void OnAction(Microsoft.ManagementConsole.Action action, AsyncStatus status)
        {
            switch ((string)action.Tag)
            {
            case "CreateProfile":
                CreateProfile newProfile = new CreateProfile();
                if (this.SnapIn.Console.ShowDialog(newProfile) == DialogResult.OK)
                {
                    Profile caProfile = newProfile.profile;

                    // Update the caInfo object and save the profile
                    ProfileDb newEntry = new ProfileDb()
                    {
                        profile = caProfile,
                        file    = caProfile.SaveXml(caInfo.ProfilesLocation)
                    };
                    caInfo.AddProfile(newEntry);

                    // notify any listening views that a change happened
                    RaiseOnChange((string)action.Tag);
                }
                break;
            }
        }
 public int Create([FromBody] CreateProfile createProfileInfo)
 {
     return(dal.CreateProfileForUser(createProfileInfo.Username, createProfileInfo.IsAuthenticated, createProfileInfo.AppName));
 }
Ejemplo n.º 19
0
 public void Post(CreateProfile request)
 {
     _dlnaManager.CreateProfile(request);
 }
Ejemplo n.º 20
0
        private void openFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (panel2.Visible)
            {
                ofd.Filter      = "Spell files (.spell)|*.spell|All Files (*.*)|*.*";
                ofd.FilterIndex = 1;
                ofd.Multiselect = false;
                DialogResult result = ofd.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string filename = ofd.FileName;
                    try
                    {
                        newSpells = new Spells();
                        newSpells.Load(filename);
                    }
                    catch (Exception ex)
                    {
                        profileLabel2.Text = "Error opening file";
                        errorLabel.Text    = ex.Message;
                    }
                }
            }
            else
            {
                ofd.Filter      = "Profile files (.profile)|*.profile|All Files (*.*)|*.*";
                ofd.FilterIndex = 1;
                ofd.Multiselect = false;
                DialogResult result = ofd.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string filename = ofd.FileName;
                    try
                    {
                        newProfile = new CreateProfile(magic, pointsTextBox);
                        newProfile.Load(filename);
                        profileThread = new Thread(newProfile.DoWork);
                        profileThread.Start();
                        pointsTextBox.Clear();
                        ghostNumber.Text = newProfile.Ghostpoint + "";
                        if (newProfile.IgnoreZ)
                        {
                            zBox.Checked = true;
                        }
                        else
                        {
                            zBox.Checked = false;
                        }
                        if (newProfile.Loop)
                        {
                            loopBox.Checked = true;
                        }
                        else
                        {
                            loopBox.Checked = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        profileLabel2.Text = "Error opening file";
                        errorLabel.Text    = ex.Message;
                    }
                }
            }
        }
 public IProfileModel Any(CreateProfile request)
 {
     return(workflow.Create(request));
 }
Ejemplo n.º 22
0
        public void CreateProfileShouldCreateTheProfile()
        {
            //ARRANGE
            var id    = Guid.NewGuid();
            var model = new CreateProfile {
                Day = 13, Month = 09, Year = 1984, SecretQuestionId = id, Answer = "test"
            };
            const string userName = "******";
            var          user     = new User {
                Id = "9fa22176-d0d4-4746-bc3d-28dd01ffae29"
            };

            var userMock = new Mock <IPrincipal>();

            userMock
            .Setup(p => p.Identity.Name)
            .Returns(userName);

            var context = new Mock <HttpContextBase>();

            context
            .Setup(ctx => ctx.User)
            .Returns(userMock.Object);

            var controllerContext = new Mock <ControllerContext>();

            controllerContext
            .Setup(con => con.HttpContext)
            .Returns(context.Object);

            var userLogic = new Mock <IUserLogic>();

            userLogic
            .Setup(x => x.FindByName(userName))
            .Returns(user)
            .Verifiable("Should get the user.");

            userLogic
            .Setup(x => x.Update(user))
            .Returns(true)
            .Verifiable("Should create the user");

            var secretQuestionLogic = new Mock <ISecretQuestionLogic>();

            secretQuestionLogic
            .Setup(x => x.SaveSecretQuestionForUser(user.Id, id))
            .Verifiable("Should save secret question choice.");

            var encryptionHelper = new Mock <IEncryptionHelper>();

            encryptionHelper
            .Setup(x => x.EncryptString("test", "JellyTank"))
            .Verifiable();

            var controller = new ProfileController(userLogic.Object, secretQuestionLogic.Object, encryptionHelper.Object)
            {
                ControllerContext = controllerContext.Object
            };

            //ACT
            var result = controller.CreateProfile(model) as RedirectToRouteResult;

            //ASSERT
            userLogic.Verify();
            secretQuestionLogic.Verify();
            encryptionHelper.Verify();

            Assert.NotNull(result);
            Assert.AreEqual("Index", result.RouteValues["Action"]);
            Assert.AreEqual("Home", result.RouteValues["Controller"]);
        }
Ejemplo n.º 23
0
        private ActionResult <createProfileResponseDto> _CreateProfile(CreateProfile createProfil)
        {
            int  profileParentId          = 0;
            bool profileParentIdSpecified = false;

            if (createProfil.ProfileCibleType == Profile.OperateurStructure || createProfil.ProfileCibleType == Profile.PersonnelMedical || createProfil.ProfileCibleType == Profile.PersonnelNonMedical || createProfil.ProfileCibleType == Profile.PersonnelParaMedical)
            {
                profileParentId          = createProfil.ProfileParentId ?? this.StructureProfilId;
                profileParentIdSpecified = true;
            }
            else if (createProfil.ProfileCibleType == Profile.Referent || createProfil.ProfileCibleType == Profile.Proche)
            {
                if (createProfil.ProfileParentId.HasValue == false)
                {
                    return(new ActionResult <createProfileResponseDto>(false, null, "Pour creer un {0} il doit etre ratache un beneficiare via ProfileParentId".ToErrorMessage(createProfil.ProfileCibleType.ToString())));
                }
                profileParentId          = createProfil.ProfileParentId.Value;
                profileParentIdSpecified = true;
            }
            else if (createProfil.ProfileCibleType == Profile.Beneficiaire || createProfil.ProfileCibleType == Profile.StructureAidePersonne || createProfil.ProfileCibleType == Profile.OperateurStructureUrgence || createProfil.ProfileCibleType == Profile.Urgentiste)
            {
                profileParentId          = 0;
                profileParentIdSpecified = false;
            }


            var createProfileDto = new createProfileDto()
            {
                DOME_header = new R521.domeHeaderDto()
                {
                    langue = "fr",
                    deviceTypeSpecified = true,
                    deviceType          = (int)DeviceType,
                    dateSpecified       = true,
                    date    = AuthentificationHelper.date,
                    version = AuthentificationHelper.version,
                },

                accountId          = createProfil.AccountId ?? -1,
                accountIdSpecified = createProfil.AccountId.HasValue,

                personIdMetier = createProfil.PersonIdMetier,

                profileCibleType          = (int)createProfil.ProfileCibleType,
                profileCibleTypeSpecified = true,

                personSocietyRole          = ((int?)createProfil.PersonSocietyRole) ?? -1,
                personSocietyRoleSpecified = createProfil.PersonSocietyRole.HasValue,

                profileParentId          = profileParentId,
                profileParentIdSpecified = profileParentIdSpecified,

                profileAvatar          = createProfil.ProfileAvatar ?? -1,
                profileAvatarSpecified = createProfil.ProfileAvatar.HasValue,

                prestationListId = createProfil.PrestationListId,

                profileSectoring = createProfil.ProfileSectoring,

                profileSpecialCriteria = createProfil.ProfileSpecialCriteria
            };


            var createProfileDomeResult = DomeCallSoap.CreateProfile(createProfileDto);

            if (createProfileDomeResult.statusId == 0)
            {
                return(new ActionResult <createProfileResponseDto>(true, createProfileDomeResult));
            }
            return(new ActionResult <createProfileResponseDto>(false, createProfileDomeResult, new Message(MessageType.Error, createProfileDomeResult.statusErrorMessage)));
        }
 private void signUpBtn_Click(object sender, EventArgs e)
 {
     cProfile = new CreateProfile();
     cProfile.Show();
     cProfile.created += profileCreated;
 }