Example #1
0
 private void Key_press_KeyDown(object sender, KeyEventArgs e)
 {
     if (newEmployeeTabControl.SelectedIndex == 2)
     {
         if (e.KeyCode != Keys.ShiftKey)
         {
             if (e.KeyCode == Keys.Enter)
             {
                 _cardID = _cardID.ToString().Substring(1, 12);
                 if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(db.cardAlreadyAssigned(Conversions.ToString(_cardID)), false, false)))
                 {
                     MdlControllerModifier.warning("card available", titleScanLabel);
                     ScanCardPictureBox.BackgroundImage = My.Resources.Resources.icon_available;
                     FinishButton.Text = "Finish";
                 }
                 else
                 {
                     MdlControllerModifier.warning("card not available", titleScanLabel);
                     _cardID = "";
                     ScanCardPictureBox.BackgroundImage = My.Resources.Resources.icon_not_available;
                 }
             }
             else
             {
                 _cardID += e.KeyCode.ToString().Substring(1, 1);
             }
         }
     }
 }
Example #2
0
 private void EmployeeManagementForm_Load(object sender, EventArgs e)
 {
     MdlOptionsManagement.getEmployeeManagementAllowedFunctionalities();
     MdlControllerModifier.clearFields();
     MdlEmpManagement.populateEmployeeList(BunifuDataGridView1, employeeStatus);
     firstLoad = false;
 }
Example #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var cIn  = Convert.ToDateTime(clockInDateTimePicker.Value.ToShortDateString() + " " + clockInTimePicker.Value.ToShortTimeString());
            var cOut = Convert.ToDateTime(clockoOutDateTimePicker.Value.ToShortDateString() + " " + clockOutTimePicker.Value.ToShortTimeString());

            if (string.IsNullOrEmpty(modifiedByTextBox.Text) | reasonNewEntryComboBox.SelectedIndex == -1)
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (reasonNewEntryComboBox.SelectedItem.Equals("Other") & string.IsNullOrEmpty(RichTextBox1.Text))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (clockOutCheckBox.Checked & cIn > cOut)
            {
                MdlControllerModifier.warning("Wrong time", editEntryTitleLabel);
            }
            else
            {
                int selectedItemD = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView.CurrentCell.RowIndex;
                int selectedItemS = My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.CurrentCell.RowIndex;
                if (shiftTypeComboBox.SelectedItem.Equals("Hourly") & My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[7].Value.Equals("Crew") & workDoneListView.CheckedIndices.Count == 0 & clockOutCheckBox.Checked)
                {
                    MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
                }
                else
                {
                    MdlTimeManagement.updatePunchInfo();
                    int userId = Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[7].Value.Equals("Crew"));
                    MdlTimeManagement.populateDetails(Conversions.ToInteger(My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.Rows[selectedItemS].Cells[6].Value));
                    MdlControllerModifier.clearFields();
                    Close();
                }
            }
        }
Example #4
0
        private void TouchButton3_Load(object sender, EventArgs e)
        {
            string condition = "";

            if (typeComboBox.SelectedIndex != 0)
            {
                condition = Conversions.ToString(condition + Operators.AddObject(Operators.AddObject("And Type = '", typeComboBox.SelectedItem), "' "));
            }

            if (yardComboBox.SelectedIndex != 3)
            {
                condition = Conversions.ToString(condition + Operators.AddObject(Operators.AddObject("And Yard = '", yardComboBox.SelectedItem), "'"));
            }

            if (jobDescriptionComboBox.SelectedIndex != 21)
            {
                condition = Conversions.ToString(condition + Operators.AddObject(Operators.AddObject("And Job_Description = '", jobDescriptionComboBox.SelectedItem), "'"));
            }

            if (payMethodComboBox.SelectedIndex != 0)
            {
                condition = Conversions.ToString(condition + Operators.AddObject(Operators.AddObject("And Pay_Method = '", payMethodComboBox.SelectedItem), "' "));
            }

            MdlControllerModifier.populateEmployeeListSchedule(selectEmpoyeeListView, condition);
        }
