Exemplo n.º 1
0
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataRowView dataRow = (DataRowView)dataGrid1.SelectedItem;
            int         index   = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem);

            if (index >= 0)
            {
                TBikeDAL MyDAL = new TBikeDAL();
                if (LBTitle.Text == "Bicycle")
                {
                    DataTable ResultTable = MyDAL.ShowAllBikeTable();
                    string    BicycleID   = Convert.ToString(ResultTable.Rows[index]["BicycleID"]);

                    if (BicycleID != null)
                    {
                        PopulateID(BicycleID, LBTitle.Text, "Modification");
                    }
                }
                else if (LBTitle.Text == "Snacks")
                {
                    DataTable ResultTable = MyDAL.ShowAllSnackTable();
                    string    SnackID     = Convert.ToString(ResultTable.Rows[index]["SnackID"]);
                    if (SnackID != null)
                    {
                        PopulateID(SnackID, LBTitle.Text, "Modification");
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void PopulateSnackDataTable()
        {
            TBikeDAL MyDAL = new TBikeDAL();

            DataTable ResultTable = MyDAL.ShowAllSnackTable();

            Column1.Header  = "Snack ID";
            Column1.Binding = new Binding("SnackID");
            Column2.Header  = "Snack Name";
            Column2.Binding = new Binding("SnackName");
            Column3.Header  = "Snack Type";
            Column3.Binding = new Binding("SnackType");
            Column4.Header  = "Snack Status";
            Column4.Binding = new Binding("SnackStatusInFull");
            Column5.Header  = "Quantity";
            Column5.Binding = new Binding("Quantity");
            Column6.Header  = "Price";
            Column6.Binding = new Binding("Price");
            Column7.Header  = "CreatedBy";
            Column7.Binding = new Binding("CreatedBy");
            TBIkeUtility.TranslateRecordStatusDescription(new List <string> {
                "SnackStatus"
            }, ref ResultTable);

            dataGrid1.ItemsSource         = ResultTable.DefaultView;
            dataGrid1.AutoGenerateColumns = false;
            dataGrid1.CanUserAddRows      = false;
        }
Exemplo n.º 3
0
        public void PopulateSnackGrd()
        {
            TBikeDAL  MyDAL       = new TBikeDAL();
            DataTable ResultTable = MyDAL.ShowAllSnackTable();

            SdColumn1.Header   = "Snack ID";
            SdColumn1.Binding  = new Binding("SnackID");
            SdColumn2.Header   = "Snack Name";
            SdColumn2.Binding  = new Binding("SnackName");
            SdColumn3.Header   = "Type";
            SdColumn3.Binding  = new Binding("SnackType");
            SdColumn4.Header   = "Status";
            SdColumn4.Binding  = new Binding("SnackStatusInFull");
            SdColumn5.Header   = "Quantity";
            SdColumn5.Binding  = new Binding("Quantity");
            SdColumn6.Header   = "Price";
            SdColumn6.Binding  = new Binding("Price");
            SdColumn7.Header   = "Created By";
            SdColumn7.Binding  = new Binding("CreatedBy");
            SdColumn8.Header   = "Created At";
            SdColumn8.Binding  = new Binding("CreatedAt");
            SdColumn9.Header   = "Last Updated By";
            SdColumn9.Binding  = new Binding("LastUpdatedBy");
            SdColumn10.Header  = "Last Updated At";
            SdColumn10.Binding = new Binding("LastUpdatedAt");
            TBIkeUtility.TranslateRecordStatusDescription(new List <string> {
                "SnackStatus"
            }, ref ResultTable);

            SnackGrd.ItemsSource         = ResultTable.DefaultView;
            SnackGrd.AutoGenerateColumns = false;
        }
Exemplo n.º 4
0
        public void LinkToSnackWindow()
        {
            TBikeDAL  MyDAL       = new TBikeDAL();
            int       index       = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem);
            DataTable ResultTable = MyDAL.ShowAllSnackTable();

            if (index == -1)
            {
                index = 0;
            }
            else
            {
                string        SnackID = Convert.ToString(ResultTable.Rows[index]["SnackID"]);
                string        Status  = Convert.ToString(ResultTable.Rows[index]["SnackStatus"]);
                InventoryModi modi    = new InventoryModi();
                modi.PopulateDataFromLogin(username);
                modi.PopulateID(SnackID, "Snacks", "Modification");
                modi.ShowDialog();
            }
        }
Exemplo n.º 5
0
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataRowView dataRow = (DataRowView)dataGrid1.SelectedItem;
            int         index   = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem);

            if (index == -1)
            {
                index    = 0;
                Category = "";
            }
            TBikeDAL MyDAL = new TBikeDAL();

            if (Category == "Bicycle")
            {
                DataTable ResultTable = MyDAL.ShowAllBikeTable();
                string    BicycleID   = Convert.ToString(ResultTable.Rows[index]["BicycleID"]);

                if (BicycleID != null)
                {
                    InventoryModi mod = new InventoryModi();
                    mod.Show();
                    mod.PopulateDataFromLogin(username);
                    mod.PopulateID(BicycleID, Category, "Modification");
                    this.Close();
                }
            }
            else if (Category == "Snacks")
            {
                DataTable ResultTable = MyDAL.ShowAllSnackTable();
                string    SnackID     = Convert.ToString(ResultTable.Rows[index]["SnackID"]);
                if (SnackID != null)
                {
                    InventoryModi mod = new InventoryModi();
                    mod.Show();
                    mod.PopulateDataFromLogin(username);
                    mod.PopulateID(SnackID, Category, "Modification");
                    this.Close();
                }
            }
        }
Exemplo n.º 6
0
        private void SnackGrd_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TBikeDAL  MyDAL      = new TBikeDAL();
            int       index      = SnackGrd.Items.IndexOf(SnackGrd.CurrentItem);
            DataTable SnackTable = MyDAL.ShowAllSnackTable();

            if (index == -1)
            {
                index = 0;
            }
            else
            {
                string    SnackID     = Convert.ToString(SnackTable.Rows[index]["SnackID"]).Trim();
                DataTable ResultTable = MyDAL.SelectSnackSalesBySnackID(SnackID);

                TBSnackID.Text = "Sales Details for: " + Convert.ToString(SnackTable.Rows[index]["SnackName"]).Trim();

                SColumn1.Header                    = "Sales ID";
                SColumn1.Binding                   = new Binding("SalesID");
                SColumn2.Header                    = "Booking ID";
                SColumn2.Binding                   = new Binding("BookingID");
                SColumn3.Header                    = "Snack ID";
                SColumn3.Binding                   = new Binding("SnackID");
                SColumn4.Header                    = "Quantity";
                SColumn4.Binding                   = new Binding("Quantity");
                SColumn5.Header                    = "Customer";
                SColumn5.Binding                   = new Binding("Customer");
                SColumn6.Header                    = "Total Price";
                SColumn6.Binding                   = new Binding("TotalPrice");
                SColumn7.Header                    = "Created By";
                SColumn7.Binding                   = new Binding("CreatedBy");
                SColumn8.Header                    = "Created At";
                SColumn8.Binding                   = new Binding("CreatedAt");
                detailSnackGrd.ItemsSource         = ResultTable.DefaultView;
                detailSnackGrd.AutoGenerateColumns = false;
            }
        }