Beispiel #1
0
 private void Cb_TypePassbook_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.Cb_TypePassbook.ItemsSource != null)
     {
         ComboBox cb = sender as ComboBox;
         if (cb.SelectedItem != null)
         {
             TypePassbook type       = cb.SelectedItem as TypePassbook;
             int          idcustomer = int.Parse(this.Txt_CustomerID.Text);
             string       name       = type.Typename;
             this.Txt_PassbookID.Text = PassbookDAO.Instance.GetPassbookIDbyCusIDandidType(idcustomer, name).ToString();
             int id = int.Parse(this.Txt_PassbookID.Text);
             this.Balance.Text = "Số dư:" + PassbookDAO.Instance.GetBalancebyIDPassbook(id).ToString();
             if (type.Kind != "Không kì hạn")
             {
                 this.Money.Text      = PassbookDAO.Instance.GetBalancebyIDPassbook(id).ToString();
                 this.Money.IsEnabled = false;
             }
             else
             {
                 this.Money.IsEnabled = true;
             }
         }
     }
 }
Beispiel #2
0
        private void Add_Type(object sender, RoutedEventArgs e)
        {
            TypePassbook type = new TypePassbook
            {
                Min_passbookblance = int.Parse(this.TextBox_MinBalanceMoney.Text),
                Interest_rate      = float.Parse(this.TextBox_InterestRate.Text) / 100
            };

            if (this.RadioButton_Noterm.IsChecked == true)
            {
                type.Term         = 0;
                type.Withdrawterm = int.Parse(this.TextBox_MinWithdrawDay.Text.ToString());
            }
            else
            {
                type.Term = int.Parse(this.TextBox_Term.Text);
            }
            type.Min_collectmoney = int.Parse(this.TextBox_MinCollectMoney.Text);
            try { TypePassbookDAO.Instance.InsertType(type); }
            catch { MessageBoxCustom.setContent("Trùng loại tiết kiệm").ShowDialog(); }
            SetReadOnly(true);
            enableRadioButton(false);
            this.TextBox_Term.IsReadOnly = true;
            ShowTreeItem();
        }
Beispiel #3
0
 private void Listview_SelectionChange(object sender, SelectionChangedEventArgs e)
 {
     if (this.ListView_TransactionType.Items.Count > 0)
     {
         TypePassbook typepassbook = (TypePassbook)(this.ListView_TransactionType.SelectedItem as ListViewItem).Tag;
         this.TextBox_MinBalanceMoney.Text = typepassbook.Min_passbookblance.ToString();
         this.TextBox_MinWithdrawDay.Text  = typepassbook.Withdrawterm.ToString();
         this.TextBox_MinCollectMoney.Text = typepassbook.Min_collectmoney.ToString();
         this.TextBox_InterestRate.Text    = (typepassbook.Interest_rate * 100).ToString();
         this.TextBox_Term.Text            = typepassbook.Term.ToString();
         this.Button_Add.Visibility        = Visibility.Collapsed;
         this.Button_Save.Visibility       = Visibility.Collapsed;
         this.Button_Fix.Visibility        = Visibility.Visible;
         if (typepassbook.Term > 0)
         {
             this.RadioButton_Yesterm.IsChecked = true;
             SetTermTypeMode(true);
         }
         else
         {
             this.RadioButton_Noterm.IsChecked = true;
             SetTermTypeMode(false);
         }
         this.Texblock_title.Text = "Thông tin";
         SetReadOnly(true);
         enableRadioButton(false);
     }
 }
        public List <TypePassbook> GetListType()
        {
            List <TypePassbook> list = new List <TypePassbook>();
            string    query          = "select * from dbo.typepassbook";
            DataTable data           = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                TypePassbook type = new TypePassbook(item);
                list.Add(type);
            }
            return(list);
        }
        public List <TypePassbook> GetListTypeByCusID(int CusID)
        {
            List <TypePassbook> list = new List <TypePassbook>();
            string    query          = "select * from dbo.typepassbook where id in( select passbook_type from passbook, customer where passbook_customer=" + CusID + ")";
            DataTable data           = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                TypePassbook type = new TypePassbook(item);
                list.Add(type);
            }
            return(list);
        }
        public void InsertType(TypePassbook type)
        {
            float  Interset_rate      = type.Interest_rate;
            int    term               = type.Term;
            long   min_passbookblance = type.Min_passbookblance;
            long   min_collectmoney   = type.Min_collectmoney;
            string query1             = string.Format("usp_InsertTypePassbook {0}, {1}, {2}, {3} ", Interset_rate, term, min_passbookblance, min_collectmoney);

            DataProvider.Instance.ExcuteNonQuery(query1);
            string query = string.Format("update dbo.typepassbook set withdrawterm = {0} where interest_rate = {1} and term = {2} and min_balance = {3} and min_collectmoney = {4} ", type.Withdrawterm, Interset_rate, term, min_passbookblance, min_collectmoney);

            if (type.Term == 0)
            {
                DataProvider.Instance.ExcuteNonQuery(query);
            }
        }
Beispiel #7
0
 private void Delete_type(object sender, RoutedEventArgs e)
 {
     if (MessageBoxCustom.setContent("Bạn thực sự muốn xóa loại tiết kiệm này?").ShowDialog() == true)
     {
         if (this.ListView_TransactionType.Items.Count > 0)
         {
             TypePassbook typepassbook = (TypePassbook)(this.ListView_TransactionType.SelectedItem as ListViewItem).Tag;
             if (!TypePassbookDAO.Instance.CheckIfExistActivePassbookInType(typepassbook.Id))
             {
                 TypePassbookDAO.Instance.DeleteType(typepassbook.Id);
                 ShowTreeItem();
             }
             else
             {
                 MessageBoxCustom.setContent("Loại tiết kiệm này vẫn còn sổ mở").ShowDialog();
             }
         }
     }
 }
Beispiel #8
0
        private void Cb_TypePassbook_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int customerID;

            if (int.TryParse(this.Txt_CustomerID.Text, out customerID) == true)
            {
                if (this.Cb_TypePassbook.ItemsSource == null)
                {
                    return;
                }
                else
                {
                    ComboBox cb = sender as ComboBox;
                    if (cb.SelectedItem != null)
                    {
                        customerID = int.Parse(this.Txt_CustomerID.Text);
                        TypePassbook type = cb.SelectedItem as TypePassbook;
                        string       name = type.Typename;

                        this.Txt_PassbookID.Text = PassbookDAO.Instance.GetPassbookIDbyCusIDandidType(customerID, name).ToString();
                    }
                }
            }
        }
Beispiel #9
0
        private void Save_Type(object sender, RoutedEventArgs e)
        {
            this.Button_Save.Visibility = Visibility.Collapsed;
            this.Button_Fix.Visibility  = Visibility.Visible;
            SetReadOnly(true);

            TypePassbook type;

            try { type = (this.ListView_TransactionType.SelectedItem as ListViewItem).Tag as TypePassbook; } catch { type = new TypePassbook(); }
            if (type != null)
            {
                long  minBalanceMoney = long.Parse(this.TextBox_MinBalanceMoney.Text);
                long  minCollectMoney = long.Parse(this.TextBox_MinCollectMoney.Text);
                float interestRate    = float.Parse(this.TextBox_InterestRate.Text) / 100;
                int   minWithDrawDay  = int.Parse(this.TextBox_MinWithdrawDay.Text);
                TypePassbookDAO.Instance.UpdateType(type.Id, minCollectMoney, minBalanceMoney, interestRate, minWithDrawDay);
            }
            LoadListTreeItem();
        }