private void cboSelectLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intAssetID;
            string strAssetDescription;
            string strSerialNumber;
            string strAssetType;
            string strBJCNumber;
            string strFirstName;
            string strLastName;
            bool   blnFatalError = false;
            bool   blnItemFound;
            int    intTransactionID;
            int    intSelectedIndex;
            int    intEmployeeID;

            try
            {
                intSelectedIndex = cboSelectLocation.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheEmployeeToolAssetDataSet.employeetoolassets.Rows.Clear();

                    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                    dlg.FileName   = "Document";             // Default file name
                    dlg.DefaultExt = ".xlsx";                // Default file extension
                    dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                    // Show open file dialog box
                    Nullable <bool> result = dlg.ShowDialog();

                    // Process open file dialog box results
                    if (result == true)
                    {
                        // Open document
                        string filename = dlg.FileName;
                    }

                    PleaseWait PleaseWait = new PleaseWait();
                    PleaseWait.Show();


                    gstrLocation = TheFindSortedWaspAssetLocationsBySiteDataSet.FindSortedWaspAssetLoctionsBySite[intSelectedIndex].AssetLocation;

                    xlDropOrder = new Excel.Application();
                    xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                    xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                    range = xlDropSheet.UsedRange;
                    intNumberOfRecords = range.Rows.Count;
                    intColumnRange     = range.Columns.Count;

                    for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        TheWaspAssetIDDataSet = TheAssetClass.GetWaspAssetIDInfo();

                        intAssetID       = TheWaspAssetIDDataSet.waspassetid[0].CreatedAssetID;
                        intTransactionID = TheWaspAssetIDDataSet.waspassetid[0].TransactionID;

                        blnFatalError = TheAssetClass.UpdateWaspAssetID(intTransactionID, intAssetID + 1);

                        blnItemFound = false;
                        strAssetType = "UNKNOWN";

                        if (((range.Cells[intCounter, 1] as Excel.Range).Value2) == null)
                        {
                            intCounter = intNumberOfRecords;
                            break;
                        }
                        else
                        {
                            strAssetDescription = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();

                            if (((range.Cells[intCounter, 2] as Excel.Range).Value2) == null)
                            {
                                strBJCNumber = " ";
                            }
                            else
                            {
                                strBJCNumber = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                            }
                            if (((range.Cells[intCounter, 5] as Excel.Range).Value2) == null)
                            {
                                strSerialNumber = " ";
                            }
                            else
                            {
                                strSerialNumber = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                            }
                            if (((range.Cells[intCounter, 4] as Excel.Range).Value2) == null)
                            {
                                strAssetType = " ";
                            }
                            else
                            {
                                strAssetType = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                            }

                            strFirstName = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();
                            strLastName  = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();

                            if (strSerialNumber.Length > 2)
                            {
                                TheFindWaspAssetBySerialNumberDataSet = TheAssetClass.FindWaspAssetsBySerialNumber(strSerialNumber);

                                intRecordsReturned = TheFindWaspAssetBySerialNumberDataSet.FindWaspAssetsBySerialNumber.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    blnItemFound = true;
                                }
                            }
                            if (strBJCNumber.Length > 2)
                            {
                                TheFindWaspAssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(strBJCNumber);

                                intRecordsReturned = TheFindWaspAssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    blnItemFound = true;
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            if (strBJCNumber.Length > 2)
                            {
                                TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(strBJCNumber);

                                intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strAssetType        = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCategory;
                                    strAssetDescription = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                                }
                            }
                        }

                        TheComboEmployeeDataSet = TheEmployeeClass.FillEmployeeComboBox(strLastName);

                        EmployeeToolAssetDataSet.employeetoolassetsRow NewToolRow = TheEmployeeToolAssetDataSet.employeetoolassets.NewemployeetoolassetsRow();

                        NewToolRow.AssetID         = intAssetID;
                        NewToolRow.BJCAssetID      = strBJCNumber;
                        NewToolRow.EmployeeID      = TheComboEmployeeDataSet.employees[0].EmployeeID;
                        NewToolRow.FirstName       = strFirstName;
                        NewToolRow.LastName        = strLastName;
                        NewToolRow.Office          = gstrSite;
                        NewToolRow.ToolLocation    = gstrLocation;
                        NewToolRow.ToolCategory    = strAssetType;
                        NewToolRow.ToolDescription = strAssetDescription;

                        TheEmployeeToolAssetDataSet.employeetoolassets.Rows.Add(NewToolRow);
                    }

                    xlDropOrder.Quit();
                    PleaseWait.Close();
                }


                dgrAssets.ItemsSource = TheEmployeeToolAssetDataSet.employeetoolassets;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Vehicle Assets // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public void UpdateInventoryTables()
        {
            int    intWIPCounter;
            int    intWIPNumberOfRecords;
            int    intArrayCounter;
            int    intPartID;
            int    intQuantity;
            int    intWarehouseID;
            int    intProjectID;
            int    intEmployeeID;
            string strPONumber;
            string strTransactionType;
            int    intEnterEmployeeID;
            bool   blnFatalError;

            string[] strTransactionTypeArray = new string[3];

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                //getting the data
                MainWindow.TheFindWIPBySessionIDDataSet = TheInventoryWIPClass.FindWIPBySessionID(MainWindow.gintSessionID);
                strTransactionTypeArray[0] = "RECEIVE";
                strTransactionTypeArray[1] = "ISSUE";
                strTransactionTypeArray[2] = "BOM";

                intWIPNumberOfRecords = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID.Rows.Count - 1;

                if (intWIPNumberOfRecords > -1)
                {
                    for (intArrayCounter = 0; intArrayCounter <= 2; intArrayCounter++)
                    {
                        for (intWIPCounter = 0; intWIPCounter <= intWIPNumberOfRecords; intWIPCounter++)
                        {
                            blnFatalError      = false;
                            intPartID          = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].PartID;
                            intQuantity        = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].Quantity;
                            intWarehouseID     = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].WarehouseID;
                            intProjectID       = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].ProjectID;
                            intEmployeeID      = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].EmployeeID;
                            intEnterEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                            strPONumber        = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].PONumber;
                            strTransactionType = MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].TransactionType;

                            if (strTransactionTypeArray[intArrayCounter] == MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].TransactionType)
                            {
                                if (MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].TransactionType == "RECEIVE")
                                {
                                    blnFatalError = UpdateCharterWarehouseInfo(intPartID, intWarehouseID, intQuantity);
                                    if (blnFatalError == false)
                                    {
                                        blnFatalError = UpdateInventoryInfo(intPartID, intWarehouseID, intQuantity);
                                    }
                                    if (blnFatalError == false)
                                    {
                                        blnFatalError = TheReceivePartsClass.InsertReceivedPart(intProjectID, intPartID, intQuantity, intEnterEmployeeID, strPONumber, intWarehouseID);
                                    }

                                    if (blnFatalError == true)
                                    {
                                        TheMessagesClass.ErrorMessage("There Has Been A Problem, Contact IT");
                                    }
                                }
                                else if (MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].TransactionType == "ISSUE")
                                {
                                    blnFatalError = TheIssuedPartsClass.InsertIssuedParts(intProjectID, intPartID, intQuantity, intEmployeeID, intEnterEmployeeID, intWarehouseID);

                                    intQuantity = intQuantity * -1;

                                    if (blnFatalError == false)
                                    {
                                        blnFatalError = UpdateInventoryInfo(intPartID, intWarehouseID, intQuantity);
                                    }

                                    if (blnFatalError == true)
                                    {
                                        TheMessagesClass.ErrorMessage("There Has Been A Problem, Contact IT");
                                    }
                                }
                                else if (MainWindow.TheFindWIPBySessionIDDataSet.FindWIPBySessionID[intWIPCounter].TransactionType == "BOM")
                                {
                                    blnFatalError = TheBOMPartsClass.InsertBOMParts(intProjectID, intPartID, intQuantity, intEnterEmployeeID, intWarehouseID);

                                    intQuantity = intQuantity * -1;


                                    if (blnFatalError == false)
                                    {
                                        blnFatalError = UpdateCharterWarehouseInfo(intPartID, intWarehouseID, intQuantity);
                                    }

                                    if (blnFatalError == true)
                                    {
                                        TheMessagesClass.ErrorMessage("There Has Been A Problem, Contact IT");
                                    }
                                }
                            }
                        }
                    }


                    TheInventoryWIPClass.RemoveSessionEntriesFromWIP(MainWindow.gintSessionID);

                    TheInventoryWIPClass.RemoveSession(MainWindow.gintSessionID);

                    TheInventoryWIPClass.InsertNewSession(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID);

                    MainWindow.TheFindSessionByEmployeeIDDataSet = TheInventoryWIPClass.FindSessionByEmployeeID(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID);

                    MainWindow.gintSessionID = MainWindow.TheFindSessionByEmployeeIDDataSet.FindSessionByEmployeeID[0].SessionID;

                    TheMessagesClass.InformationMessage("Batch Processing Complete.  You Are Beginning a New Session");
                }
                else
                {
                    TheMessagesClass.InformationMessage("There Are No Records To Process");
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP \\ Process Patch Class \\ Update Tables " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }

            PleaseWait.Close();
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            string   strIsInside;
            string   strDriver;
            string   strVehicleNumber;
            string   strEventDate;
            double   douEventDate;
            DateTime datEventDate;
            bool     blnIsInSide = false;
            int      intVehicleCounter;
            int      intVehicleNumberOfRecords;
            int      intEmployeeCounter;
            int      intEmployeeNumberOfRecords;
            string   strAssignedOffice = "";
            int      intSubstringLength;
            string   strFullName;
            int      intVehicleID = 0;
            DateTime datStartDate = DateTime.Now;
            DateTime datEndDate   = DateTime.Now;

            try
            {
                TheImportGEOFenceDataSet.importgeofence.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 5; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strEventDate     = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strIsInside      = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();
                    strDriver        = Convert.ToString((range.Cells[intCounter, 10] as Excel.Range).Value2).ToUpper();
                    strVehicleNumber = Convert.ToString((range.Cells[intCounter, 11] as Excel.Range).Value2).ToUpper();

                    douEventDate = Convert.ToDouble(strEventDate);
                    datEventDate = DateTime.FromOADate(douEventDate);

                    if (strIsInside == "YES")
                    {
                        blnIsInSide = true;
                    }
                    else
                    {
                        blnIsInSide = false;
                    }

                    ImportGEOFencedDataSet.importgeofenceRow NewGEOFenceTransaction = TheImportGEOFenceDataSet.importgeofence.NewimportgeofenceRow();

                    NewGEOFenceTransaction.Driver        = strDriver;
                    NewGEOFenceTransaction.EmployeeID    = -1;
                    NewGEOFenceTransaction.EventTime     = datEventDate;
                    NewGEOFenceTransaction.VehicleID     = -1;
                    NewGEOFenceTransaction.VehicleNumber = strVehicleNumber;
                    NewGEOFenceTransaction.InSide        = blnIsInSide;

                    TheImportGEOFenceDataSet.importgeofence.Rows.Add(NewGEOFenceTransaction);
                }

                dgrResults.ItemsSource = TheImportGEOFenceDataSet.importgeofence;

                TheMessagesClass.InformationMessage("Click OK to Continue");

                intNumberOfRecords        = TheImportGEOFenceDataSet.importgeofence.Rows.Count - 1;
                intVehicleNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    for (intVehicleCounter = 0; intVehicleCounter <= intVehicleNumberOfRecords; intVehicleCounter++)
                    {
                        strVehicleNumber = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].VehicleNumber;

                        if (TheImportGEOFenceDataSet.importgeofence[intCounter].VehicleNumber.Contains(strVehicleNumber) == true)
                        {
                            TheImportGEOFenceDataSet.importgeofence[intCounter].VehicleID     = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].VehicleID;
                            TheImportGEOFenceDataSet.importgeofence[intCounter].VehicleNumber = strVehicleNumber;
                            strAssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].AssignedOffice;
                            intVehicleID      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].VehicleID;
                            datStartDate      = TheDateSearchClass.RemoveTime(TheImportGEOFenceDataSet.importgeofence[intCounter].EventTime);
                            datEndDate        = TheDateSearchClass.AddingDays(datStartDate, 1);
                        }
                    }

                    strDriver = TheImportGEOFenceDataSet.importgeofence[intCounter].Driver;

                    if (strDriver == "NO DRIVER CHECKED IN")
                    {
                        intEmployeeNumberOfRecords = TheFindWarehouseDataSet.FindWarehouses.Rows.Count - 1;

                        for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            if (strAssignedOffice == TheFindWarehouseDataSet.FindWarehouses[intEmployeeCounter].FirstName)
                            {
                                TheImportGEOFenceDataSet.importgeofence[intCounter].EmployeeID = TheFindWarehouseDataSet.FindWarehouses[intEmployeeCounter].EmployeeID;
                            }
                        }
                    }
                    else
                    {
                        TheFindEmployeeByLastDataSet = TheEmployeeClass.FindEmployeesByLastNameKeyWord(strDriver);

                        intEmployeeNumberOfRecords = TheFindEmployeeByLastDataSet.FindEmployeeByLastName.Rows.Count - 1;

                        if (intEmployeeNumberOfRecords == 0)
                        {
                            TheImportGEOFenceDataSet.importgeofence[intCounter].EmployeeID = TheFindEmployeeByLastDataSet.FindEmployeeByLastName[0].EmployeeID;
                        }
                        else
                        {
                            TheFindDailyVehicleInspectionByVehicleIDandDateRangeDataSet = TheInspectionsClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                            intEmployeeNumberOfRecords = TheFindDailyVehicleInspectionByVehicleIDandDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count;

                            if (intEmployeeNumberOfRecords > 0)
                            {
                                TheImportGEOFenceDataSet.importgeofence[intCounter].EmployeeID = TheFindDailyVehicleInspectionByVehicleIDandDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[0].EmployeeID;
                            }
                            else
                            {
                                intEmployeeNumberOfRecords = TheFindWarehouseDataSet.FindWarehouses.Rows.Count - 1;

                                for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                                {
                                    if (strAssignedOffice == TheFindWarehouseDataSet.FindWarehouses[intEmployeeCounter].FirstName)
                                    {
                                        TheImportGEOFenceDataSet.importgeofence[intCounter].EmployeeID = TheFindWarehouseDataSet.FindWarehouses[intEmployeeCounter].EmployeeID;
                                    }
                                }
                            }
                        }
                    }
                }

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import GEO Fence Report // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 4
0
        private void expProcessData_Expanded(object sender, RoutedEventArgs e)
        {
            int      intNumberOfRecords;
            int      intCounter;
            int      intPayID;
            int      intEmployeeID;
            DateTime datActualDateTime;
            DateTime datPunchDateTime;
            DateTime datCreatedDateTime;
            string   strPayGroup;
            string   strPunchMode;
            string   strPunchType;
            string   strPunchUser;
            string   strPunchIPAddress;
            DateTime datLastUpdate;
            bool     blnFatalError = false;
            int      intRecordsReturned;
            string   strPunchSource;

            try
            {
                expProcessData.IsExpanded = false;
                intNumberOfRecords        = TheImportAholaPunchesDataSet.importaholapunches.Rows.Count;

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intPayID           = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PayID;
                        intEmployeeID      = TheImportAholaPunchesDataSet.importaholapunches[intCounter].EmployeeID;
                        datActualDateTime  = TheImportAholaPunchesDataSet.importaholapunches[intCounter].ActualDateTime;
                        datPunchDateTime   = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchDateTime;
                        datCreatedDateTime = TheImportAholaPunchesDataSet.importaholapunches[intCounter].CreatedDateTime;
                        strPayGroup        = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PayGroup;
                        strPunchMode       = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchMode;
                        strPunchType       = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchType;
                        strPunchSource     = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchSource;
                        strPunchUser       = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchUser;
                        strPunchIPAddress  = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchIPAddress;
                        datLastUpdate      = TheImportAholaPunchesDataSet.importaholapunches[intCounter].LastUpdate;

                        TheFindAholaClockPunchesForVerificationDataSet = TheEmployeePunchedHoursClass.FindAholaClockPunchesForVerification(intPayID, datActualDateTime, datPunchDateTime, datCreatedDateTime, strPunchIPAddress);

                        intRecordsReturned = TheFindAholaClockPunchesForVerificationDataSet.FindAholaClockPunchesForVerification.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            blnFatalError = TheEmployeePunchedHoursClass.InsertAholaClockPunches(intEmployeeID, intPayID, datActualDateTime, datPunchDateTime, datCreatedDateTime, strPayGroup, strPunchMode, strPunchType, strPunchSource, strPunchUser, strPunchIPAddress, datLastUpdate);

                            if (blnFatalError == true)
                            {
                                throw new Exception();
                            }
                        }
                    }
                }

                PleaseWait.Close();
                TheMessagesClass.InformationMessage("All Records Have Been Inserted");

                expCalculateHours.IsEnabled = true;
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Import Employee Punches // Process Data Expander " + Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Employee Punches // Process Data Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 5
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strAssetLocation;
            string strAssetSite;
            string strSiteDescription;
            int    intRecordsReturned;

            try
            {
                expImportExcel.IsExpanded = false;
                TheImportWaspAssetLocationsDataSet.waspassetlocations.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strAssetLocation   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strAssetSite       = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strSiteDescription = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();

                    TheFindWaspAssetLocationByLocationDataSet = TheAssetClass.FindWaspAssetLocationByLocation(strAssetLocation);

                    intRecordsReturned = TheFindWaspAssetLocationByLocationDataSet.FindWaspAssetLocationByLocation.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        ImportWaspAssetLocationsDataSet.waspassetlocationsRow NewLocationRow = TheImportWaspAssetLocationsDataSet.waspassetlocations.NewwaspassetlocationsRow();

                        NewLocationRow.AssetLocation   = strAssetLocation;
                        NewLocationRow.AssetSite       = strAssetSite;
                        NewLocationRow.SiteDescription = strSiteDescription;

                        TheImportWaspAssetLocationsDataSet.waspassetlocations.Rows.Add(NewLocationRow);
                    }
                }


                PleaseWait.Close();
                dgrAssetLocations.ItemsSource = TheImportWaspAssetLocationsDataSet.waspassetlocations;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Wasp Asset Locations // Import Excel Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int     intColumnRange = 0;
            int     intCounter;
            int     intNumberOfRecords;
            string  strValueForValidation;
            int     intAssetTag;
            string  strAssetDescription;
            string  strSerialNumber;
            string  strCategoryName;
            decimal decAssetCost = 0;
            bool    blnNotNumeric;
            int     intQuantity = 0;
            int     intAssetCounter;
            bool    blnItemFound;
            string  strLocation = "";
            int     intCharacterIndex;

            try
            {
                expImportExcel.IsExpanded = false;
                TheAssetsForReportingDataSet.assetsforreport.Rows.Clear();
                TheAssetCategoryCostDataSet.assetcategorycost.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords       = range.Rows.Count;
                intColumnRange           = range.Columns.Count;
                gintAssetNumberOfRecords = 0;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2);

                    if (strValueForValidation != null)
                    {
                        blnNotNumeric = TheDataValidationClass.VerifyIntegerData(strValueForValidation);

                        if (blnNotNumeric == false)
                        {
                            blnItemFound        = false;
                            intAssetTag         = Convert.ToInt32(strValueForValidation);
                            strAssetDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);
                            strSerialNumber     = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2);
                            if (strSerialNumber == null)
                            {
                                strSerialNumber = "";
                            }
                            strCategoryName = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2);
                            if (strCategoryName == null)
                            {
                                strCategoryName = "UNKNOWN";
                            }
                            strValueForValidation = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2);
                            blnNotNumeric         = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                            if (blnNotNumeric == false)
                            {
                                decAssetCost = Convert.ToDecimal(strValueForValidation);
                            }
                            else
                            {
                                decAssetCost = 0;
                            }
                            strValueForValidation = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2);
                            blnNotNumeric         = TheDataValidationClass.VerifyIntegerRange(strValueForValidation);
                            if (blnNotNumeric == false)
                            {
                                intQuantity = Convert.ToInt32(strValueForValidation);
                            }
                            else
                            {
                                intQuantity = 0;
                            }

                            AssetsForReportDataSet.assetsforreportRow NewAssetRow = TheAssetsForReportingDataSet.assetsforreport.NewassetsforreportRow();

                            NewAssetRow.AssetCategory   = strCategoryName;
                            NewAssetRow.AssetCost       = decAssetCost;
                            NewAssetRow.AssetDecription = strAssetDescription;
                            NewAssetRow.AssetTag        = intAssetTag;
                            NewAssetRow.SerialNumber    = strSerialNumber;
                            NewAssetRow.Quantity        = intQuantity;
                            NewAssetRow.Location        = strLocation;

                            TheAssetsForReportingDataSet.assetsforreport.Rows.Add(NewAssetRow);

                            if (gintAssetNumberOfRecords > 0)
                            {
                                for (intAssetCounter = 0; intAssetCounter < gintAssetNumberOfRecords; intAssetCounter++)
                                {
                                    if (strCategoryName == TheAssetCategoryCostDataSet.assetcategorycost[intAssetCounter].AssetCategory)
                                    {
                                        TheAssetCategoryCostDataSet.assetcategorycost[intAssetCounter].CategoryCosts += decAssetCost;
                                        blnItemFound = true;
                                    }
                                }
                            }

                            if (blnItemFound == false)
                            {
                                AssetCategoryCostDataSet.assetcategorycostRow NewCategoryCost = TheAssetCategoryCostDataSet.assetcategorycost.NewassetcategorycostRow();

                                NewCategoryCost.AssetCategory = strCategoryName;
                                NewCategoryCost.CategoryCosts = decAssetCost;

                                TheAssetCategoryCostDataSet.assetcategorycost.Rows.Add(NewCategoryCost);
                                gintAssetNumberOfRecords++;
                            }
                        }
                        else if (strValueForValidation.Contains("Location"))
                        {
                            if (strValueForValidation.Contains("Location Prefix") == false)
                            {
                                strLocation = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2);

                                if (strLocation != null)
                                {
                                    intCharacterIndex = strLocation.IndexOf(':');

                                    strLocation = strLocation.Substring(0, intCharacterIndex);
                                }
                            }
                        }
                    }
                }

                PleaseWait.Close();
                dgrAssets.ItemsSource = TheAssetsForReportingDataSet.assetsforreport;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Prepare Asset Report // Import Excel Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expEmailReport_Expanded(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int      intCounter;
            int      intNumberOfRecords;
            string   strEmailAddress = "*****@*****.**";
            string   strHeader;
            string   strMessage;
            DateTime datPayDate    = DateTime.Now;
            bool     blnFatalError = false;

            try
            {
                expEmailReport.IsExpanded = false;
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                intNumberOfRecords = TheEventLogSecurityDataSet.eventlogsecurity.Rows.Count;

                strHeader = "Server File Access Report Prepared on " + Convert.ToString(datPayDate);

                strMessage  = "<h1>Server File Access Report Prepared on " + Convert.ToString(datPayDate) + "</h1>";
                strMessage += "<p>               </p>";
                strMessage += "<p>               </p>";
                strMessage += "<table>";
                strMessage += "<tr>";
                strMessage += "<td><b>Transaction Date</b></td>";
                strMessage += "<td><b>Logon Name</b></td>";
                strMessage += "<td><b>Item Accessed</b></td>";
                strMessage += "</tr>";
                strMessage += "<p>               </p>";

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        strMessage += "<tr>";
                        strMessage += "<td>" + Convert.ToString(TheEventLogSecurityDataSet.eventlogsecurity[intCounter].TransactionDate) + "</td>";
                        strMessage += "<td>" + TheEventLogSecurityDataSet.eventlogsecurity[intCounter].LogonName + "</td>";
                        strMessage += "<td>" + TheEventLogSecurityDataSet.eventlogsecurity[intCounter].ItemAccessed + "</td>";
                        strMessage += "</tr>";
                        strMessage += "<p>               </p>";
                    }
                }

                strMessage += "</table>";

                blnFatalError = !(TheSendEmailClass.SendEmail(strEmailAddress, strHeader, strMessage));

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Email Server Report // Email Report Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void UpdateGrid()
        {
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            int      intWorkTaskID;
            decimal  decTotalCount;
            decimal  decTaskCount = 0;
            decimal  decPercentage;
            int      intGreaterThan;
            int      intRecordsReturned;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheProductionTasksForSheetsDataSet.productiontasks.Rows.Clear();

                datTransactionDate = DateTime.Now;

                datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 90);

                TheFindWorkTaskIDTotalCountByDateDataSet = TheWorkTaskClass.FindWorkTaskIDTotalCountByDate(datTransactionDate);

                TheFindWorkTaskDepartmentByLOBDepartmentDataSet = TheWorkTaskClass.FindWorkTaskDepartmentByLOBDepartment(gintBusinessLineID, gintDepartmentID);

                decTotalCount = Convert.ToDecimal(TheFindWorkTaskIDTotalCountByDateDataSet.FindWorkTaskIDTotalCountByDate[0].TotalCount);

                intNumberOfRecords = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intWorkTaskID = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment[intCounter].WorkTaskID;

                        TheFindWorkTaskUsageByDateTaskDataSet = TheWorkTaskClass.FindWorkTaskUsageByDateTask(datTransactionDate, intWorkTaskID);

                        intRecordsReturned = TheFindWorkTaskUsageByDateTaskDataSet.FindWorkTaskUsageByDateTask.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            decTaskCount = 0;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            decTaskCount = Convert.ToDecimal(TheFindWorkTaskUsageByDateTaskDataSet.FindWorkTaskUsageByDateTask[0].TotalCount);
                        }

                        decPercentage = decTaskCount / decTotalCount;

                        ProductionTasksForSheetsDataSet.productiontasksRow NewProductionCode = TheProductionTasksForSheetsDataSet.productiontasks.NewproductiontasksRow();

                        NewProductionCode.WorkTask = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment[intCounter].WorkTask;

                        intGreaterThan = decimal.Compare(decPercentage, Convert.ToDecimal(.001));

                        if (intGreaterThan < 0)
                        {
                            NewProductionCode.UseCode = false;
                        }
                        else if (intGreaterThan > -1)
                        {
                            NewProductionCode.UseCode = true;
                        }

                        TheProductionTasksForSheetsDataSet.productiontasks.Rows.Add(NewProductionCode);
                    }
                }

                dgrProductionCodes.ItemsSource = TheProductionTasksForSheetsDataSet.productiontasks;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Production Sheet // Update Grid " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }

            PleaseWait.Close();
        }
