private void AccountPropertiesDialog_FormClosing( object sender, FormClosingEventArgs e )
 {
     if( ctx == null || DialogResult != DialogResult.OK ) {
         return;
     }
     if( string.IsNullOrEmpty( textBox1.Text ) ) {
         MessageBox.Show( "Du måste ange ett namn" );
     }
     _account = new Account {
         Name = textBox1.Text
     };
     if( account != null ) {
         _account.ID = account.ID;
     }
     foreach( Control c in panel1.Controls ) {
         CheckBox cb = c as CheckBox;
         if( cb == null || !cb.Checked ) {
             continue;
         }
         User u = (User)cb.Tag;
         _account.PermittedUsers.Add( u.ID );
     }
     NameValueCollection values = new NameValueCollection();
     values.Add( "Name", _account.Name );
     values.Add( "ID", _account.ID );
     foreach( int uid in _account.PermittedUsers ) {
         values.Add( "userid", uid );
     }
     _account = ctx.ServiceCaller.PostData<Account>( string.Format( "{0}/AccountService/Save", ctx.ServiceBaseURL ), values );
 }
Example #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            //SqlConnection connection = new SqlConnection();
            //SqlConnect Con = new SqlConnect();
            //connection = Con.fn_SqlConnect();
            try
            {
                //string Query = "select count (*) from [User] where username = @Username and Password = @Passw0rd;";
                //SqlCommand Sqlcmd = new SqlCommand(Query, connection);

                //Sqlcmd.Parameters.AddWithValue("@Username",txtUsername.Text.Trim());
                //Sqlcmd.Parameters.AddWithValue("@Passw0rd", txtPassword.Text.Trim());
                //int count = Convert.ToInt32(Sqlcmd.ExecuteScalar());
                Account A   = new Accounts.Account();
                bool    Usr = A.Fn_ValidateUser(txtUsername.Text.ToLower().Trim(), txtPassword.Text.ToLower().Trim());

                if (Usr == true)
                {
                    Session["Username"] = txtUsername.Text.Trim();
                    Response.Redirect("Home.aspx", false);
                    //connection.Close();
                    logger.Info("Happy logging!");
                }
                else
                {
                    lblErrorMessage.Visible = true;
                    logger.Info("Invalid User!");
                }
            } catch (Exception ex)
            {
                throw new Exception(ex.Message);
                logger.Info(ex.Message);
            }
        }
 public AccountPropertiesDialog( Account account, HomeFinanceContext ctx )
 {
     this.account = account;
     this.ctx = ctx;
     InitializeComponent();
 }
Example #4
0
 public void RemoveAccount(Account accoun)
 {
     this.accounts.Remove(accoun);
 }
Example #5
0
 public void AddAccount(Account accoun)
 {
     this.accounts.Add(accoun);
 }
        public void ViewOnFacebook(Account facebookUser)
        {
            if (facebookUser.Type != Account.Facebook) return;

            try
            {
                _uriHelper.OpenSchemeUri(new Uri("http://facebook.com/" + facebookUser.UserId));
            }
            catch
            {

            }
        }
        public void ChatOnWhatsApp(Account whatsAppUser, ContactOverview contact)
        {
            if (whatsAppUser.Type != Account.WhatsApp) return;
            if (contact.AddressBookId.IsNullOrEmpty()) return;

            try
            {
                _uriHelper.OpenSchemeUri(new Uri("whatsapp://send?abid=" + contact.AddressBookId));
            }
            catch 
            {

            }
        }
        public void ViewOnTwitter(Account twitterUser)
        {
            if (twitterUser.Type != Account.Twitter) return;

            try
            {
                var userId = twitterUser.UserId.Replace("@", "");
                var schemeUri = new Uri("twitter://user?screen_name=" + userId);
                var fallbackUri = new Uri("https://twitter.com/" + userId);

                _uriHelper.OpenSchemeUri(schemeUri, fallbackUri);
            }
            catch
            {

            }
        }
Example #9
0
 private void LoadAccounts()
 {
     selectedAccount = null;
     menu.Enabled = false;
     Controls.Clear();
     ac = null;
     BackgroundWorker bw = new BackgroundWorker();
     bw.DoWork += BWGetAccounts;
     bw.RunWorkerCompleted += BWComplete;
     TE( false );
     bw.RunWorkerAsync();
 }
Example #10
0
 private void LoadAccount( Account a )
 {
     selectedAccount = a;
     menu.Enabled = true;
     Controls.Clear();
     ac = new AccountControl( a, ctx ){Dock = DockStyle.Fill};
     Controls.Add( ac );
 }
Example #11
0
 public void AddAccount(Account account)
 {
     AccountDao dao = new AccountDao();
     dao.Add(account);
 }
Example #12
0
 public void Add(Account account)
 {
     Console.WriteLine("Adding");
     Thread.Sleep(2000);
     Console.WriteLine("Added");
 }