Пример #1
0
 public bool AddEmailNewUser(string sEmail, out string sErrMessage)
 {
     try
     {
         dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext();
         SoftBottinBD.User niUser = new SoftBottinBD.User
         {
             Email = sEmail
         };
         dbConection.Users.InsertOnSubmit(niUser);
         try
         {
             dbConection.SubmitChanges();
         }
         catch (Exception ex)
         {
             cUtilities.WriteLog(ex.Message, out sErrMsj);
             sErrMessage = ex.Message;
             return(false);
         }
         sErrMessage = "";
         return(true);
     }
     catch (Exception ex)
     {
         cUtilities.WriteLog(ex.Message, out sErrMsj);
         sErrMessage = ex.Message;
         return(false);
     }
 }
Пример #2
0
        public bool SignIn(string sFirstName, string sLastName, string sEmail, string sPassword, out string sErrMessage)
        {
            try
            {
                sErrMessage = "";
                dbConection = new SoftBottinBD.SoftBottinDataClassesDataContext();
                SoftBottinBD.User niUser = new SoftBottinBD.User
                {
                    FirstName = sFirstName,
                    LastName  = sLastName,
                    Email     = sEmail
                };

                dbConection.Users.InsertOnSubmit(niUser);
                dbConection.SubmitChanges();


                SoftBottinBD.UserAccount niUserAccount = new SoftBottinBD.UserAccount
                {
                    UserName = sEmail,
                    Password = sPassword,
                    UserId   = niUser.Id,
                    RoleId   = 2
                };

                dbConection.UserAccounts.InsertOnSubmit(niUserAccount);
                dbConection.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                cUtilities.WriteLog(ex.Message, out sErrMsj);
                sErrMessage = ex.Message;
                return(false);
            }
        }