Ejemplo n.º 9
0
        private void expCreateReport_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intWarehouseID;
            int      intRecordsReturned;
            int      intToolKey;
            DateTime datEndDate   = DateTime.Now;
            DateTime datStartDate = DateTime.Now;
            string   strWarehouse;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intNumberOfRecords = TheFindActiveToolsDataSet.FindActiveTools.Rows.Count;

                TheWASPToolsDataSet.wasptools.Rows.Clear();

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 365);

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intToolKey = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolKey;

                        TheFindToolHistoryByToolKeyDataSet = TheToolHistoryClass.FindToolHistoryByToolKey(datStartDate, datEndDate, intToolKey);

                        intRecordsReturned = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            WASPToolsDataSet.wasptoolsRow NewToolRow = TheWASPToolsDataSet.wasptools.NewwasptoolsRow();

                            intWarehouseID = TheFindActiveToolsDataSet.FindActiveTools[intCounter].CurrentLocation;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseID);

                            strWarehouse = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;

                            NewToolRow.FirstName       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].FirstName;
                            NewToolRow.LastName        = TheFindActiveToolsDataSet.FindActiveTools[intCounter].LastName;
                            NewToolRow.ToolCategory    = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolCategory;
                            NewToolRow.ToolDescription = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolDescription;
                            NewToolRow.ToolID          = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolID;
                            NewToolRow.ToolKey         = intToolKey;
                            NewToolRow.ToolNotes       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolNotes;
                            NewToolRow.Site            = strWarehouse;
                            NewToolRow.TransactionDate = TheFindActiveToolsDataSet.FindActiveTools[intCounter].TransactionDate;

                            TheWASPToolsDataSet.wasptools.Rows.Add(NewToolRow);
                        }
                        else if (intRecordsReturned < 1)
                        {
                            WASPToolsDataSet.wasptoolsRow NewNoTransaction = TheNoWASPTransactionsDataSet.wasptools.NewwasptoolsRow();

                            intWarehouseID = TheFindActiveToolsDataSet.FindActiveTools[intCounter].CurrentLocation;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseID);

                            strWarehouse = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;

                            NewNoTransaction.FirstName       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].FirstName;
                            NewNoTransaction.LastName        = TheFindActiveToolsDataSet.FindActiveTools[intCounter].LastName;
                            NewNoTransaction.ToolCategory    = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolCategory;
                            NewNoTransaction.ToolDescription = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolDescription;
                            NewNoTransaction.ToolID          = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolID;
                            NewNoTransaction.ToolKey         = intToolKey;
                            NewNoTransaction.ToolNotes       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolNotes;
                            NewNoTransaction.Site            = strWarehouse;
                            NewNoTransaction.TransactionDate = TheFindActiveToolsDataSet.FindActiveTools[intCounter].TransactionDate;

                            TheNoWASPTransactionsDataSet.wasptools.Rows.Add(NewNoTransaction);
                        }
                    }
                }

                dgrTools.ItemsSource = TheNoWASPTransactionsDataSet.wasptools;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create WASP Tool Report // Create Report Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }

            PleaseWait.Close();
        }