Example #5
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            var employeDataGridView = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            int employeeID          = Conversions.ToInteger(employeDataGridView.Rows[employeDataGridView.CurrentRow.Index].Cells[6].Value);

            if (string.IsNullOrEmpty(usernameTextBox.Text) | string.IsNullOrEmpty(passwordTextBox.Text) | string.IsNullOrEmpty(confirmTextBox.Text))
            {
                nameOfemployeLabel.Text      = "Please, make sure to fill all the required fields";
                nameOfemployeLabel.BackColor = Color.Firebrick;
            }
            else if (!confirmTextBox.Text.Equals(passwordTextBox.Text))
            {
                nameOfemployeLabel.Text      = "Passwords don't match";
                nameOfemployeLabel.BackColor = Color.Firebrick;
            }
            else if (employeDataGridView.SelectedRows.Count > 0)
            {
                db.createUsername(employeeID, Strings.Trim(usernameTextBox.Text), MdlModifyData.base64Encode(Strings.Trim(passwordTextBox.Text)));
                nameOfemployeLabel.Text      = "Success";
                nameOfemployeLabel.BackColor = Color.Green;
            }
            else
            {
                nameOfemployeLabel.Text      = "Please, select an employee to proceed";
                nameOfemployeLabel.BackColor = Color.Firebrick;
            }
            // MdlControllerModifier.deactivateButtons(FrmEmployeeManagement.modifyButton,
            // FrmEmployeeManagement.terminateButton,
            // FrmEmployeeManagement.cardIDButton,
            // FrmEmployeeManagement.deleteButton)
            MdlControllerModifier.pause(2000);
            Close();
        }
Example #6
0
        private void createNewEntryButton_Click(object sender, EventArgs e)
        {
            var employeeType = default(string);
            int selectedRow  = createEntyDataGrid.CurrentRow.Index;

            if (createEntyDataGrid.SelectedRows.Count > 0)
            {
                employeeType = Conversions.ToString(createEntyDataGrid.Rows[selectedRow].Cells[4].Value);
            }

            if (string.IsNullOrEmpty(newEntrymodifiedByTextBox.Text) | reasonNewEntryComboBox.SelectedIndex == -1 | shiftTypeComboBox.SelectedIndex == -1 | siteLocationComboBox.SelectedIndex == -1)
            {
            }
            else if (createEntyDataGrid.SelectedRows.Count == 0 | clockInCheckBox.Checked == false)
            {
                MdlControllerModifier.warning("no item selected", editEntryTitleLabel);
            }
            else if (reasonNewEntryComboBox.SelectedItem.Equals("Other") & string.IsNullOrEmpty(RichTextBox1.Text))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (employeeType.Equals("Crew") & workDoneListView.CheckedItems.Count == 0 & shiftTypeComboBox.SelectedItem.Equals("Piece Work"))
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (employeeType.Equals("Crew") & workDoneListView.CheckedItems.Count == 0 & shiftTypeComboBox.SelectedItem.Equals("Hourly") & clockOutCheckBox.Checked)
            {
                MdlControllerModifier.warning("Edit entry", editEntryTitleLabel);
            }
            else if (clockOutCheckBox.Checked & newEntryclockInTimePicker.Value > newEntryclockOutTimePicker.Value)
            {
                MdlControllerModifier.warning("Wrong time", editEntryTitleLabel);
            }
            else
            {
                MdlTimeManagement.createNewPunch(newEntryDatePicker, newEntryclockInTimePicker, newEntryclockOutTimePicker);
                editEntryTitleLabel.Text = "Success!";
                editEntryTitleLabel.Update();
                if (createEntyDataGrid.SelectedRows.Count > 0)
                {
                    if (My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView.SelectedRows.Count > 0)
                    {
                        int selectedEmployee = Conversions.ToInteger(createEntyDataGrid.Rows[selectedRow].Cells[3].Value);
                        MdlTimeManagement.populateDetails(selectedEmployee);
                    }
                    else
                    {
                        MdlTimeManagement.populateTimeSheetList();
                    }

                    Close();
                }

                My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.SelectedIndex = My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.SelectedIndex;
            }
        }
Example #7
0
        private void FrmShiftScheduling_Load(object sender, EventArgs e)
        {
            string condition = "";

            yardComboBox.SelectedIndex           = 3;
            typeComboBox.SelectedIndex           = 0;
            jobDescriptionComboBox.SelectedIndex = 21;
            payMethodComboBox.SelectedIndex      = 0;
            MdlControllerModifier.populateEmployeeListSchedule(selectEmpoyeeListView, condition);
        }
