Пример #1
0
        public int NewUser(byte AccType, string Login, string Password, string Email, string Name, string Surname, string Street, string City, string ZipCode, string HouseNumber, string BlockNumber, string FlatNumber)
        {
            int LoginUsed = 1;
            int EmailUsed = 2;
            int Success   = 3;

            var query_login = from db in database.UzytkownicyMZs
                              where db.login == Login
                              select db;

            var query_email = from db in database.UzytkownicyMZs
                              where db.mail == Email
                              select db;

            UzytkownicyMZ NewAcc = new UzytkownicyMZ();

            NewAcc.login         = Login;
            NewAcc.haslo         = Password;
            NewAcc.mail          = Email;
            NewAcc.imie          = Name;
            NewAcc.nazwisko      = Surname;
            NewAcc.miasto        = City;
            NewAcc.k_pocztowy    = ZipCode;
            NewAcc.ulica         = Street;
            NewAcc.nr_domu       = HouseNumber;
            NewAcc.nr_bloku      = BlockNumber;
            NewAcc.nr_mieszkania = FlatNumber;
            NewAcc.typ_konta     = AccType;

            switch (AccType)
            {
            case 1:
                if (query_login.Any())
                {
                    return(LoginUsed);
                }
                else if (query_email.Any())
                {
                    return(EmailUsed);
                }
                else
                {
                    database.UzytkownicyMZs.InsertOnSubmit(NewAcc);
                    try
                    {
                        database.SubmitChanges();
                        return(Success);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }

            default:
                if (query_login.Any())
                {
                    return(LoginUsed);
                }
                else if (query_email.Any())
                {
                    return(EmailUsed);
                }
                else
                {
                    database.UzytkownicyMZs.InsertOnSubmit(NewAcc);
                    try
                    {
                        database.SubmitChanges();
                        return(Success);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }
            }
        }
Пример #2
0
 partial void UpdateUzytkownicyMZ(UzytkownicyMZ instance);
Пример #3
0
 partial void DeleteUzytkownicyMZ(UzytkownicyMZ instance);
Пример #4
0
 partial void InsertUzytkownicyMZ(UzytkownicyMZ instance);