Exemple #1
0
        private void list_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) //pick
        {
            ListView lv   = sender as ListView;
            Border   item = (Border)lv.SelectedItem;

            if (item != null && lv.SelectedIndex != 0)
            {
                if (!refresh())
                {
                    return;
                }

                TextBlock idcontainer = (TextBlock)((Border)((StackPanel)item.Child).Children[0]).Child;
                string    id          = idcontainer.Text;

                if (mode == "loan")
                {
                    TextBlock namecontainer = (TextBlock)((Border)((StackPanel)item.Child).Children[1]).Child;
                    string    name          = namecontainer.Text;

                    App.Current.Properties["loancid"]   = id;
                    App.Current.Properties["loancname"] = name;

                    ChooseAccount window = new ChooseAccount();
                    window.Show();
                    this.Hide();
                }
                else
                {
                    SqlCommand cmd = new SqlCommand("INSERT INTO CLIENT_ACCOUNTS (aid, cid) VALUES (" + editing.ID.ToString() + ", " + id + ")");
                    cmd.Connection = cn;
                    cmd.ExecuteNonQuery();

                    AccountDetails window = new AccountDetails();
                    window.Show();
                    this.Hide();
                }
            }
        }
Exemple #2
0
        private void list_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) //details
        {
            ListView lv   = sender as ListView;
            Border   item = (Border)lv.SelectedItem;

            if (item != null && lv.SelectedIndex != 0)
            {
                if (!refresh())
                {
                    return;
                }

                TextBlock idcontainer = (TextBlock)((Border)((StackPanel)item.Child).Children[0]).Child;
                string    id          = idcontainer.Text;

                SqlCommand cmd = new SqlCommand("SELECT id, balance, ACCOUNTS.atype, descr, value FROM (ACCOUNTS JOIN ACCOUNT_TYPE ON ACCOUNTS.atype=ACCOUNT_TYPE.atype) join ACC_FINAL_INTEREST on aid=accounts.id WHERE id=" + id);
                cmd.Connection = cn;

                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = cmd;
                DataSet dataSet = new DataSet();
                adapter.Fill(dataSet);

                Account accedit;

                accedit = new Account((int)dataSet.Tables[0].Rows[0]["id"],
                                      (string)dataSet.Tables[0].Rows[0]["descr"],
                                      (double)(decimal)dataSet.Tables[0].Rows[0]["balance"]);
                accedit.Interest = (double)(decimal)dataSet.Tables[0].Rows[0]["value"];

                App.Current.Properties["accedit"] = accedit;
                AccountDetails window = new AccountDetails();
                window.Show();
                this.Hide();
                return;
            }
        }