Exemplo n.º 1
0
        public static void inregistreaza_companie(string director, string nume, string adresa, string email, string telefon, string parola)
        {
            string hash = SecurePasswordHasher.Hash(parola);

            char[] delimiters = { ',' };
            string skills     = SignInCompany.get_skillsC();

            string[] words = skills.Split(delimiters);

            var contextC    = new LinkedinEntities5();
            var newCompanie = new Companie()
            {
                Nume_companie     = nume,
                Adresa_companie   = adresa,
                Email_companie    = email,
                Telefon_companie  = telefon,
                UsernameC         = nume,
                ParolaC           = hash,
                Director_companie = director
            };

            foreach (string s in words)
            {
                Aptitudini apt = new Aptitudini {
                    Aptitudine = s
                };
                newCompanie.Aptitudini.Add(apt);
            }

            using (var context = new LinkedinEntities5())
            {
                context.Companie.Add(newCompanie);
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public static void inregistreaza_client(string firstname, string lastname, string username, string pass, string phone, string email, string date, string university, string address, int sex_id, int status_id, string nationality, Byte[] result)
        {
            string      format   = "dd/MM/yyyy";
            CultureInfo provider = CultureInfo.InvariantCulture;

            DateTime myDate = DateTime.ParseExact(date, format, provider);

            string hash     = SecurePasswordHasher.Hash(pass);
            var    verifica = SecurePasswordHasher.Verify(pass, hash);

            char[] delimiters = { ',' };
            string skills     = Skills.get_skill();

            string[] words = skills.Split(delimiters);


            var newClient = new Client()
            {
                Nume                = firstname,
                Prenume             = lastname,
                Data_Nasterii       = myDate,
                Email               = email,
                Poza                = result,
                Facultate_absolvita = university,
                ID_sex              = sex_id,
                ID_statut_social    = status_id,
                Adresa              = address,
                Telefon             = phone,
                Nationalitate       = nationality,
                Limbi_straine       = "engleza",
                Username            = username,
                Parola              = hash
            };

            foreach (string s in words)
            {
                Aptitudini apt = new Aptitudini {
                    Aptitudine = s
                };
                newClient.Aptitudini.Add(apt);
            }

            using (var context = new LinkedinEntities5())
            {
                context.Client.Add(newClient);
                context.SaveChanges();
            }
        }