Ejemplo n.º 10
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            int      intVehicleID = 0;
            DateTime datStartDate = DateTime.Now;
            DateTime datEndDate   = DateTime.Now;
            string   strItemID;
            int      intItemID = 0;
            string   strItem;
            string   strManufacturer;
            string   strModel;
            string   strSerialNumber;
            string   strQuantity;
            int      intQuantity = 0;
            string   strWarehouse;
            string   strAssetNotes;
            bool     blnFatalError = false;
            int      intWarehouseID;

            try
            {
                TheImportITAssetsDataSet.importitassets.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 5; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strItemID = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();

                    blnFatalError = TheDataValidationClass.VerifyIntegerData(strItemID);
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Item ID is not Numeric at Count " + Convert.ToString(intCounter));
                        return;
                    }
                    else
                    {
                        intItemID = Convert.ToInt32(strItemID);
                    }
                    strItem         = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strManufacturer = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strModel        = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                    strSerialNumber = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                    strQuantity     = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();
                    blnFatalError   = TheDataValidationClass.VerifyIntegerData(strQuantity);
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Quantity is not Numeric");
                        return;
                    }
                    else
                    {
                        intQuantity = Convert.ToInt32(strQuantity);
                    }
                    strWarehouse = Convert.ToString((range.Cells[intCounter, 7] as Excel.Range).Value2).ToUpper();
                    TheFindWarehouseByWarehouseNameDataSet = TheEmployeeClass.FindWarehouseByWarehouseName(strWarehouse);
                    intWarehouseID = TheFindWarehouseByWarehouseNameDataSet.FindWarehouseByWarehouseName[0].EmployeeID;
                    strAssetNotes  = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();

                    ImportITAssetsDataSet.importitassetsRow NewItAsset = TheImportITAssetsDataSet.importitassets.NewimportitassetsRow();

                    NewItAsset.Item         = strItem;
                    NewItAsset.ItemID       = intItemID;
                    NewItAsset.Location     = strWarehouse;
                    NewItAsset.Manufacturer = strManufacturer;
                    NewItAsset.Model        = strModel;
                    NewItAsset.Notes        = strAssetNotes;
                    NewItAsset.Quantity     = intQuantity;
                    NewItAsset.SerialNumber = strSerialNumber;
                    NewItAsset.WarehouseID  = intWarehouseID;

                    TheImportITAssetsDataSet.importitassets.Rows.Add(NewItAsset);
                }

                dgrAssets.ItemsSource = TheImportITAssetsDataSet.importitassets;


                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import IT Assets // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 11
