Beispiel #1
0
        private void Process_Click(object sender, RoutedEventArgs e)
        {
            //setting up local variables;
            bool   blnFatalError = false;
            string strEmployeeGroup;
            int    intRecordsReturned;

            try
            {
                strEmployeeGroup = txtEmployeeGroupName.Text;

                //data validation
                if (strEmployeeGroup.Length < 4)
                {
                    TheMessagesClass.ErrorMessage("The Employee Group is not Long Enough");
                    return;
                }

                //checking to see if the group existed already
                TheFindEmployeeGroupByGroupNameDataSet = TheEmployeeClass.FindEmployeeGroupByName(strEmployeeGroup);

                intRecordsReturned = TheFindEmployeeGroupByGroupNameDataSet.FindEmployeeGroupByGroupName.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("Employee Group Already Exists");
                    return;
                }

                blnFatalError = TheEmployeeClass.CreateEmployeeGroup(strEmployeeGroup);

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

                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Added Employee Group " + strEmployeeGroup);

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

                TheMessagesClass.InformationMessage("Employee Group has been Created");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Employee Groups // Process Button " + Ex.Message);

                TheSendEmailClass.SendEventLog(Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        public FindEmployeeGroupByGroupNameDataSet FindEmployeeGroupByName(string strGroup)
        {
            try
            {
                aFindEmployeeGroupByGroupNameDataSet      = new FindEmployeeGroupByGroupNameDataSet();
                aFindEmployeeGroupByGroupNameTableAdapter = new FindEmployeeGroupByGroupNameDataSetTableAdapters.FindEmployeeGroupByGroupNameTableAdapter();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Employee DLL // Find Employee Group By Name // " + Ex.Message);
            }

            return(aFindEmployeeGroupByGroupNameDataSet);
        }
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            string strGroupName;
            int    intRecordsReturned;
            bool   blnFatalError = false;

            //data validation
            strGroupName = txtGroupName.Text;
            if (strGroupName == "")
            {
                TheMessagesClass.ErrorMessage("Group Name Was Not Entered");
                return;
            }

            //checking to see if the group name exists
            TheFindEmployeeGroupByGroupNameDataSet = TheEmployeeClass.FindEmployeeGroupByName(strGroupName);

            intRecordsReturned = TheFindEmployeeGroupByGroupNameDataSet.FindEmployeeGroupByGroupName.Rows.Count;

            if (intRecordsReturned != 0)
            {
                TheMessagesClass.ErrorMessage("Group Name Already Exists");
                return;
            }

            blnFatalError = TheEmployeeClass.CreateEmployeeGroup(strGroupName);

            if (blnFatalError == true)
            {
                TheMessagesClass.ErrorMessage("There Was A Problem, Contact IT");
                return;
            }
            else
            {
                txtGroupName.Text = "";
                TheMessagesClass.InformationMessage("Group Name Was Saved");
            }
        }