Example #8
0
 private void TouchButton1_Load(object sender, EventArgs e)
 {
     Label1.Text = "Saving permissions...";
     Label1.Refresh();
     // selectParentNode()
     MdlModifyData.saveClearance(My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1);
     Label1.Text      = "Success";
     Label1.BackColor = Color.Green;
     Label1.Refresh();
     MdlControllerModifier.pause(500);
     Close();
 }
Example #9
0
 private void emergencyPhoneNumberTextBox_LostFocus(object sender, EventArgs e)
 {
     if (MdlControllerModifier.formatPhoneNumber(emergencyPhoneNumberTextBox.Text).Equals("Wrong format"))
     {
         titlePersonalInfoLabel.Text      = "Phone number has wrong format";
         titlePersonalInfoLabel.BackColor = Color.Firebrick;
     }
     else
     {
         emergencyPhoneNumberTextBox.Text = MdlControllerModifier.formatPhoneNumber(emergencyPhoneNumberTextBox.Text);
         titlePersonalInfoLabel.BackColor = Color.DarkSlateGray;
         titlePersonalInfoLabel.Text      = "Fill up all that apply";
     }
 }
Example #10
0
        private void EmployeeManagementForm_Load(object sender, EventArgs e)
        {
            pictureExtendsion = "";
            PictureLocalPath  = "";
            MdlOptionsManagement.getEmployeeManagementAllowedFunctionalities();
            // adjustScreen(Me, FrmParentScreen.menuIsExpanded)
            MdlControllerModifier.clearFields();
            var jobDescriptionsTable = db.getTableInfo("Employees", "distinct(Job_Description)", "order by Job_Description").Rows;

            jobDescriptionComboBox.Items.Clear();
            foreach (DataRow job in jobDescriptionsTable)
            {
                jobDescriptionComboBox.Items.Add(job["Job_Description"]);
            }
        }
Example #11
0
        private void printButton_Click(object sender, EventArgs e)
        {
            titleTimeManagementLabel.Text = "";
            I_Start_Items = 0;
            I_Start       = 0;
            bool employeeIsSelected = false;

            summaryIsPrinted = false;
            for (int i = 0, loopTo = summaryBunifuDataGridView.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(summaryBunifuDataGridView.Rows[i].Cells[0].Value, true, false)))
                {
                    employeeIsSelected = true;
                    break;
                }
            }

            if (employeeIsSelected)
            {
                // If completeTimeSheet = True Then

                PrintDialog1.Document = PrintDocument1;
                if (PrintDialog1.ShowDialog() == DialogResult.OK)
                {
                    PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                    LineNumber = 0;
                    var New_Paper = new PaperSize("", 850, 1100);
                    New_Paper.PaperName = ((int)PaperKind.Custom).ToString();
                    var New_Margin = new Margins();
                    New_Margin.Left = 0;
                    New_Margin.Top  = 50;
                    {
                        var withBlock = PrintDocument1;
                        withBlock.DefaultPageSettings.PaperSize = New_Paper;
                        withBlock.DefaultPageSettings.Margins   = New_Margin;
                        // .PrinterSettings.DefaultPageSettings.Landscape = False
                        withBlock.Print();
                    }
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected", titleTimeManagementLabel);
            }
        }
Example #12
0
        private void Button4_Click(object sender, EventArgs e)
        {
            if (FinishButton.Text.Equals("Cancel"))
            {
                MdlControllerModifier.clearFields();
                MdlControllerModifier.formatTabsbackToNormal();
            }
            else
            {
                db.updateCardID(_employeeFirstName, _alias, _employeeLasttName, Conversions.ToString(_cardID)); // Then
                _cardID = "";
                MdlControllerModifier.formatTabsbackToNormal();
                MdlControllerModifier.clearFields();
                newEmployeeTabControl.SelectTab(0);
                MdlEmpManagement.populateEmployeeList(My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1, My.MyProject.Forms.FrmEmployeeManagement.employeeStatus);
            }

            Close();
            My.MyProject.Forms.FrmEmployeeManagement.Show();
        }