0
        private void expProcessImport_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            bool     blnFatalError = false;
            int      intPhoneID;
            int      intEmployeeID;
            DateTime datTransactionDate;
            string   strDestination;
            int      intCallMinutes;
            string   strCallTime;
            string   strTransactionNumber;
            int      intRecordsReturned;



            try
            {
                expProcessImport.IsExpanded = false;

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                intNumberOfRecords = TheCellPhoneCallsDataSet.cellphonecalls.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intPhoneID           = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].PhoneID;
                        intEmployeeID        = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].EmployeeID;
                        datTransactionDate   = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].TransactionDate;
                        strDestination       = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].Destination;
                        intCallMinutes       = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].CallMinutes;
                        strCallTime          = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].CallTime;
                        strTransactionNumber = TheCellPhoneCallsDataSet.cellphonecalls[intCounter].TransactionNumber;

                        TheFindCellPhoneCallForVerificationDataSet = TheCellPhoneCallsClass.FindCellPhoneCallForVerification(intPhoneID, datTransactionDate, intCallMinutes, strCallTime, strTransactionNumber);

                        intRecordsReturned = TheFindCellPhoneCallForVerificationDataSet.FindCellPhoneCallForVerification.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            blnFatalError = TheCellPhoneCallsClass.InsertCellPhoneCall(intPhoneID, intEmployeeID, datTransactionDate, strDestination, intCallMinutes, strCallTime, strTransactionNumber);

                            if (blnFatalError == true)
                            {
                                throw new Exception();
                            }
                        }
                    }
                }

                PleaseWait.Close();

                TheMessagesClass.InformationMessage("All Calls Have Been Imported");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Cell Calls // Process Import " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 12
