コード例 #1
0
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    intSelectedIndex;
            string strEmailAddress = "";
            int    intEmployeeID;
            int    intRecordsReturned;
            bool   blnSendEmail  = false;
            bool   blnNotAnEmail = false;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    AssignEmployeesDataSet.assignemployeesRow NewEmployeeRow = TheAssigneEmployeesDataSet.assignemployees.NewassignemployeesRow();

                    NewEmployeeRow.EmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID;
                    NewEmployeeRow.FirstName  = TheComboEmployeeDataSet.employees[intSelectedIndex].FirstName;
                    NewEmployeeRow.LastName   = TheComboEmployeeDataSet.employees[intSelectedIndex].LastName;

                    intEmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID;

                    TheFindEmployeeEmailAddressDataSet = TheEmployeeClass.FindEmployeeEmailAddress(intEmployeeID);

                    intRecordsReturned = TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        blnSendEmail = false;
                    }
                    else if (intRecordsReturned > 0)
                    {
                        if (TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress[0].IsEmailAddressNull() == false)
                        {
                            strEmailAddress = TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress[0].EmailAddress;

                            blnNotAnEmail = TheDataValidationClass.VerifyEmailAddress(strEmailAddress);

                            if (blnNotAnEmail == true)
                            {
                                blnSendEmail = false;
                            }
                            else if (blnNotAnEmail == false)
                            {
                                blnSendEmail = true;
                            }
                        }
                        else
                        {
                            blnSendEmail = false;
                        }
                    }


                    NewEmployeeRow.EmailAddress = strEmailAddress;
                    NewEmployeeRow.SendEmail    = blnSendEmail;

                    /*TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID);
                     *
                     * if(TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].EmployeeGroup == "USERS")
                     * {
                     *  NewEmployeeRow.SendEmail = false;
                     * }
                     * else
                     * {
                     *  NewEmployeeRow.SendEmail = true;
                     * }*/

                    TheAssigneEmployeesDataSet.assignemployees.Rows.Add(NewEmployeeRow);

                    TheMessagesClass.InformationMessage("Employee Added");
                    txtEnterLastName.Text = "";
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Update Specific Task // Select Employee Combo Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
コード例 #2
0
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            string strLastName;
            string strFirstName;
            string strEmailAddress = "";
            int    intSelectedIndex;
            int    intEmployeeID;
            bool   blnRecordFound = false;
            bool   blnSendEmail   = true;
            int    intRecordsReturned;
            bool   blnNotAnEmail;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    intEmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID;

                    blnRecordFound = CheckForExistingEmployee(intEmployeeID);

                    if (blnRecordFound == true)
                    {
                        TheMessagesClass.ErrorMessage("Employee Has Already Been Added");

                        return;
                    }

                    strFirstName = TheComboEmployeeDataSet.employees[intSelectedIndex].FirstName;
                    strLastName  = TheComboEmployeeDataSet.employees[intSelectedIndex].LastName;

                    TheFindEmployeeEmailAddressDataSet = TheEmployeeClass.FindEmployeeEmailAddress(intEmployeeID);

                    intRecordsReturned = TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        blnSendEmail = false;
                    }
                    else if (intRecordsReturned > 0)
                    {
                        if (TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress[0].IsEmailAddressNull() == false)
                        {
                            strEmailAddress = TheFindEmployeeEmailAddressDataSet.FindEmployeeEmailAddress[0].EmailAddress;

                            blnNotAnEmail = TheDataValiationClass.VerifyEmailAddress(strEmailAddress);

                            if (blnNotAnEmail == true)
                            {
                                blnSendEmail = false;
                            }
                            else if (blnNotAnEmail == false)
                            {
                                blnSendEmail = true;
                            }
                        }
                        else
                        {
                            blnSendEmail = false;
                        }
                    }

                    AssignEmployeesDataSet.assignemployeesRow NewEmployeeRow = TheAssignEmployeesDataSet.assignemployees.NewassignemployeesRow();

                    NewEmployeeRow.EmailAddress = strEmailAddress;
                    NewEmployeeRow.EmployeeID   = intEmployeeID;
                    NewEmployeeRow.FirstName    = strFirstName;
                    NewEmployeeRow.LastName     = strLastName;
                    NewEmployeeRow.SendEmail    = blnSendEmail;

                    TheAssignEmployeesDataSet.assignemployees.Rows.Add(NewEmployeeRow);

                    TheMessagesClass.InformationMessage("Employee Added");
                    txtLastName.Text = "";
                    cboSelectEmployee.Items.Clear();

                    mitProcess.IsEnabled = true;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Assign Tasks // Combo Box Selection Change " + Ex.Message);

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