Esempio n. 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);
             }
         }
     }
 }
Esempio n. 2
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();
                }
            }
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
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);
            }
        }
Esempio n. 7
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);
            }
        }