0
        private void cboSelectWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intSelectedIndex;
            string strLocation;
            int    intPartID;
            string strPartNumber;
            string strJDEPartNumber;
            string strOldPartNumber;
            string strPartDescription;
            int    intOldQuantity;
            int    intNewQuantity;
            int    intVariance;

            try
            {
                intSelectedIndex = cboSelectWarehouse.SelectedIndex - 1;

                if (intSelectedIndex > 0)
                {
                    MainWindow.gintWarehouseID = TheFindPartsWarehouseDataSet.FindPartsWarehouses[intSelectedIndex].EmployeeID;

                    TheImportInventoryDataSet.importinventory.Rows.Clear();

                    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                    dlg.FileName   = "Document";             // Default file name
                    dlg.DefaultExt = ".xlsx";                // Default file extension
                    dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                    // Show open file dialog box
                    Nullable <bool> result = dlg.ShowDialog();

                    // Process open file dialog box results
                    if (result == true)
                    {
                        // Open document
                        string filename = dlg.FileName;
                    }

                    PleaseWait PleaseWait = new PleaseWait();
                    PleaseWait.Show();

                    xlDropOrder = new Excel.Application();
                    xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                    xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                    range = xlDropSheet.UsedRange;
                    intNumberOfRecords = range.Rows.Count;
                    intColumnRange     = range.Columns.Count;

                    for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strLocation        = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                        intPartID          = Convert.ToInt32((range.Cells[intCounter, 2] as Excel.Range).Value2);
                        strPartNumber      = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                        strJDEPartNumber   = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                        strOldPartNumber   = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                        strPartDescription = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();
                        intOldQuantity     = Convert.ToInt32((range.Cells[intCounter, 7] as Excel.Range).Value2);
                        intNewQuantity     = Convert.ToInt32((range.Cells[intCounter, 8] as Excel.Range).Value2);

                        intVariance = intNewQuantity - intOldQuantity;

                        ImportInventoryDataSet.importinventoryRow NewPartRow = TheImportInventoryDataSet.importinventory.NewimportinventoryRow();

                        NewPartRow.CurrentCount    = intNewQuantity;
                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.OldCount        = intOldQuantity;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;
                        NewPartRow.Variance        = intVariance;
                        NewPartRow.Location        = strLocation;

                        TheImportInventoryDataSet.importinventory.Rows.Add(NewPartRow);
                    }

                    dgrInventory.ItemsSource = TheImportInventoryDataSet.importinventory;

                    PleaseWait.Close();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Tow Motors // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 13
0
        private void ResetControls()
        {
            //setting up the variables
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strLogonName;
            string   strItemAccessed;
            DateTime datStartDate = DateTime.Now;
            DateTime datEndDate   = DateTime.Now;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheEventLogSecurityDataSet.eventlogsecurity.Rows.Clear();

                txtEndDate.Text      = "";
                txtStartDate.Text    = "";
                txtEnterKeyWord.Text = "";
                cboReportType.Items.Clear();
                cboReportType.Items.Add("Select Report Type");
                cboReportType.Items.Add("Date Search Report");
                cboReportType.Items.Add("User Report");
                cboReportType.Items.Add("Item Search");
                cboReportType.SelectedIndex = 0;

                datStartDate = DateTime.Now;
                datStartDate = TheDateSearchClass.RemoveTime(datStartDate);
                datEndDate   = TheDateSearchClass.AddingDays(datStartDate, 1);
                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 1);

                TheFindServerEventLogForReportsbyDateRangeDataSet = TheEventLogClass.FindServerEventLogForReportsByDateRange(datStartDate, datEndDate);

                intNumberOfRecords = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        datTransactionDate = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].TransactionDate;
                        strLogonName       = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].LogonName;
                        strItemAccessed    = TheFindServerEventLogForReportsbyDateRangeDataSet.FindServerEventLogForReportsByDateRange[intCounter].ItemAccessed;

                        EventlLogSecurityDataSet.eventlogsecurityRow NewEventEntry = TheEventLogSecurityDataSet.eventlogsecurity.NeweventlogsecurityRow();

                        NewEventEntry.TransactionDate = datTransactionDate;
                        NewEventEntry.LogonName       = strLogonName;
                        NewEventEntry.ItemAccessed    = strItemAccessed;

                        TheEventLogSecurityDataSet.eventlogsecurity.Rows.Add(NewEventEntry);
                    }
                }

                dgrEventLog.ItemsSource = TheEventLogSecurityDataSet.eventlogsecurity;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Event Log Security // Reset Controls " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            //setting up the variables
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strAssignedProjectID;
            string strProjectName;
            string strWorkTask;
            int    intPiecesFootage;
            bool   blnItemFound;
            int    intSecondCounter;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEnddate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                        return;
                    }
                }

                TheFindCompanyFootagesDataSet = TheProjectTaskClass.FindCompanyFootages(gdatStartDate, gdatEndDate);

                //getting ready for the loop
                TheProjectFootagesDataSet.projectfootages.Rows.Clear();
                gintCounter         = 0;
                gintNumberOfRecords = 0;

                intNumberOfRecords = TheFindCompanyFootagesDataSet.FindCompanyFootages.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strProjectName       = TheFindCompanyFootagesDataSet.FindCompanyFootages[intCounter].ProjectName;
                        strAssignedProjectID = TheFindCompanyFootagesDataSet.FindCompanyFootages[intCounter].AssignedProjectID;
                        strWorkTask          = TheFindCompanyFootagesDataSet.FindCompanyFootages[intCounter].WorkTask;
                        intPiecesFootage     = Convert.ToInt32(TheFindCompanyFootagesDataSet.FindCompanyFootages[intCounter].FootagePieces);
                        blnItemFound         = false;

                        if (gintCounter > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++)
                            {
                                if (strAssignedProjectID == TheProjectFootagesDataSet.projectfootages[intSecondCounter].AssignedProjectID)
                                {
                                    if (strWorkTask == TheProjectFootagesDataSet.projectfootages[intSecondCounter].WorkTask)
                                    {
                                        TheProjectFootagesDataSet.projectfootages[intSecondCounter].FootagePieces += intPiecesFootage;
                                        blnItemFound = true;
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            ProjectFootagesDataSet.projectfootagesRow NewProjectRow = TheProjectFootagesDataSet.projectfootages.NewprojectfootagesRow();

                            NewProjectRow.AssignedProjectID = strAssignedProjectID;
                            NewProjectRow.ProjectName       = strProjectName;
                            NewProjectRow.FootagePieces     = intPiecesFootage;
                            NewProjectRow.WorkTask          = strWorkTask;

                            TheProjectFootagesDataSet.projectfootages.Rows.Add(NewProjectRow);

                            gintNumberOfRecords = gintCounter;
                            gintCounter++;
                        }
                    }
                }

                intNumberOfRecords  = TheProjectFootagesDataSet.projectfootages.Rows.Count - 1;
                gintCounter         = 0;
                gintNumberOfRecords = 0;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strWorkTask      = TheProjectFootagesDataSet.projectfootages[intCounter].WorkTask;
                        intPiecesFootage = TheProjectFootagesDataSet.projectfootages[intCounter].FootagePieces;
                        blnItemFound     = false;

                        if (gintCounter > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++)
                            {
                                if (strWorkTask == TheTotalWorkTaskFootages.totalworktaskfootages[intSecondCounter].WorkTask)
                                {
                                    TheTotalWorkTaskFootages.totalworktaskfootages[intSecondCounter].FootagePieces += intPiecesFootage;
                                    blnItemFound = true;
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            TotalWorkTaskFootagesDataSet.totalworktaskfootagesRow NewProjectRow = TheTotalWorkTaskFootages.totalworktaskfootages.NewtotalworktaskfootagesRow();

                            NewProjectRow.WorkTask      = strWorkTask;
                            NewProjectRow.FootagePieces = intPiecesFootage;

                            TheTotalWorkTaskFootages.totalworktaskfootages.Rows.Add(NewProjectRow);
                            gintNumberOfRecords = gintCounter;
                            gintCounter++;
                        }
                    }
                }

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Company Project Footages");

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                dgrResults.ItemsSource = TheTotalWorkTaskFootages.totalworktaskfootages;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Company Project Footages // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }

            PleaseWait.Close();
        }
        private void ResetControls()
        {
            //setting up the variables
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strLogonName;
            string   strItemAccessed;
            string   strEventNotes;
            bool     blnItemFound = false;
            int      intSecondCounter;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheEventLogSecurityDataSet.eventlogsecurity.Rows.Clear();

                TheFindServerEventLogSecurityAccessDataSet = TheEventLogClass.FindServerEventLogSecurityAccess();

                intNumberOfRecords  = TheFindServerEventLogSecurityAccessDataSet.FindServerEventLogSecurityAccess.Rows.Count;
                gintNumberOfRecords = 0;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        datTransactionDate = TheFindServerEventLogSecurityAccessDataSet.FindServerEventLogSecurityAccess[intCounter].TransactionDate;
                        strLogonName       = "Just Beginging";
                        strItemAccessed    = "Date Goes Here";
                        strEventNotes      = TheFindServerEventLogSecurityAccessDataSet.FindServerEventLogSecurityAccess[intCounter].EventNotes;

                        char[]   delims      = new[] { '\n', '\t', '\r' };
                        string[] strNewItems = strEventNotes.Split(delims, StringSplitOptions.RemoveEmptyEntries);

                        strLogonName    = strNewItems[5];
                        strItemAccessed = strNewItems[16];
                        blnItemFound    = false;

                        datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);

                        if (gintNumberOfRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < gintNumberOfRecords; intSecondCounter++)
                            {
                                if (datTransactionDate == TheEventLogSecurityDataSet.eventlogsecurity[intSecondCounter].TransactionDate)
                                {
                                    if (strLogonName == TheEventLogSecurityDataSet.eventlogsecurity[intSecondCounter].LogonName)
                                    {
                                        if (strItemAccessed == TheEventLogSecurityDataSet.eventlogsecurity[intSecondCounter].ItemAccessed)
                                        {
                                            blnItemFound = true;
                                        }
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            EventlLogSecurityDataSet.eventlogsecurityRow NewEventRow = TheEventLogSecurityDataSet.eventlogsecurity.NeweventlogsecurityRow();

                            NewEventRow.TransactionDate = datTransactionDate;
                            NewEventRow.LogonName       = strLogonName;
                            NewEventRow.ItemAccessed    = strItemAccessed;

                            TheEventLogSecurityDataSet.eventlogsecurity.Rows.Add(NewEventRow);
                            gintNumberOfRecords++;
                        }
                    }
                }

                dgrEventLog.ItemsSource = TheEventLogSecurityDataSet.eventlogsecurity;

                TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Server Security Report");

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Event Log Security // Reset Controls " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 16
0
        private void cboSelectLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intAssetID;
            string strAssetDescription;
            string strSerialNumber;
            string strAssetType;
            string strBJCNumber;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            bool   blnItemFound;
            int    intTransactionID;
            string strModel;
            string strManufacturer;
            int    intSelectedIndex;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                intSelectedIndex = cboSelectLocation.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheMonitorsDataSet.monitors.Rows.Clear();

                    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                    dlg.FileName   = "Document";             // Default file name
                    dlg.DefaultExt = ".xlsx";                // Default file extension
                    dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                    // Show open file dialog box
                    Nullable <bool> result = dlg.ShowDialog();

                    // Process open file dialog box results
                    if (result == true)
                    {
                        // Open document
                        string filename = dlg.FileName;
                    }

                    MainWindow.gstrAssetLocation = TheFindSortedWaspAssetLocationsBySiteDataSet.FindSortedWaspAssetLoctionsBySite[intSelectedIndex].AssetLocation;

                    if (cboSelectLocation.SelectedIndex < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Site Has Not Been Selected\n";
                    }
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage(strErrorMessage);
                        return;
                    }

                    xlDropOrder = new Excel.Application();
                    xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                    xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                    range = xlDropSheet.UsedRange;
                    intNumberOfRecords = range.Rows.Count;
                    intColumnRange     = range.Columns.Count;

                    for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        TheWaspAssetIDDataSet = TheAssetClass.GetWaspAssetIDInfo();

                        intAssetID       = TheWaspAssetIDDataSet.waspassetid[0].CreatedAssetID;
                        intTransactionID = TheWaspAssetIDDataSet.waspassetid[0].TransactionID;

                        blnFatalError = TheAssetClass.UpdateWaspAssetID(intTransactionID, intAssetID + 1);

                        blnItemFound = false;
                        strAssetType = "UNKNOWN";

                        if (((range.Cells[intCounter, 1] as Excel.Range).Value2) == null)
                        {
                            intCounter = intNumberOfRecords;
                            break;
                        }
                        else
                        {
                            strAssetDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                            strManufacturer     = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                            strModel            = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                            strSerialNumber     = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                            strBJCNumber        = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();
                            strAssetType        = Convert.ToString((range.Cells[intCounter, 7] as Excel.Range).Value2).ToUpper();


                            TheFindWaspAssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(strBJCNumber);

                            intRecordsReturned = TheFindWaspAssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                blnItemFound = true;
                            }
                        }

                        if (blnItemFound == false)
                        {
                            MonitorsDataSet.monitorsRow NewMonitorRow = TheMonitorsDataSet.monitors.NewmonitorsRow();

                            NewMonitorRow.AssetID      = intAssetID;
                            NewMonitorRow.AssetType    = strAssetType;
                            NewMonitorRow.BJCAssetID   = strBJCNumber;
                            NewMonitorRow.Item         = strAssetDescription;
                            NewMonitorRow.Location     = MainWindow.gstrAssetLocation;
                            NewMonitorRow.Manufacturer = strManufacturer;
                            NewMonitorRow.Model        = strModel;
                            NewMonitorRow.SerialNumber = strSerialNumber;
                            NewMonitorRow.Site         = gstrSite;
                            NewMonitorRow.WarehouseID  = MainWindow.gintWarehouseID;

                            TheMonitorsDataSet.monitors.Rows.Add(NewMonitorRow);
                        }
                    }
                }

                PleaseWait.Close();

                dgrAssets.ItemsSource = TheMonitorsDataSet.monitors;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Vehicle Assets // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 17
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strJDEPartNumber;
            int    intPartID = 0;
            string strPartDescription;
            int    intQuantity = 0;
            int    intRecordsReturned;
            bool   blnItemFound;
            bool   blnItemInTable;
            bool   blnFatalError = false;
            int    intSecondCounter;
            string strOldPartNumber = "";

            try
            {
                expImportExcel.IsExpanded = false;

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Spectrum Report // Import Spectrum Count");

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                if (cboSelectWarehouse.SelectedIndex < 1)
                {
                    TheMessagesClass.ErrorMessage("The Warehouse Was Not Selected");
                    return;
                }

                TheSpectrumCountDataSet.spectrumcount.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords  = range.Rows.Count;
                intColumnRange      = range.Columns.Count;
                gintCounter         = 0;
                gintNumberOfRecords = 0;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound       = false;
                    strPartNumber      = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strJDEPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID        = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        blnItemFound     = true;
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheFindPartByJDEPartNUmberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strPartNumber = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            intPartID     = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartID;
                            blnItemFound  = true;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartNumber == "NONE")
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intCounter * -1;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = "UNKNOWN";

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }


                    if (blnItemFound == true)
                    {
                        TheFindWarehouseInventoryByPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID);

                        intRecordsReturned = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            blnItemInTable = false;

                            if (gintCounter > 0)
                            {
                                for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++)
                                {
                                    if (intPartID == TheSpectrumCountDataSet.spectrumcount[intSecondCounter].PartID)
                                    {
                                        blnItemInTable = true;
                                    }
                                }
                            }

                            if (blnItemInTable == false)
                            {
                                intQuantity = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart[0].Quantity;

                                TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                                intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                                }
                                else
                                {
                                    strOldPartNumber = "NOT FOUND";
                                }

                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = intQuantity;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartDescription.Contains("CABLE RG6") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE RG11") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 875") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 625") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }
                }

                dgrResult.ItemsSource = TheSpectrumCountDataSet.spectrumcount;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Spectrum Report // Import Excel Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strPartLocation;
            string strJDEPartNumber;
            int    intPartID;
            string strOldPartNumber;
            string strPartDescription;
            int    intRecordsReturned;

            try
            {
                TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartLocation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                        TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        strOldPartNumber = "NONE FOUND";

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }

                        ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.Location        = strPartLocation;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;
                        NewPartRow.ToBeImported    = true;

                        TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                    }
                    else if (intRecordsReturned < 1)
                    {
                        strJDEPartNumber = strPartNumber;

                        TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                            strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                            TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                            intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                            strOldPartNumber = "NONE FOUND";

                            if (intRecordsReturned > 0)
                            {
                                strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                            }

                            ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                            NewPartRow.JDEPartNumber   = strJDEPartNumber;
                            NewPartRow.Location        = strPartLocation;
                            NewPartRow.OldPartNumber   = strOldPartNumber;
                            NewPartRow.PartDescription = strPartDescription;
                            NewPartRow.PartID          = intPartID;
                            NewPartRow.PartNumber      = strPartNumber;
                            NewPartRow.ToBeImported    = true;

                            TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                        }
                    }
                }

                PleaseWait.Close();

                dgrImportedInformation.ItemsSource = TheImportInventoryLocationdDataSet.importinventorylocations;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Inventory Locations // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void ResetControls()
        {
            //setting up the local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intProjectID;
            DateTime datTransactionDate = DateTime.Now;
            DateTime datStartDate       = DateTime.Now;
            decimal  decAveragePayRate;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheShopViolatorDataSet.violator.Rows.Clear();

                datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);

                datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 31);

                TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID("SHOP");

                intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 31);

                TheFindProjectStatsDataSet = TheEmployeeProductivityStatsClass.FindProjectStats(intProjectID);

                gdecMean           = TheFindProjectStatsDataSet.FindProjectStats[0].AveHours;
                gdecStandDeviation = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursSTDev);
                gdecVariance       = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursVariance);
                gdecTotalHours     = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours);
                decAveragePayRate  = TheFindProjectStatsDataSet.FindProjectStats[0].AveragePayRate;

                gdecMean = Math.Round(gdecMean, 4);

                txtAverageHours.Text = Convert.ToString(gdecMean);

                gdecVariance       = Math.Round(gdecVariance, 4);
                gdecStandDeviation = Math.Round(gdecStandDeviation, 4);

                gdecUpperBound = gdecMean + gdecStandDeviation;

                txtUpperBound.Text = Convert.ToString(gdecUpperBound);

                TheFindProjectHoursAboveLimitDataSet = TheEmployeeProjectAssignmentClass.FindProjectHoursAboveLimit(intProjectID, datStartDate, gdecUpperBound);

                intNumberOfRecords = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        ShopViolatorDataSet.violatorRow NewViolatorRow = TheShopViolatorDataSet.violator.NewviolatorRow();

                        NewViolatorRow.FirstName       = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].FirstName;
                        NewViolatorRow.HomeOffice      = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].HomeOffice;
                        NewViolatorRow.Hours           = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TotalHours;
                        NewViolatorRow.LastName        = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].LastName;
                        NewViolatorRow.TransactionDate = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TransactionDate;

                        TheShopViolatorDataSet.violator.Rows.Add(NewViolatorRow);
                    }
                }

                dgrResults.ItemsSource = TheShopViolatorDataSet.violator;

                gdecProjectHours    = TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours;
                txtShopHours.Text   = Convert.ToString(gdecProjectHours);
                gdecProjectCost     = gdecProjectHours * decAveragePayRate;
                gdecProjectCost     = Math.Round(gdecProjectCost, 4);
                txtProjectCost.Text = Convert.ToString(gdecProjectCost);

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Shop Hours Analysis // Reset Controls " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 20
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            string   strTowMotorNumber;
            string   strTowMotorYear;
            int      intTowMotorYear;
            string   strTowMotorMake;
            string   strTowMotorModel;
            string   strTowMotorHours;
            decimal  decTowMotorHours;
            string   strWarehouse;
            int      intWarehouseID = 0;
            string   strOilChangeDate;
            DateTime datOilChangeDate;
            bool     blnActive = true;
            int      intWarehouseCounter;
            int      intWarehouseNumberOfRecords;
            string   strSerialNumber;
            string   strWeight;
            int      intWeight;
            string   strCapacity;
            int      intCapacity;

            try
            {
                TheImportTowMotorDataSet.importtowmotors.Rows.Clear();
                TheFindWarehousesDataSet    = TheEmployeeClass.FindWarehouses();
                intWarehouseNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1;

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strTowMotorNumber = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strTowMotorYear   = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    intTowMotorYear   = Convert.ToInt32(strTowMotorYear);
                    strTowMotorMake   = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strTowMotorModel  = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                    strSerialNumber   = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                    strTowMotorHours  = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();
                    decTowMotorHours  = Convert.ToDecimal(strTowMotorHours);
                    strWarehouse      = Convert.ToString((range.Cells[intCounter, 7] as Excel.Range).Value2).ToUpper();
                    strWeight         = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();
                    intWeight         = Convert.ToInt32(strWeight);
                    strCapacity       = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();
                    intCapacity       = Convert.ToInt32(strCapacity);

                    for (intWarehouseCounter = 0; intWarehouseCounter <= intWarehouseNumberOfRecords; intWarehouseCounter++)
                    {
                        if (strWarehouse == TheFindWarehousesDataSet.FindWarehouses[intWarehouseCounter].FirstName)
                        {
                            intWarehouseID = TheFindWarehousesDataSet.FindWarehouses[intWarehouseCounter].EmployeeID;
                        }
                    }

                    strOilChangeDate = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();
                    DateTime.TryParse(strOilChangeDate, out datOilChangeDate);

                    ImportTowMotorDataSet.importtowmotorsRow NewTowMotorRow = TheImportTowMotorDataSet.importtowmotors.NewimporttowmotorsRow();

                    NewTowMotorRow.TowMotorNumber   = strTowMotorNumber;
                    NewTowMotorRow.TowMotorYear     = intTowMotorYear;
                    NewTowMotorRow.TowMotorMake     = strTowMotorMake;
                    NewTowMotorRow.TowMotorModel    = strTowMotorModel;
                    NewTowMotorRow.TowMotorHours    = decTowMotorHours;
                    NewTowMotorRow.WarehouseID      = intWarehouseID;
                    NewTowMotorRow.OilChangeDate    = DateTime.Now;
                    NewTowMotorRow.TowMotorActive   = blnActive;
                    NewTowMotorRow.TowMotorSerialNo = strSerialNumber;
                    NewTowMotorRow.TowMotorWeight   = intWeight;
                    NewTowMotorRow.TowMotorCapacity = intCapacity;

                    TheImportTowMotorDataSet.importtowmotors.Rows.Add(NewTowMotorRow);
                }

                dgrTowMotors.ItemsSource = TheImportTowMotorDataSet.importtowmotors;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Tow Motors // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 21
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            string   strCellNumber;
            string   strLastFour;
            int      intPhoneID;
            int      intEmployeeID;
            string   strFirstName;
            string   strLastName;
            string   strTransactionDate;
            DateTime datTransactionDate;
            string   strGigaBytesUsed;
            decimal  decGigaBytesUsed;
            int      intRecordsReturned;
            double   douDate;

            try
            {
                expImportExcel.IsExpanded = false;
                TheImportCellPhoneDataDataSet.importcellphonedata.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strCellNumber      = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strTransactionDate = Convert.ToString((range.Cells[intCounter, 6] as Excel.Range).Value2).ToUpper();
                    strGigaBytesUsed   = Convert.ToString((range.Cells[intCounter, 11] as Excel.Range).Value2).ToUpper();

                    strLastFour = strCellNumber.Substring(8, 4);

                    if (strLastFour != "5546")
                    {
                        TheFindCellPhoneByLastFourDataSet = ThePhonesClass.FindCellPhoneByLastFour(strLastFour);

                        intRecordsReturned = TheFindCellPhoneByLastFourDataSet.FindCellPhoneByLastFour.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            TheMessagesClass.ErrorMessage(strCellNumber + " Cell Number Does Not Exist");

                            return;
                        }

                        intPhoneID    = TheFindCellPhoneByLastFourDataSet.FindCellPhoneByLastFour[0].PhoneID;
                        intEmployeeID = TheFindCellPhoneByLastFourDataSet.FindCellPhoneByLastFour[0].EmployeeID;
                        strFirstName  = TheFindCellPhoneByLastFourDataSet.FindCellPhoneByLastFour[0].FirstName;
                        strLastName   = TheFindCellPhoneByLastFourDataSet.FindCellPhoneByLastFour[0].LastName;

                        douDate = Convert.ToDouble(strTransactionDate);

                        datTransactionDate = DateTime.FromOADate(douDate);

                        decGigaBytesUsed = Convert.ToDecimal(strGigaBytesUsed);

                        TheFindCellPhoneDataValidationDataSet = TheCellPhoneCallsClass.FindCellPhoneDataValidation(intPhoneID, intEmployeeID, datTransactionDate, decGigaBytesUsed);

                        intRecordsReturned = TheFindCellPhoneDataValidationDataSet.FindCellPhoneDataValidation.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            ImportCellPhoneDataDataSet.importcellphonedataRow NewDataRow = TheImportCellPhoneDataDataSet.importcellphonedata.NewimportcellphonedataRow();

                            NewDataRow.EmployeeID      = intEmployeeID;
                            NewDataRow.FirstName       = strFirstName;
                            NewDataRow.GigaByteUsed    = decGigaBytesUsed;
                            NewDataRow.LastName        = strLastName;
                            NewDataRow.PhoneID         = intPhoneID;
                            NewDataRow.PhoneNumber     = strCellNumber;
                            NewDataRow.TransactionDate = datTransactionDate;

                            TheImportCellPhoneDataDataSet.importcellphonedata.Rows.Add(NewDataRow);
                        }
                    }
                }

                dgrCellData.ItemsSource = TheImportCellPhoneDataDataSet.importcellphonedata;
                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Cell Data // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 22
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string   strValueForValidation;
            bool     blnFatalError = false;
            DateTime datStartDate  = DateTime.Now;
            DateTime datTodaysDate = DateTime.Now;
            string   strKeyword;
            int      intRecordsReturned;

            try
            {
                TheFindServerLogAccessByEmployeeIDDataSet = TheEventLogClass.FindServerLogAccessByEmployeeID(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID);

                intRecordsReturned = TheFindServerLogAccessByEmployeeIDDataSet.FindServerLogAccessByEmmployeeID.Rows.Count;

                if (intRecordsReturned < 0)
                {
                    TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Server Audit Log // THERE HAS BEEN AN ATTEMPT TO ACCESS THROUGH ERP");

                    TheMessagesClass.ErrorMessage("ACCESS DENIED, IT HAS BEEN NOTIFIED");
                    throw new Exception();
                }

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Server Audit Log");

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                //beginning data validation
                strValueForValidation = txtStartDate.Text;
                blnFatalError         = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Start Date is not a Date");
                    return;
                }
                else
                {
                    datStartDate = Convert.ToDateTime(strValueForValidation);

                    blnFatalError = TheDataValidationClass.verifyDateRange(datStartDate, datTodaysDate);

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Start Date is after Todays Date");
                        return;
                    }
                }
                strKeyword = txtKeyword.Text;
                if (strKeyword.Length < 3)
                {
                    TheMessagesClass.ErrorMessage("The Search Term is not Long Enough");
                    return;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheFindServerEventLogByNoteKeywordDataSet = TheEventLogClass.FindServerEventLogByNoteKeyword(strKeyword, datStartDate, datTodaysDate);

                string strTestVarialbe = TheFindServerEventLogByNoteKeywordDataSet.FindServerLogByNoteKeyword[0].EventNotes;

                dgrResults.ItemsSource = TheFindServerEventLogByNoteKeywordDataSet.FindServerLogByNoteKeyword;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Server Audit Log // Search Button " + Ex.Message);

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Server Audit Log // Search Button " + Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 23
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            string   strValueForValidation;
            DateTime datTransactionDate = DateTime.Now;
            bool     blnFatalError      = false;
            int      intEmployeeID;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            DateTime datSecondDate;
            string   strFirstName;
            string   strLastName;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheDuplicateEmployeeDataSet.duplicateemployees.Rows.Clear();

                strValueForValidation = txtEnterPayPeriod.Text;
                blnFatalError         = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Date Entered is not a Date\n");
                    return;
                }
                else
                {
                    datTransactionDate = Convert.ToDateTime(strValueForValidation);
                }

                datSecondDate = TheDateSearchClass.AddingDays(datTransactionDate, 1);

                TheFindDuplicateEmployeePunchedHoursDataSet = TheEmployeePunchedHoursClass.FindDuplicateEmployeePunchedHours(datTransactionDate);

                intNumberOfRecords = TheFindDuplicateEmployeePunchedHoursDataSet.FindDuplicateEmployeePunchedHours.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intEmployeeID = TheFindDuplicateEmployeePunchedHoursDataSet.FindDuplicateEmployeePunchedHours[intCounter].EmployeeID;
                        strFirstName  = TheFindDuplicateEmployeePunchedHoursDataSet.FindDuplicateEmployeePunchedHours[intCounter].FirstName;
                        strLastName   = TheFindDuplicateEmployeePunchedHoursDataSet.FindDuplicateEmployeePunchedHours[intCounter].LastName;

                        TheFindEmployeePunchedHoursDataSet = TheEmployeePunchedHoursClass.FindEmployeePunchedHours(intEmployeeID, datTransactionDate, datSecondDate);

                        intSecondNumberOfRecords = TheFindEmployeePunchedHoursDataSet.FindEmployeePunchedHours.Rows.Count;

                        for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                        {
                            DuplicateEmployeeDataSet.duplicateemployeesRow NewEmployeeRow = TheDuplicateEmployeeDataSet.duplicateemployees.NewduplicateemployeesRow();

                            NewEmployeeRow.EmployeeID    = intEmployeeID;
                            NewEmployeeRow.FirstName     = strFirstName;
                            NewEmployeeRow.LastName      = strLastName;
                            NewEmployeeRow.PunchedHours  = TheFindEmployeePunchedHoursDataSet.FindEmployeePunchedHours[intSecondCounter].PunchedHours;
                            NewEmployeeRow.TransactionID = TheFindEmployeePunchedHoursDataSet.FindEmployeePunchedHours[intSecondCounter].TransactionID;
                            NewEmployeeRow.Remove        = false;

                            TheDuplicateEmployeeDataSet.duplicateemployees.Rows.Add(NewEmployeeRow);
                        }
                    }
                }

                dgrEmployees.ItemsSource = TheDuplicateEmployeeDataSet.duplicateemployees;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Double Hours // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 24
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int      intColumnRange = 0;
            int      intCounter;
            int      intNumberOfRecords;
            string   strValueForValidation;
            int      intEmployeeID       = 0;
            int      intPayID            = 0;
            DateTime datCreatedDateTime  = DateTime.Now;
            DateTime datPunchedDateTime  = DateTime.Now;
            DateTime datActualDateTime   = DateTime.Now;
            string   strPayGroup         = "";
            string   strPunchMode        = "";
            string   strPunchType        = "";
            string   strPunchSouce       = "";
            string   strPunchIPAddress   = "";
            DateTime datLastUpdate       = DateTime.Now;
            bool     blnFailedValidation = false;
            int      intRecordsReturned;
            double   douProcessDate;
            string   strFirstName = "";
            string   strLastName  = "";
            string   strPunchUser;

            try
            {
                expImportExcel.IsExpanded = false;
                TheImportAholaPunchesDataSet.importaholapunches.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter < intNumberOfRecords; intCounter++)
                {
                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();

                    blnFailedValidation = TheDataValidationClass.VerifyIntegerData(strValueForValidation);

                    if (blnFailedValidation == true)
                    {
                        throw new Exception();
                    }
                    else
                    {
                        intPayID = Convert.ToInt32(strValueForValidation);

                        TheFindEmployeeByPayIDDataSet = TheEmployeeClass.FindEmployeeByPayID(intPayID);

                        intRecordsReturned = TheFindEmployeeByPayIDDataSet.FindEmployeeByPayID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            throw new Exception();
                        }
                        else
                        {
                            intEmployeeID = TheFindEmployeeByPayIDDataSet.FindEmployeeByPayID[0].EmployeeID;
                            strFirstName  = TheFindEmployeeByPayIDDataSet.FindEmployeeByPayID[0].FirstName;
                            strLastName   = TheFindEmployeeByPayIDDataSet.FindEmployeeByPayID[0].LastName;
                        }
                    }

                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();

                    blnFailedValidation = TheDataValidationClass.VerifyDoubleData(strValueForValidation);

                    if (blnFailedValidation == true)
                    {
                        throw new Exception();
                    }
                    else
                    {
                        douProcessDate = Convert.ToDouble(strValueForValidation);

                        datActualDateTime = DateTime.FromOADate(douProcessDate);
                    }

                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();

                    blnFailedValidation = TheDataValidationClass.VerifyDoubleData(strValueForValidation);

                    if (blnFailedValidation == true)
                    {
                        throw new Exception();
                    }
                    else
                    {
                        douProcessDate = Convert.ToDouble(strValueForValidation);

                        datPunchedDateTime = DateTime.FromOADate(douProcessDate);
                    }

                    strValueForValidation = Convert.ToString((range.Cells[intCounter, 10] as Excel.Range).Value2).ToUpper();

                    blnFailedValidation = TheDataValidationClass.VerifyDateData(strValueForValidation);

                    if (blnFailedValidation == true)
                    {
                        datCreatedDateTime = DateTime.Now;
                    }
                    else
                    {
                        datCreatedDateTime = Convert.ToDateTime(strValueForValidation);
                    }

                    strPayGroup       = Convert.ToString((range.Cells[intCounter, 14] as Excel.Range).Value2).ToUpper();
                    strPunchMode      = Convert.ToString((range.Cells[intCounter, 15] as Excel.Range).Value2).ToUpper();
                    strPunchType      = Convert.ToString((range.Cells[intCounter, 16] as Excel.Range).Value2).ToUpper();
                    strPunchSouce     = Convert.ToString((range.Cells[intCounter, 17] as Excel.Range).Value2).ToUpper();
                    strPunchIPAddress = Convert.ToString((range.Cells[intCounter, 20] as Excel.Range).Value2).ToUpper();
                    strPunchUser      = Convert.ToString((range.Cells[intCounter, 27] as Excel.Range).Value2).ToUpper();

                    strPunchUser = "";

                    //strValueForValidation = Convert.ToString((range.Cells[intCounter, 28] as Excel.Range).Value2).ToUpper();

                    strValueForValidation = Convert.ToString(DateTime.Now);

                    blnFailedValidation = TheDataValidationClass.VerifyDateData(strValueForValidation);

                    if (blnFailedValidation == true)
                    {
                        throw new Exception();
                    }
                    else
                    {
                        datLastUpdate = Convert.ToDateTime(strValueForValidation);
                    }


                    ImportAholaPunchesDataSet.importaholapunchesRow NewPunchRow = TheImportAholaPunchesDataSet.importaholapunches.NewimportaholapunchesRow();

                    NewPunchRow.ActualDateTime  = datActualDateTime;
                    NewPunchRow.CreatedDateTime = datCreatedDateTime;
                    NewPunchRow.EmployeeID      = intEmployeeID;
                    NewPunchRow.FirstName       = strFirstName;
                    NewPunchRow.LastName        = strLastName;
                    NewPunchRow.LastUpdate      = datLastUpdate;
                    NewPunchRow.PayGroup        = strPayGroup;
                    NewPunchRow.PayID           = intPayID;
                    NewPunchRow.PunchDateTime   = datPunchedDateTime;
                    NewPunchRow.PunchIPAddress  = strPunchIPAddress;
                    NewPunchRow.PunchMode       = strPunchMode;
                    NewPunchRow.PunchSource     = strPunchSouce;
                    NewPunchRow.PunchType       = strPunchType;
                    NewPunchRow.PunchUser       = strPunchUser;

                    TheImportAholaPunchesDataSet.importaholapunches.Rows.Add(NewPunchRow);
                }

                dgrResults.ItemsSource = TheImportAholaPunchesDataSet.importaholapunches;
                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Import Employee Punches // Import Excel  " + Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Employee Punches // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intWorkTaskID = 0;
            string strWorkTask   = "";
            string strLaborCode;
            string strLaborType;
            string strItemFunction;
            string strItemDescription;
            string strUnitOfMeasure;


            try
            {
                expImportExcel.IsExpanded = false;
                TheImportWorkTaskDataSet.importworktask.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strLaborCode       = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strLaborType       = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strItemFunction    = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strItemDescription = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                    strUnitOfMeasure   = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();

                    TheFindWorkTaskImportByLaborCodeDataSet = TheWorkTaskClass.FindWorkTaskImportByLaborCode(strLaborCode);

                    intRecordsReturned = TheFindWorkTaskImportByLaborCodeDataSet.FindWorkTaskImportByLaborCode.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindWorkTaskByKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strLaborCode);

                        intRecordsReturned = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            intWorkTaskID = intCounter * -1;
                            strWorkTask   = strLaborCode + " - " + strItemFunction;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            intWorkTaskID = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                            strWorkTask   = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTask;
                        }

                        ImportWorkTaskDataSet.importworktaskRow NewWorkTaskRow = TheImportWorkTaskDataSet.importworktask.NewimportworktaskRow();

                        NewWorkTaskRow.ItemDescription = strItemDescription;
                        NewWorkTaskRow.ItemFunction    = strItemDescription;
                        NewWorkTaskRow.LaborCode       = strLaborCode;
                        NewWorkTaskRow.LaborType       = strLaborType;
                        NewWorkTaskRow.UnitOfMeasure   = strUnitOfMeasure;
                        NewWorkTaskRow.WorkTask        = strWorkTask;
                        NewWorkTaskRow.WorkTaskID      = intWorkTaskID;

                        TheImportWorkTaskDataSet.importworktask.Rows.Add(NewWorkTaskRow);
                    }
                }

                dgrProductionCodes.ItemsSource = TheImportWorkTaskDataSet.importworktask;


                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Production Codes // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 26
