Example #1
0
 public MainWindow()
 {
     InitializeComponent();
     GettingSettings.SettingValuesFromConfig();
     if (GettingSettings._sServer != null && GettingSettings._sServer != "")
     {
         try
         {
             string sqlConn = DatabaseProcedure.BuildingConnectionString();
             if (sqlConn != "")
             {
                 DatabaseProcedure.BuildingDatabase(sqlConn);
                 DatabaseProcedure.BuildingTable(sqlConn);
                 DatabaseProcedure.BuildingColumns(sqlConn);
             }
         }
         catch (Exception ex)
         { MessageBox.Show(ex.Message.ToString()); }
     }
     dgComponent.CanUserAddRows = false;
     dataGrid.CanUserAddRows    = false;
     dtShipDate.Text            = DateTime.Now.ToString();
     AddingItemsToDropDownList();
     AddingComponentsToGrid();
     FillingMainDataGrid(false);
     //StartingTimertoRefresh();
 }
Example #2
0
        private void bttnAddComponent_Click(object sender, RoutedEventArgs e)
        {
            Window2 AddDevice = new Window2();

            AddDevice.ShowDialog();
            DatabaseProcedure.BuildingColumns(DatabaseProcedure.BuildingConnectionString());
            AddingComponentsToGrid();
            FillingMainDataGrid(true);
        }
Example #3
0
 private void bttnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show(string.Format("This will delete LogID: {0} for Company: {1}?", iLogID, sCompany), "Delete Shipment Log", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         DatabaseProcedure.DeletingFromLog(iLogID);
         FillingMainDataGrid(true);
     }
     else
     {
         //No Stuff
     }
 }
Example #4
0
 private void bttnSave_Click(object sender, RoutedEventArgs e)
 {
     dtShipDate.Text = DateTime.Now.ToString();
     DatabaseProcedure.InsertingIntoDB(InsertQuery());
     MyCollection           = null;
     txtCompany.Text        = "";
     cbShippingCompany.Text = "";
     chckbRepair.IsChecked  = false;
     txtCost.Text           = "0";
     AddingComponentsToGrid();
     FillingMainDataGrid(true);
 }
Example #5
0
 private void InsertingDevice()
 {
     if (txtDevice.Text.ToString() != "" && txtDevice.Text.ToString() != null)
     {
         DatabaseProcedure.InsertingIntoComponents(txtDevice.Text.ToString().Replace(" ", "_"));
         this.Close();
     }
     else
     {
         this.Close();
     }
 }
Example #6
0
 private void FillingMainDataGrid(bool pRefresh)
 {
     try
     {
         DataTable dtInfo = new DataTable();
         string    sQuery = DatabaseProcedure.OrderingColumns();
         dtInfo = DatabaseProcedure.GettingInfoFromDatabase(sQuery);
         dataGrid.ItemsSource = dtInfo.DefaultView;
     }
     catch (Exception ex)
     {
         // MessageBox.Show(ex.Message.ToString());
     }
 }
        private static void FillingOutList()
        {
            List <ComponentsList> items = new List <ComponentsList>();

            try
            {
                DataTable dtComponents = DatabaseProcedure.GettingInfoFromDatabase("SELECT Components FROM Components ORDER BY Components;");
                foreach (DataRow row in dtComponents.Rows)
                {
                    items.Add(new ComponentsList()
                    {
                        sComponent = row["Components"].ToString().Replace("_", " "), iQuantity = 0
                    });
                }
                MyCollectionList = items;
            }
            catch { }
        }
Example #8
0
        public void AddingComponentsToGrid()
        {
            MyCollection = null;
            List <ComponentsList> items = new List <ComponentsList>();

            try
            {
                DataTable dtComponents = DatabaseProcedure.GettingInfoFromDatabase("SELECT Components FROM Components ORDER BY Components;");
                foreach (DataRow row in dtComponents.Rows)
                {
                    items.Add(new ComponentsList()
                    {
                        sComponent = row["Components"].ToString().Replace("_", " "), iQuantity = 0
                    });
                }
                MyCollectionList = items;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
            MyCollection = new ObservableCollection <ComponentsList>(MyCollectionList);

            dgComponent.ItemsSource = MyCollection;
        }