Example #13
0
        private void Button1_Click(object sender, EventArgs e)
        {
            bool completeTimeSheet = true;

            if (summaryBunifuDataGridView.SelectedRows.Count > 0)
            {
                if (completeTimeSheet == true)
                {
                    MdlControllerModifier.clearFields();
                    MdlTimeManagement.exportCSV();
                }
                else
                {
                    MdlControllerModifier.warning("timesheet not complete", titleTimeManagementLabel);
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected", titleTimeManagementLabel);
            }
        }
Example #14
0
        private void sendMessageTouchButton_Load(object sender, EventArgs e)
        {
            if (messageSaved == false)
            {
                if (!string.IsNullOrEmpty(subjectTextBox.Text) & !string.IsNullOrEmpty(messageEmployeeRichTextBox.Text) & employeesListView.SelectedIndices.Count > 0)
                {
                    db.saveNotification(Conversions.ToInteger(employeesListView.Items[employeesListView.FocusedItem.Index].SubItems[1].Text), "Message", "MESSAGE - " + subjectTextBox.Text, messageEmployeeRichTextBox.Text, " where ID = 0");
                    titleemployeeLabel.BackColor = Color.Green;
                    titleemployeeLabel.Text      = "Message sent!";
                    titleemployeeLabel.Update();
                    MdlControllerModifier.pause(2000);
                    Close();
                }
                else
                {
                    titleemployeeLabel.Text      = "Please, make sure the employee is selected and all the fields are filled up";
                    titleemployeeLabel.BackColor = Color.Red;
                }

                messageSaved = true;
            }
        }
Example #15
0
        private void addCommentsButton_Click(object sender, EventArgs e)
        {
            if (addCommentsButton.Text.Equals("Add notes"))
            {
                if (commentsRichTextBox.Text.Equals("N/A"))
                {
                    commentsRichTextBox.Text = "";
                }

                titleLabel.Text = "Editing notes...";
                commentsRichTextBox.BackColor = Color.Snow;
                commentsRichTextBox.ReadOnly  = false;
                commentsRichTextBox.Select();
                addCommentsButton.Text = "Save notes";
            }
            else
            {
                if (commentsRichTextBox.Text.Equals(""))
                {
                    commentsRichTextBox.Text = "N/A";
                }

                db.updateNotesActionTaken(My.MyProject.Forms.FrmEmployeeManagementHP.notificationID, commentsRichTextBox.Text);
                commentsRichTextBox.BackColor = Color.SeaShell;
                commentsRichTextBox.ReadOnly  = true;
                addCommentsButton.Text        = "Add notes";
                titleLabel.Text      = "Saved";
                titleLabel.BackColor = Color.Green;
                MdlControllerModifier.pause(2000);
                Close();
                // titleLabel.Text = "Notification details"
                // titleLabel.BackColor = Color.FromArgb(0, 64, 64)
            }

            titleLabel.Update();
            addCommentsButton.Update();
        }
Example #16
0
        public static void populateDetails(int selectedID)
        {
            MdlLoadingSetting.waitForm.Show();
            detailedEntires.Clear();
            detailsDataGridView.Rows.Clear();
            detailedEntires.Columns.Add("date");
            detailedEntires.Columns.Add("clockIn");
            detailedEntires.Columns.Add("clockOut");
            detailedEntires.Columns.Add("hoursWorked");
            detailedEntires.Columns.Add("punchID");
            detailedEntires.Columns.Add("shift");
            summaryList         = My.MyProject.Forms.FrmTimeSheet.summaryBunifuDataGridView;
            detailsDataGridView = My.MyProject.Forms.FrmTimeSheet.detailsBunifuDataGridView;
            DateTime d1;
            var      d2 = default(DateTime);
            string   hours;
            string   payMethod = My.MyProject.Forms.FrmTimeSheet.payMethodComboBox.Text.Substring(0, 1);

            if (payMethod.Equals("P"))
            {
                payMethod = "and Punch_Type = 'PW'";
            }
            else if (payMethod.Equals("A"))
            {
                payMethod = "";
            }
            else
            {
                payMethod = "and Punch_Type = '" + payMethod + "'";
            }

            string fields    = "ID, userID, Start_Time_Date, End_Time_Date, Punch_Type";
            string condition = "where  Start_Time_Date >= '" + Conversions.ToString(startPeriodDate) + "' and " + "Start_Time_Date  <= '" + Conversions.ToString(endPeriodDate) + "' and UserID = " + selectedID.ToString() + "  " + payMethod + " order by Start_Time_Date";

            foreach (DataRow entry in db.getTableInfo("Time_Sheet", fields, condition).Rows)
            {
                string punchType;
                if (entry["Punch_Type"].Equals("H"))
                {
                    punchType = "Hourly";
                }
                else if (entry["Punch_Type"].Equals("S"))
                {
                    punchType = "Salary";
                }
                else
                {
                    punchType = "Piece Work";
                }

                if (db.isStatPunch(Conversions.ToString(entry["ID"])))
                {
                    punchType = "Statutory";
                }

                d1 = Convert.ToDateTime(entry["Start_Time_Date"]);
                if (!Information.IsDBNull(entry["End_Time_Date"]))
                {
                    d2    = Convert.ToDateTime(entry["End_Time_Date"]);
                    hours = Conversions.ToString(MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"])));
                    detailedEntires.Items.Add(new ListViewItem(new[] { Strings.Format(d1, "MM/dd/yyyy"), Strings.Format(d1, "HH:mm "), Strings.Format(d2, "HH:mm "), Conversions.ToString(MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"]))), Conversions.ToString(entry["ID"]), Conversions.ToString(entry["Punch_Type"]) }));
                    detailsDataGridView.Rows.Add(Strings.Format((object)d1, "MM/dd/yyyy"), Strings.Format((object)d1, "HH:mm "), Strings.Format((object)d2, "HH:mm "), MdlControllerModifier.hoursWorked(Conversions.ToString(entry["Start_Time_Date"]), Conversions.ToString(entry["End_Time_Date"])), punchType, "", entry["ID"], entry["Punch_Type"]);
                }
                else
                {
                    detailsDataGridView.Rows.Add(Strings.Format((object)d1, "MM/dd/yyyy"), Strings.Format((object)d1, "HH:mm "), "", "", punchType, "", entry["ID"], entry["Punch_Type"]);
                    detailedEntires.Items.Add(new ListViewItem(new[] { Strings.Format(d1, "MM/dd/yyyy"), Strings.Format(d1, "HH:mm "), Strings.Format(d2, "HH:mm "), "", Conversions.ToString(entry["ID"]), Conversions.ToString(entry["Punch_Type"]) }));
                }
            }

            showModifiedPunches();
            MdlLoadingSetting.waitForm.Close();
        }
Example #17
0
        private void printButton_Click(object sender, EventArgs e)
        {
            INDEX_ALL_DAYS           = 0;
            INDEX_FOCUSED_EMPLOYEE   = 0;
            INDEX_EMPLOYEES_COMPARED = 0;
            INDEX_EMPLOYEES_COMPARED_CHECK_OVERTIME = 0;
            pageNumber     = 1;
            checkedWork    = "";
            nextPageExists = false;
            if (reportFromListView.SelectedItems.Count > 0 & CheckedListBox1.CheckedItems.Count > 0 & comparisonTypeComboBox.SelectedIndex == 1)
            {
                titleLabel.Text      = "Hours worked comparison report";
                titleLabel.BackColor = Color.FromArgb(64, 64, 0);
                var loopTo = CheckedListBox1.Items.Count - 1;
                for (i = 0; i <= loopTo; i++)
                {
                    string Item = (string)CheckedListBox1.Items[i];
                    if (CheckedListBox1.GetItemChecked(i))
                    {
                        Item         = Strings.Trim(Conversions.ToString(Item.Split('(')[0]));
                        checkedWork += Item.ToString().Replace(" ", "_") + "='yes' or ";
                    }
                }

                checkedWork = checkedWork.Substring(0, checkedWork.Length - 3);
                int    selectedIndex = reportFromListView.FocusedItem.Index;
                string condition     = Conversions.ToString(Operators.AddObject(Operators.AddObject(" and Site_Location = '", yardComboBox.SelectedItem), "'"));
                if (yardComboBox.SelectedItem.Equals("Both"))
                {
                    condition = "";
                }

                employeesWorkingThatDay      = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 2, checkedWork, condition);
                datesWorkedByFocusedEmployee = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 1, checkedWork, "");
                datesWorkedTable             = (DataTable)db.getReport(Conversions.ToInteger(reportFromListView.Items[selectedIndex].SubItems[1].Text), 3, checkedWork, condition);
                if (comparisonTypeComboBox.SelectedIndex == 1 & CheckedListBox1.CheckedItems.Count > 0)
                {
                    PrintDialog1.Document = PrintDocument1;
                    if (PrintDialog1.ShowDialog() == DialogResult.OK)
                    {
                        PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings;
                        LineNumber = 0;
                        var New_Paper = new PaperSize("", 850, 1100);
                        New_Paper.PaperName = ((int)PaperKind.Custom).ToString();
                        var New_Margin = new Margins();
                        New_Margin.Left = 20;
                        New_Margin.Top  = 50;
                        {
                            var withBlock = PrintDocument1;
                            withBlock.DefaultPageSettings.PaperSize = New_Paper;
                            withBlock.DefaultPageSettings.Margins   = New_Margin;
                            // .PrinterSettings.DefaultPageSettings.Landscape = False
                            withBlock.Print();
                        }
                    }
                }
                else
                {
                }
            }
            else
            {
                MdlControllerModifier.warning("nothing selected report", titleLabel);
            }
        }
Example #18
0
        private void Button2_Click(object sender, EventArgs e)
        {
            var    ftpModule = new MdlFtp();
            string imageName;

            if (string.IsNullOrEmpty(firstNameTextBox.Text) | string.IsNullOrEmpty(lastNameLabel.Text) | typeComboBox.SelectedIndex == -1 | yardComboBox.SelectedIndex == -1 | genderComboBox.SelectedIndex == -1 | string.IsNullOrEmpty(jobDescriptionComboBox.Text) | payMehodComboBox.SelectedIndex == -1)
            {
                MdlControllerModifier.warning("incomplete information", titlePersonalInfoLabel);
            }
            else if (personalInfoButton.Text.Equals("Save and Continue"))
            {
                if (!Information.IsNothing(remoteFtpPath) && remoteFtpPath.Equals(""))
                {
                    imageName     = Strings.Trim(aliasTextBox.Text).Replace("/", "").Replace(@"\", "").Replace(" ", "") + DateAndTime.Now.ToString("dd-MMMd-yyyy_HHmmss") + pictureExtendsion;
                    remoteFtpPath = "/Operations/EmployeeManagement/EmployeePictures/";
                    ftpModule.uploadFtpFile(PictureLocalPath, remoteFtpPath, imageName);
                }
                else
                {
                    remoteFtpPath = "";
                }

                if (Conversions.ToBoolean(db.saveEmployee()))
                {
                    if (!newEmployeeTabControl.TabPages.Contains(certificationsTabPage))
                    {
                        newEmployeeTabControl.TabPages.Add(certificationsTabPage);
                        newEmployeeTabControl.SelectTab(1);
                    }

                    _employeeFirstName = firstNameTextBox.Text;
                    _employeeLasttName = lastNameTextBox.Text;
                    _alias             = aliasTextBox.Text;
                    SkillsCertificationPictureBox.BackgroundImage = employeePictureBox.BackgroundImage;
                    titlePersonalInfoLabel.ForeColor = Color.FromArgb(64, 64, 64);
                    titlePersonalInfoLabel.Text      = "Fill up all that apply";
                }
                else
                {
                    MdlControllerModifier.warning("user already exists", titlePersonalInfoLabel);
                }
            }
            else
            {
                if (!PictureLocalPath.Equals(""))
                {
                    imageName     = Strings.Trim(aliasTextBox.Text).Replace("/", "").Replace(@"\", "").Replace(" ", "") + DateAndTime.Now.ToString("dd-MMMd-yyyy_HHmmss") + pictureExtendsion;
                    remoteFtpPath = "/Operations/EmployeeManagement/EmployeePictures/" + imageName;
                    if ((OldPictureRemotelPath ?? "") != (remoteFtpPath ?? "") && !OldPictureRemotelPath.Equals(""))
                    {
                        ftpModule.deleteFTPImage(OldPictureRemotelPath);
                    }

                    ftpModule.uploadFtpFile(PictureLocalPath, "/Operations/EmployeeManagement/EmployeePictures/", imageName);
                    SkillsCertificationPictureBox.BackgroundImage = employeePictureBox.BackgroundImage;
                    ScanCardPictureBox.BackgroundImage            = employeePictureBox.BackgroundImage;
                }
                else
                {
                    remoteFtpPath = "";
                }

                db.updateEmployeeInfo(MdlModifyData.userID);
                if (!newEmployeeTabControl.TabPages.Contains(certificationsTabPage))
                {
                    newEmployeeTabControl.TabPages.Add(certificationsTabPage);
                    newEmployeeTabControl.SelectTab(1);
                }

                MdlModifyData.fillSkillsCheckBoxes();
                newEmployeeTabControl.SelectTab(1);
            }
        }
Example #19
0
 private void Button2_Click(object sender, EventArgs e)
 {
     Close();
     MdlModifyData.clearEmployeeDetails();
     MdlControllerModifier.clearFields();
 }
Example #20
0
        public static void reassignCardID(string cardID)
        {
            employeDataGridView = My.MyProject.Forms.FrmEmployeeManagement.BunifuDataGridView1;
            int    selectedRow = employeDataGridView.CurrentRow.Index;
            string firstName   = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[1].Value);
            string lasttName   = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[2].Value);
            string aliaas      = Conversions.ToString(employeDataGridView.Rows[selectedRow].Cells[0].Value);

            employeeID = Conversions.ToInteger(employeDataGridView.Rows[selectedRow].Cells[6].Value);

            // db._ID = employeeID

            if (Conversions.ToBoolean(db.cardAlreadyAssigned(cardID)))
            {
                string device = "";
                if (My.MyProject.Forms.FrmCardAssignment.isPhoneID)
                {
                    device = "device";
                }
                else
                {
                    device = "card";
                }

                int result = (int)MessageBox.Show("This " + device + " is already assigned to " + My.MyProject.Forms.FrmLoginWindow._employeeName + ". Would you like to reassign it to " + aliaas + " " + lasttName + "?", "Warning", MessageBoxButtons.YesNo);
                if (result == (int)DialogResult.Yes)
                {
                    db.dissociateCardID();
                    db.reassignCard(employeeID.ToString(), cardID);
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.ForeColor = Color.Green;
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.Text      = device.Substring(0, 1).ToUpper() + device.Substring(1, device.Length - 1) + " assigned to " + firstName + " " + lasttName;
                    My.MyProject.Forms.FrmCardAssignment.PictureBox1.Image = My.Resources.Resources.icon_available;
                    My.MyProject.Forms.FrmCardAssignment.BackColor         = Color.White;
                    MdlControllerModifier.pause(2000);
                    My.MyProject.Forms.FrmCardAssignment.Close();
                }
                else
                {
                    My.MyProject.Forms.FrmCardAssignment._cardID = "";
                }
            }
            else
            {
                string device = "";
                if (My.MyProject.Forms.FrmCardAssignment.isPhoneID)
                {
                    device = "device";
                }
                else
                {
                    device = "card";
                }

                int result = (int)MessageBox.Show("This " + device + " is not in use yet " + ". Would you like to assign it to " + aliaas + " " + lasttName + "?", "Warning", MessageBoxButtons.YesNo);
                if (result == (int)DialogResult.Yes)
                {
                    db.reassignCard(employeeID.ToString(), cardID);
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.ForeColor = Color.Green;
                    My.MyProject.Forms.FrmCardAssignment.reassignCardTitleLabel.Text      = device + " assigned to " + firstName + " " + lasttName;
                    My.MyProject.Forms.FrmCardAssignment.PictureBox1.Image = My.Resources.Resources.icon_available;
                    My.MyProject.Forms.FrmCardAssignment.BackColor         = Color.White;
                    MdlControllerModifier.pause(2000);
                    My.MyProject.Forms.FrmCardAssignment.Close();
                }
                else
                {
                    My.MyProject.Forms.FrmCardAssignment._cardID = "";
                }
            }
        }