Пример #1
0
        //Display Item List
        private void DisplayItemList()
        {
            try
            {
                dtItems = sTGComm.GetItemsWithVendorNumber();

                dgvItemDetails.DataSource = dtItems;
                dgvItemDetails.AutoResizeColumns();
                dgvItemDetails.Refresh();
            } catch (Exception e)
            {
                TextHelper.WriteLine("Item And Vendor details Request failed with error : " + e.Message);
            }
        }
Пример #2
0
        private void SqlDataLoad_Click(object sender, EventArgs e)
        {
            try
            {
                TextHelper.WriteLine("Log Path : " + TextHelper.GetTempPath());

                dataGridGP.DataSource = null;
                dataGridGP.Update();
                dataGridGP.Refresh();


                DataTable daPowerhouse = new DataTable();
                DataTable daGP         = new DataTable();
                DataTable daSTG        = new DataTable();
                DataTable dafinal      = new DataTable();
                DataTable dtItems      = new DataTable();

                daPowerhouse = BuildPHQuery();

                TextHelper.WriteLine("Data received from Powerhouse");

                //Removed 09/20/21. Bringing data in the original Query.
                //var itemIds = daPowerhouse.AsEnumerable().Select(r => r.Field<String>("StrItemId")).ToList();
                //daGP = BuildGPQuery(itemIds);
                //TextHelper.WriteLine("Data received from GP Inventory");

                List <StgOrdersCSV> ListOfObjects = daPowerhouse.DataTableToList <StgOrdersCSV>();
                //Removed 09/20/21. Bringing data in the original Query.
                //ListOfObjects = ListToDT.AddGPDatatoObjects(ListOfObjects, daGP, "Inventory");

                var ordernNumber = daPowerhouse.AsEnumerable().Select(r => r.Field <String>("StrCustOrdNumber")).ToList();
                daGP = BuildGPSalesQuery(ordernNumber);

                TextHelper.WriteLine("Data received from GP Sales ");

                ListOfObjects = ListToDT.AddGPDatatoObjects(ListOfObjects, daGP, "Order");

                //Add Custom Vendor Numbers============================================================

                STGComm sTGComm = new STGComm();
                dtItems = sTGComm.GetItemsWithVendorNumber();

                ListOfObjects = ListToDT.AddSTGVendorNumberDatatoObjects(ListOfObjects, dtItems, "BBBVendorNumber");
                //End adding custom vendor numbres======================================================


                // START DATA FILTERATION PROCESS BASED ON STG DB
                //Get STG data to filter out old waves

                daSTG = GetSTGQuery(ordernNumber);

                TextHelper.WriteLine("Data received from STG");

                LoadDataTable(daSTG, "Shipped");
                //dataGridSTG.Columns.Clear();
                //dataGridSTG.DataSource = daSTG;

                ListOfObjects = ListToDT.FilterDataFromSTG(ListOfObjects, daSTG);

                // END FILTERATION PROCESS
                TextHelper.WriteLine("Final Table Loaded");
                if (ListOfObjects != null && ListOfObjects.Count > 0)
                {
                    dafinal = ListToDT.ToDataTable <StgOrdersCSV>(ListOfObjects);
                    LoadDataTable(dafinal, "Orders For Ship");

                    String            message = "Data Loading Completed. Showing New Wave Found in PowerHouse";
                    String            caption = "Loading Successfull";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, caption, buttons);
                }
                else
                {
                    String            message = "No New Waves found in Powerhouse";
                    String            caption = "Loading Successfull";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, caption, buttons);
                }
            }
            catch (Exception ex)
            {
                String            message = "Error while Getting Data from Powerhouse. Message: " + ex.Message;
                String            caption = "Data Loading Failed";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, caption, buttons);
            }

            //dataGridGP.Columns.Clear();
            //dataGridGP.DataSource = dafinal;
        }