示例#1
0
        private void Find(FrameworkElement p)
        {
            string id = "";

            if (p != null)
            {
                var fe = p as Grid;
                if (fe != null)
                {
                    foreach (var item in fe.Children)
                    {
                        var tx = item as TextBox;
                        if (tx != null)
                        {
                            if (tx.Name.Equals("txtSearch"))
                            {
                                id = tx.Text;
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(id))
            {
                BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getListByName(id));
            }
            else
            {
                BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll());
            }
        }
示例#2
0
      private void OKevent(Window p)
      {
          EMPLOYEE em = new EMPLOYEE();

          em.FIRST_NAME         = EmployeeViewObj.first_name;
          em.LAST_NAME          = EmployeeViewObj.last_name;
          em.TITLE              = EmployeeViewObj.title;
          em.START_DATE         = EmployeeViewObj.start_date;
          em.END_DATE           = EmployeeViewObj.end_date;
          em.ASSIGNED_BRANCH_ID = BranchDao.Instance().SelectbyName(EmployeeViewObj.branch).BRANCH_ID;
          em.DEPT_ID            = DepartmentDao.Instace().SelectbyName(EmployeeViewObj.department).DEPT_ID;
          em.SUPERIOR_EMP_ID    = null;
          if (cv == "insert")
          {
              EmployeeDao.Instance().Insert(em);
              evm.EmployeeViewLists = evm.UpdateListview();
          }
          else
          {
              em.EMP_ID = EmployeeViewObj.id;
              EmployeeDao.Instance().Update(em);
              evm.EmployeeViewLists = evm.UpdateListview();
          }
          p.Close();
      }
示例#3
0
 public BranchVM()
 {
     BranchLists      = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll());
     FindCommand      = new RelayCommand <FrameworkElement>((p) => { return(p != null ? true : false); }, (p) => { Find(p); });
     EditFormCommand  = new RelayCommand <BRANCH>((p) => true, (p) => { ShowEditForm(p); });
     DeleteRowCommand = new RelayCommand <BRANCH>((p) => true, (p) => { Remove(p); });
     NewFormCommand   = new RelayCommand <Window>((p) => true, (p) => { NewEditForm(); });
 }
示例#4
0
        private void NewEditForm()
        {
            EmployeeEdit   pro  = new EmployeeEdit();
            EmployeeEditVM eevm = new EmployeeEditVM();

            eevm.evm        = this;
            pro.DataContext = eevm;
            pro.Show();
            pro.txtID.IsReadOnly          = true;
            pro.txtBranch.ItemsSource     = BranchDao.Instance().getAll();
            pro.txtDepartment.ItemsSource = DepartmentDao.Instace().getAll();
        }
示例#5
0
        private void OKevent(Window p)
        {
            ACCOUNT         ac   = new ACCOUNT();
            ACC_TRANSACTION tran = new ACC_TRANSACTION();

            ac.AVAIL_BALANCE      = AccountViewObj.avail_balance;
            ac.CLOSE_DATE         = AccountViewObj.close_date;
            ac.OPEN_DATE          = AccountViewObj.open_date;
            ac.PENDING_BALANCE    = AccountViewObj.pending_balance;
            ac.STATUS             = AccountViewObj.status;
            ac.PRODUCT_CD         = ProductDao.Instance().SelectbyName(AccountViewObj.product).PRODUCT_CD;
            ac.LAST_ACTIVITY_DATE = AccountViewObj.last_date;
            ac.OPEN_BRANCH_ID     = BranchDao.Instance().SelectbyName(AccountViewObj.branch).BRANCH_ID;
            ac.OPEN_EMP_ID        = FindEm(AccountViewObj.NameEm, listem);
            ac.CUST_ID            = CustId;

            tran.EXECUTION_BRANCH_ID = null;
            tran.TELLER_EMP_ID       = null;
            tran.FUNDS_AVAIL_DATE    = Account_tranObj.fund_date;
            tran.AMOUNT      = Account_tranObj.amount;
            tran.TXN_DATE    = Account_tranObj.txndate;
            tran.TXN_TYPE_CD = Account_tranObj.txntype;
            if (cv == "insert")
            {
                try
                {
                    AccountDao.Instance().Insert(ac, tran);
                }
                catch
                {
                    throw new Exception();
                }
            }
            else
            {
                using (SalesEntities3 entity = new SalesEntities3())
                {
                    try
                    {
                        ac.ACCOUNT_ID   = AccountViewObj.id;
                        tran.ACCOUNT_ID = AccountViewObj.id;
                        tran.TXN_ID     = Account_tranObj.txnid;
                        AccountDao.Instance().Update(ac, tran);
                    }
                    catch
                    {
                        throw new Exception();
                    }
                }
            }
            p.Close();
            vm.AccountViewLists = vm.UpdateListview();
        }
示例#6
0
 private void ShowEditForm(EmployeeView pv)
 {
     if (pv != null)
     {
         EmployeeEdit   pro  = new EmployeeEdit();
         EmployeeEditVM eevm = new EmployeeEditVM();
         eevm.evm             = this;
         eevm.EmployeeViewObj = pv;
         pro.DataContext      = eevm;
         pro.Show();
         pro.txtID.IsReadOnly          = true;
         pro.txtBranch.ItemsSource     = BranchDao.Instance().getAll();
         pro.txtDepartment.ItemsSource = DepartmentDao.Instace().getAll();
     }
 }
示例#7
0
 public Account_tran(ACC_TRANSACTION at)
 {
     if (at != null)
     {
         this.txnid     = at.TXN_ID;
         this.amount    = at.AMOUNT;
         this.fund_date = at.FUNDS_AVAIL_DATE;
         this.txndate   = at.TXN_DATE;
         this.txntype   = at.TXN_TYPE_CD;
         if (at.EXECUTION_BRANCH_ID != null)
         {
             this.branch = BranchDao.Instance().SelectbyId(at.EXECUTION_BRANCH_ID).NAME;
         }
         if (at.TELLER_EMP_ID != null)
         {
             this.employee = EmployeeDao.Instance().SelectbyId(at.TELLER_EMP_ID).FIRST_NAME;
         }
     }
 }
示例#8
0
 private void ShowEditForm(AccountView pv)
 {
     if (pv != null)
     {
         AccountEdit ac = new AccountEdit();
         ac.Show();
         AccountEditVM avm = new AccountEditVM();
         ac.DataContext            = avm;
         avm.vm                    = this;
         avm.AccountViewObj        = AccountViewObj;
         avm.Account_tranObj       = Account_tranObj;
         avm.CustId                = AccountViewObj.customer.CUST_ID;
         avm.cv                    = "update";
         ac.ComBranch.ItemsSource  = BranchDao.Instance().getAll();
         ac.ComProduct.ItemsSource = listpro;
         avm.listem                = listem;
         ac.ComEm.ItemsSource      = listem;
     }
 }
示例#9
0
 private void NewEditForm()
 {
     if (AccountViewObj != null)
     {
         AccountEdit ac = new AccountEdit();
         ac.Show();
         AccountEditVM avm = new AccountEditVM();
         ac.DataContext             = avm;
         avm.vm                     = this;
         avm.CustId                 = AccountViewObj.customer.CUST_ID;
         avm.AccountViewObj.NameCus = AccountViewObj.NameCus;
         avm.cv                     = "insert";
         avm.listem                 = listem;
         ac.ComBranch.ItemsSource   = BranchDao.Instance().getAll();
         ac.ComProduct.ItemsSource  = listpro;
         ac.ComEm.ItemsSource       = listem;
     }
     else
     {
         MessageBox.Show("Chưa có tên khách hàng");
     }
 }
示例#10
0
 public AccountView(ACCOUNT a)
 {
     this.id              = a.ACCOUNT_ID;
     this.avail_balance   = a.AVAIL_BALANCE;
     this.close_date      = a.CLOSE_DATE;
     this.last_date       = a.LAST_ACTIVITY_DATE;
     this.open_date       = a.OPEN_DATE;
     this.pending_balance = a.PENDING_BALANCE;
     this.status          = a.STATUS;
     this.branch          = BranchDao.Instance().SelectbyId(a.OPEN_BRANCH_ID).NAME;
     this.employee        = EmployeeDao.Instance().SelectbyId(a.OPEN_EMP_ID);
     this.NameEm          = employee.FIRST_NAME + " " + employee.LAST_NAME;
     this.product         = ProductDao.Instance().SelectbyId(a.PRODUCT_CD).NAME;
     this.customer        = CustomerDao.Instance().SelectbyId(a.CUST_ID);
     if (customer.CUST_TYPE_CD == "I")
     {
         INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(a.CUST_ID);
         if (ind == null)
         {
             this.NameCus = "";
         }
         else
         {
             this.NameCus = ind.FIRST_NAME + " " + ind.LAST_NAME;
         }
     }
     else
     {
         OFFICER off = OfficerDao.Instance().SelectbyCustId(a.CUST_ID);
         if (off == null)
         {
             this.NameCus = "";
         }
         else
         {
             this.NameCus = off.FIRST_NAME + " " + off.LAST_NAME;
         }
     }
 }
示例#11
0
        private void OKevent(Window p)
        {
            BRANCH bra = new BRANCH();

            bra.BRANCH_ID = int.Parse(Branch_id);
            bra.CITY      = City;
            bra.ADDRESS   = Address;
            bra.STATE     = State;
            bra.NAME      = Name;
            bra.ZIP_CODE  = Zip_code;
            if (cv == "insert")
            {
                BranchDao.Instance().Insert(bra);
                vm.BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll());
            }
            else
            {
                BranchDao.Instance().Update(bra);
                vm.BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll());
            }
            p.Close();
        }
示例#12
0
        private void Remove(BRANCH pt)
        {
            BranchDao.Instance().Delete(pt.BRANCH_ID);

            BranchLists.Remove(pt);
        }