コード例 #1
0
        public void SetEmailAccount(string emailAddress, IModelAdapter <EmailAccount> emailAccount)
        {
            var email = emailAccount.GetRecordById(emailAccount.Id);

            if (email == null)
            {
                email = new EmailAccount()
                {
                    Email  = emailAddress,
                    UserId = emailAccount.Id
                };
                emailAccount.InsertNewRecord(email);
            }
            else
            {
                emailAccount.EditEntry(email);
            }
        }
コード例 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            _loginForm.ShowDialog();
            if (_loginForm.UserAccountId == 0)
            {
                return;                               //user is not present
            }
            _props.AccountUserId = _loginForm.UserAccountId;
            lblUserId.Text      += _loginForm.UserAccountId;
            _pwTracker.Id        = _loginForm.UserAccountId;
            _props.LoadDataGrid(dv, false);
            var imageLocation = _email.GetRecordById(_loginForm.UserAccountId);

            if (imageLocation == null)
            {
                return;
            }
            _props.SetPictureBoxImage(pbAvatar, imageLocation.PhotoLocation);
        }
コード例 #3
0
 public string GetPhotoLocationFromFile(IModelAdapter <EmailAccount> emailAccount, int userId)
 {
     try
     {
         var fileName = GetTextFile();
         if (!File.Exists(fileName))
         {
             return(DefaultFile);
         }
         var email = emailAccount.GetRecordById(userId);
         email.PhotoLocation = fileName;
         emailAccount.EditEntry(email);
         return(fileName);
     }
     catch (Exception)
     {
         MessageBox.Show("Help!");
         return(null);
     }
 }