private void comboBoxCN_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }
            DataRowView rov = (DataRowView)e.AddedItems[0];

            DBManager.servername = comboBoxCN.SelectedValue.ToString();

            if (comboBoxCN.SelectedIndex != DBManager.mChinhanh)
            {
                DBManager.mlogin   = DBManager.remotelogin;
                DBManager.password = DBManager.remotepassword;
            }
            else
            {
                DBManager.mlogin   = DBManager.mloginDN;
                DBManager.password = DBManager.passwordDN;
            }

            if (DBManager.Connect() == 0)
            {
                MessageBox.Show("Lỗi kết nối về chi nhánh mới");
            }
            else
            {
                qLVTDataSet1NHANVIENTableAdapter.Connection.ConnectionString = DBManager.connstr;
                qLVTDataSet1NHANVIENTableAdapter.Fill(qLVTDataSet1.NHANVIEN);
                System.Windows.Data.CollectionViewSource nHANVIENViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("nHANVIENViewSource")));
                nHANVIENViewSource.View.MoveCurrentToFirst();
            }
        }
 private void NhanVienWidow_Loaded(object sender, RoutedEventArgs e)
 {
     qLVTDataSet1 = ((QLVT.QLVTDataSet1)(this.FindResource("qLVTDataSet1")));
     // Load data into the table NHANVIEN. You can modify this code as needed.
     qLVTDataSet1NHANVIENTableAdapter = new QLVT.QLVTDataSet1TableAdapters.NHANVIENTableAdapter();
     qLVTDataSet1NHANVIENTableAdapter.Connection.ConnectionString = DBManager.connstr;
     qLVTDataSet1NHANVIENTableAdapter.Fill(qLVTDataSet1.NHANVIEN);
     System.Windows.Data.CollectionViewSource nHANVIENViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("nHANVIENViewSource")));
     nHANVIENViewSource.View.MoveCurrentToFirst();
 }
Beispiel #3
0
        private void PhieuNhapXuat_Loaded(object sender, RoutedEventArgs e)
        {
            qLVTDataSet1 = ((QLVT.QLVTDataSet1)(this.FindResource("qLVTDataSet1")));
            // Load data into the table NHANVIEN. You can modify this code as needed.
            qLVTDataSet1NHANVIENTableAdapter = new QLVT.QLVTDataSet1TableAdapters.NHANVIENTableAdapter();
            qLVTDataSet1NHANVIENTableAdapter.Connection.ConnectionString = DBManager.connstr;
            qLVTDataSet1NHANVIENTableAdapter.Fill(qLVTDataSet1.NHANVIEN);
            System.Windows.Data.CollectionViewSource nHANVIENViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("nHANVIENViewSource")));
            nHANVIENViewSource.View.MoveCurrentToFirst();
            // Load data into the table VATTU. You can modify this code as needed.
            qLVTDataSet1VATTUTableAdapter = new QLVT.QLVTDataSet1TableAdapters.VATTUTableAdapter();
            qLVTDataSet1VATTUTableAdapter.Connection.ConnectionString = DBManager.connstr;
            qLVTDataSet1VATTUTableAdapter.Fill(qLVTDataSet1.VATTU);
            System.Windows.Data.CollectionViewSource vATTUViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("vATTUViewSource")));
            vATTUViewSource.View.MoveCurrentToFirst();
            // Load data into the table KHO. You can modify this code as needed.
            qLVTDataSet1KHOTableAdapter = new QLVT.QLVTDataSet1TableAdapters.KHOTableAdapter();
            qLVTDataSet1KHOTableAdapter.Connection.ConnectionString = DBManager.connstr;
            qLVTDataSet1KHOTableAdapter.Fill(qLVTDataSet1.KHO);
            System.Windows.Data.CollectionViewSource kHOViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("kHOViewSource")));
            kHOViewSource.View.MoveCurrentToFirst();

            DataTable datatable1 = new DataTable();

            datatable1.Columns.Add("ID", typeof(string));
            datatable1.Columns.Add("VALUE", typeof(string));

            datatable1.Rows.Add(new string[] { "N", "N" });
            datatable1.Rows.Add(new string[] { "X", "X" });

            comboBoxPHIEU.ItemsSource       = datatable1.DefaultView;
            comboBoxPHIEU.DisplayMemberPath = "ID";
            comboBoxPHIEU.SelectedValuePath = "VALUE";
            //

            comboBoxMAVT.DisplayMemberPath = "TENVT";
            comboBoxMAVT.SelectedValuePath = "MAVT";

            comboBoxMAKHO.DisplayMemberPath = "TENKHO";
            comboBoxMAKHO.SelectedValuePath = "MAKHO";

            comboBoxMANV.DisplayMemberPath = "MANV";
            comboBoxMANV.SelectedValuePath = "MANV";

            comboBoxMANV.SelectedValue = DBManager.username;
            comboBoxMANV.IsEnabled     = false;
        }