0
        private void expCalculateHours_Expanded(object sender, RoutedEventArgs e)
        {
            //setting up the variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intEmployeeID = 0;
            string   strFirstName  = "";
            string   strLastName   = "";
            DateTime datStartDate;
            DateTime datEndDate = DateTime.Now;
            string   strPunchType;
            string   strPunchSource;
            decimal  decDailyHours = 0;
            TimeSpan tspTotalHours;
            int      intSecondCounter;
            bool     blnRecordFound;
            int      intPayID;

            try
            {
                expCalculateHours.IsExpanded = false;
                TheCalculatedHoursDataSet.calculatedhours.Rows.Clear();
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();
                gintPunchRecords = 0;

                intNumberOfRecords = TheImportAholaPunchesDataSet.importaholapunches.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        blnRecordFound = false;
                        intEmployeeID  = TheImportAholaPunchesDataSet.importaholapunches[intCounter].EmployeeID;
                        strFirstName   = TheImportAholaPunchesDataSet.importaholapunches[intCounter].FirstName;
                        strLastName    = TheImportAholaPunchesDataSet.importaholapunches[intCounter].LastName;
                        datStartDate   = TheImportAholaPunchesDataSet.importaholapunches[intCounter].ActualDateTime;
                        intPayID       = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PayID;


                        if (TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchMode == "OUT")
                        {
                            datEndDate = TheImportAholaPunchesDataSet.importaholapunches[intCounter].ActualDateTime;
                        }

                        else
                        {
                            if (intCounter + 1 < intNumberOfRecords)
                            {
                                if (intEmployeeID == TheImportAholaPunchesDataSet.importaholapunches[intCounter + 1].EmployeeID)
                                {
                                    datEndDate = TheImportAholaPunchesDataSet.importaholapunches[intCounter + 1].ActualDateTime;

                                    intCounter++;
                                }
                                else if (intEmployeeID == TheImportAholaPunchesDataSet.importaholapunches[intCounter - 1].EmployeeID)
                                {
                                    //datStartDate = TheImportAholaPunchesDataSet.importaholapunches[intCounter - 1].ActualDateTime;
                                }
                            }
                            else
                            {
                                datEndDate = datStartDate;
                            }
                        }

                        if (TheImportAholaPunchesDataSet.importaholapunches[intCounter - 1].PunchMode == "IN")
                        {
                            datEndDate   = TheImportAholaPunchesDataSet.importaholapunches[intCounter].ActualDateTime;
                            datStartDate = TheImportAholaPunchesDataSet.importaholapunches[intCounter - 1].ActualDateTime;
                        }


                        tspTotalHours = datEndDate - datStartDate;

                        decDailyHours = Convert.ToDecimal(tspTotalHours.TotalHours);

                        if (decDailyHours < 0)
                        {
                            tspTotalHours = datStartDate - datEndDate;

                            decDailyHours = Convert.ToDecimal(tspTotalHours.TotalHours);
                        }

                        decDailyHours = Math.Round(decDailyHours, 3);

                        strPunchSource = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchSource;
                        strPunchType   = TheImportAholaPunchesDataSet.importaholapunches[intCounter].PunchType;


                        if (gintPunchRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < gintPunchRecords; intSecondCounter++)
                            {
                                if (intEmployeeID == TheCalculatedHoursDataSet.calculatedhours[intSecondCounter].EmployeeID)
                                {
                                    if (datStartDate.Hour == 0)
                                    {
                                    }
                                    else if (datStartDate == TheCalculatedHoursDataSet.calculatedhours[intSecondCounter].StartTime)
                                    {
                                        blnRecordFound = true;
                                    }
                                    else if (datStartDate == TheCalculatedHoursDataSet.calculatedhours[intSecondCounter].EndTime)
                                    {
                                        if (TheImportAholaPunchesDataSet.importaholapunches[intCounter - 1].PunchMode != "IN")
                                        {
                                            blnRecordFound = true;
                                        }
                                    }
                                }
                            }
                        }


                        if (blnRecordFound == false)
                        {
                            CalculatedHoursDataSet.calculatedhoursRow NewPunchRow = TheCalculatedHoursDataSet.calculatedhours.NewcalculatedhoursRow();

                            NewPunchRow.DailyHours = decDailyHours;
                            NewPunchRow.EmployeeID = intEmployeeID;
                            NewPunchRow.EndTime    = datEndDate;
                            NewPunchRow.FirstName  = strFirstName;
                            NewPunchRow.LastName   = strLastName;
                            NewPunchRow.StartTime  = datStartDate;
                            NewPunchRow.PayID      = intPayID;

                            TheCalculatedHoursDataSet.calculatedhours.Rows.Add(NewPunchRow);
                            gintPunchRecords++;
                        }
                    }
                }

                dgrResults.ItemsSource    = TheCalculatedHoursDataSet.calculatedhours;
                expProcessHours.IsEnabled = true;

                PleaseWait.Close();

                TheMessagesClass.InformationMessage("Hours Have Been Calculated");
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Import Employee Punches // Calculate Hours Expander " + Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Employee Punches // Calculate Hours Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 27
0
        private void expImportParts_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int     intColumnRange = 0;
            int     intCounter;
            int     intNumberOfRecords;
            string  strPartID;
            int     intPartID;
            string  strPartNumber;
            string  strJDEPartNumber;
            string  strPartDescription;
            string  strPartPrice;
            decimal decPartPrice;

            try
            {
                ThePartPriceImportDataSet.partpriceimport.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strPartID          = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    intPartID          = Convert.ToInt32(strPartID);
                    strPartNumber      = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strJDEPartNumber   = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strPartDescription = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                    strPartPrice       = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                    decPartPrice       = Convert.ToDecimal(strPartPrice);

                    decPartPrice = Math.Round(decPartPrice, 2);

                    PartPriceImportDataSet.partpriceimportRow NewPartRow = ThePartPriceImportDataSet.partpriceimport.NewpartpriceimportRow();

                    NewPartRow.PartID          = intPartID;
                    NewPartRow.PartNumber      = strPartNumber;
                    NewPartRow.JDEPartNumber   = strJDEPartNumber;
                    NewPartRow.PartDescription = strPartDescription;
                    NewPartRow.PartPrice       = decPartPrice;

                    ThePartPriceImportDataSet.partpriceimport.Rows.Add(NewPartRow);
                }

                dgrParts.ItemsSource = ThePartPriceImportDataSet.partpriceimport;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Prices // Import Parts  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }