示例#1
0
        public FindEmployeeByLastFourPhoneDigitsDataSet FindEmployeeByLastFourPhoneDigits(string strLastFour)
        {
            try
            {
                aFindEmployeeByLastFourPhoneDigitsDataSet      = new FindEmployeeByLastFourPhoneDigitsDataSet();
                aFindEmployeeByLastFourPhoneDigitsTableAdapter = new FindEmployeeByLastFourPhoneDigitsDataSetTableAdapters.FindEmployeeByLastFourPhoneDigitsTableAdapter();
                aFindEmployeeByLastFourPhoneDigitsTableAdapter.Fill(aFindEmployeeByLastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits, strLastFour);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Employee Class // Find Employee By Last Four Phone Digits " + Ex.Message);
            }

            return(aFindEmployeeByLastFourPhoneDigitsDataSet);
        }
示例#2
0
        private void expFindMessages_Expanded(object sender, RoutedEventArgs e)
        {
            //setting up local variables
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            string   strErrorMessage    = "";
            string   strValueForValidation;
            int      intCounter;
            int      intNumberOfRecords;
            string   strLastFour;
            string   strRespondent;
            DateTime datTransactionDate;
            string   strPhoneNumber;
            string   strTransactionNumber;
            string   strMessageDirection;
            string   strMessageType;
            int      intRecordsReturned;
            bool     blnItemFound;

            try
            {
                expFindMessages.IsExpanded = false;

                if (cboReportType.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Report Type Was Not Selected\n";
                }
                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 (cboReportType.SelectedIndex == 1)
                {
                    if (gstrTransactionNumber.Length != 4)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Number Of Digits is not Correct\n";
                    }
                }
                else if (cboReportType.SelectedIndex == 2)
                {
                    if (cboSelectEmployee.SelectedIndex < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Employee Was Not Selected\n";
                    }
                }
                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;
                    }
                }

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


                TheMessagesForEmployeeDataSet.messagesforemployee.Rows.Clear();

                if (cboReportType.SelectedIndex == 1)
                {
                    TheFindCellPhoneMessagesForNumberDataSet = TheCellPhoneCallsClass.FindCellPhoneMessagesForNumber(gstrTransactionNumber, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            blnItemFound  = false;
                            strRespondent = "UNKNOWN";

                            datTransactionDate   = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].TransactionDate;
                            gstrFullName         = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].FirstName + " ";
                            gstrFullName        += TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].LastName;
                            strPhoneNumber       = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].PhoneNumber;
                            strTransactionNumber = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].TransactionNumber;
                            strLastFour          = strTransactionNumber.Substring(8, 4);
                            strMessageDirection  = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].MessageDirection;
                            strMessageType       = TheFindCellPhoneMessagesForNumberDataSet.FindCellPhoneMessagesForNumber[intCounter].MessageType;

                            TheFindCellPhoneByLastForDataSet = ThePhonesClass.FindCellPhoneByLastFour(strLastFour);

                            intRecordsReturned = TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                strRespondent  = TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour[0].FirstName + " ";
                                strRespondent += TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour[0].LastName;
                                blnItemFound   = true;
                            }
                            if (blnItemFound == false)
                            {
                                TheFindEmployeeBylastFourPhoneDigitsDataSet = TheEmployeeClass.FindEmployeeByLastFourPhoneDigits(strLastFour);

                                intRecordsReturned = TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    if (strTransactionNumber == TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].PhoneNumber)
                                    {
                                        strRespondent  = TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].FirstName + " ";
                                        strRespondent += TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].LastName;
                                    }
                                }
                            }

                            MessagesForEmployeeDataSet.messagesforemployeeRow NewMessageRow = TheMessagesForEmployeeDataSet.messagesforemployee.NewmessagesforemployeeRow();

                            NewMessageRow.Employee          = gstrFullName;
                            NewMessageRow.MessageDirection  = strMessageDirection;
                            NewMessageRow.MessageType       = strMessageType;
                            NewMessageRow.PhoneNumber       = strPhoneNumber;
                            NewMessageRow.Respondent        = strRespondent;
                            NewMessageRow.TransactionDate   = datTransactionDate;
                            NewMessageRow.TransactionNumber = strTransactionNumber;

                            TheMessagesForEmployeeDataSet.messagesforemployee.Rows.Add(NewMessageRow);
                        }
                    }
                }
                else if (cboReportType.SelectedIndex == 2)
                {
                    TheFindCellPhoneMesagesForEmployeeDataSet = TheCellPhoneCallsClass.FindCellPhoneMessagesForEmployee(gintEmployeeID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            blnItemFound         = false;
                            strRespondent        = "UNKNOWN";
                            datTransactionDate   = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee[intCounter].TransactionDate;
                            strPhoneNumber       = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee[intCounter].PhoneNumber;
                            strTransactionNumber = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee[intCounter].TransactionNumber;
                            strLastFour          = strTransactionNumber.Substring(8, 4);
                            strMessageDirection  = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee[intCounter].MessageDirection;
                            strMessageType       = TheFindCellPhoneMesagesForEmployeeDataSet.FindCellPhoneMessagesForEmployee[intCounter].MessageType;

                            TheFindCellPhoneByLastForDataSet = ThePhonesClass.FindCellPhoneByLastFour(strLastFour);

                            intRecordsReturned = TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                strRespondent  = TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour[0].FirstName + " ";
                                strRespondent += TheFindCellPhoneByLastForDataSet.FindCellPhoneByLastFour[0].LastName;
                                blnItemFound   = true;
                            }
                            if (blnItemFound == false)
                            {
                                TheFindEmployeeBylastFourPhoneDigitsDataSet = TheEmployeeClass.FindEmployeeByLastFourPhoneDigits(strLastFour);

                                intRecordsReturned = TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    if (strTransactionNumber == TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].PhoneNumber)
                                    {
                                        strRespondent  = TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].FirstName + " ";
                                        strRespondent += TheFindEmployeeBylastFourPhoneDigitsDataSet.FindEmployeeByLastFourPhoneDigits[0].LastName;
                                    }
                                }
                            }

                            MessagesForEmployeeDataSet.messagesforemployeeRow NewMessageRow = TheMessagesForEmployeeDataSet.messagesforemployee.NewmessagesforemployeeRow();

                            NewMessageRow.Employee          = gstrFullName;
                            NewMessageRow.MessageDirection  = strMessageDirection;
                            NewMessageRow.MessageType       = strMessageType;
                            NewMessageRow.PhoneNumber       = strPhoneNumber;
                            NewMessageRow.Respondent        = strRespondent;
                            NewMessageRow.TransactionDate   = datTransactionDate;
                            NewMessageRow.TransactionNumber = strTransactionNumber;

                            TheMessagesForEmployeeDataSet.messagesforemployee.Rows.Add(NewMessageRow);
                        }
                    }
                }

                dgrCellMessages.ItemsSource = TheMessagesForEmployeeDataSet.messagesforemployee;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Cell Message Search // Find Messages Expander " + Ex.Message);

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