Exemple #1
0
        private void setupAreaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fmArea fArea = new fmArea();

            fArea.ShowDialog();
            LoadAreaCombo(CommonProcs.GetFacList(GetCurrentBranch()));
        }
Exemple #2
0
 private List <int> LoadFacilityCombo(string branchStr)
 {
     cbFac.DataSource    = SelectListHelper.GetFacilityList(branchStr);
     cbFac.DisplayMember = "key";
     cbFac.ValueMember   = "value";
     return(CommonProcs.GetFacList(branchStr));
 }
Exemple #3
0
        private void setupLoginsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CommonProcs.CheckAccessLevel() < 10)
            {
                MessageBox.Show("Not Authorized to View/Edit logins");
                return;
            }

            fmLoginEdit fLogEdit = new fmLoginEdit();

            fLogEdit.ShowDialog();
        }
Exemple #4
0
        private void gvRecap_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gvRecap.Columns[e.ColumnIndex].Name == "SupApproved")
            {
                UncheckApproval(e);
            }
            else if (gvRecap.Columns[e.ColumnIndex].Name == "OMApproved")
            {
                UncheckApproval(e);
            }
            else if (gvRecap.Columns[e.ColumnIndex].Name == "HOApproved")
            {
                UncheckApproval(e);
            }


            else if (gvRecap.Columns[e.ColumnIndex].Name == "SupApproved")
            {
                if (CommonProcs.CheckAccessLevel() < 9)
                {
                    MessageBox.Show("Not Authorized to approve Timesheet");
                    return;
                }

                ApproveBySuper(e);
                FillTotalsView();
            }
            else if (gvRecap.Columns[e.ColumnIndex].Name == "OMApproved")
            {
                if (CommonProcs.CheckAccessLevel() < 10)
                {
                    MessageBox.Show("Not Authorized to approve Timesheet");
                    return;
                }
                ApproveByOM(e);
                FillTotalsView();
            }
            else if (gvRecap.Columns[e.ColumnIndex].Name == "HOApproved")
            {
                if (CommonProcs.CheckAccessLevel() != 10)
                {
                    MessageBox.Show("Not Authorized to approve Timesheet");
                    return;
                }
                ApproveByHO(e);
                FillTotalsView();
            }
            else if (gvRecap.Columns[e.ColumnIndex].Name == "view")
            {
                ShowTimesheet();
            }
        }
Exemple #5
0
        private void btnAddHours_Click(object sender, EventArgs e)
        {
            if (GetCurrentBranch() == "AA")
            {
                MessageBox.Show("Cannot add Timesheet items when selected branch is ShowAll");
                return;
            }
            if (tbRegHours.Text != string.Empty)
            {
                TimeSheet ts = new TimeSheet();
                ts.EmployeeID    = int.Parse(cbEmployee.SelectedValue.ToString());
                ts.CustomerID    = int.Parse(cbCustomer.SelectedValue.ToString());
                ts.ClassID       = int.Parse(cbClassEquip.SelectedValue.ToString());
                ts.RegHours      = decimal.Parse(tbRegHours.Text);
                ts.PayrollItemID = int.Parse(cbPayrollItem.SelectedValue.ToString());
                ts.WorkDate      = dtpDateWorked.Value;
                ts.WeekEnding    = dtpWeekEnding.Value;
                ts.FacID         = int.Parse(cbFac.SelectedValue.ToString());
                ts.AreaID        = int.Parse(cbArea.SelectedValue.ToString());
                ts.Notes         = noteText;
                ts.SupApprove    = false;
                ts.OMApprove     = false;
                ts.HOApprove     = false;
                ts.TimesheetID   = new ModelToSQL <TimeSheet>().WriteInsertSQL("Timesheet", ts, "TimesheetID", CommonProcs.WCompanyConnStr);
            }
            if (tbOTHours.Text != string.Empty)
            {
                TimeSheet ts = new TimeSheet();
                ts.EmployeeID = int.Parse(cbEmployee.SelectedValue.ToString());
                ts.CustomerID = int.Parse(cbCustomer.SelectedValue.ToString());
                ts.ClassID    = int.Parse(cbClassEquip.SelectedValue.ToString());

                ts.OTHours = decimal.Parse(tbOTHours.Text);

                ts.PayrollItemID = GetOTPayrollItem(cbPayrollItem.SelectedValue.ToString());

                ts.WorkDate    = dtpDateWorked.Value;
                ts.WeekEnding  = dtpWeekEnding.Value;
                ts.FacID       = int.Parse(cbFac.SelectedValue.ToString());
                ts.AreaID      = int.Parse(cbArea.SelectedValue.ToString());
                ts.Notes       = noteText;
                ts.SupApprove  = false;
                ts.OMApprove   = false;
                ts.HOApprove   = false;
                ts.TimesheetID = new ModelToSQL <TimeSheet>().WriteInsertSQL("Timesheet", ts, "TimesheetID", CommonProcs.WCompanyConnStr);
            }

            FillGridView(true);
            LoadAreaCombo(CommonProcs.GetFacList(GetCurrentBranch()));
            dtpDateWorked.Value = dtpDateWorked.Value.AddDays(1);
            dtpDateWorked.Focus();
        }
Exemple #6
0
        //private void btnCheckSup_Click(object sender, EventArgs e)
        //{
        //    CheckAll("SUP");
        //}

        //private void btnCheckOM_Click(object sender, EventArgs e)
        //{
        //    CheckAll("OM");
        //}

        //private void btnCheckHO_Click(object sender, EventArgs e)
        //{
        //    CheckAll("HO");
        //}
        private void CheckAll(string btnName, bool checkedAll)
        {
            string checkVal = "1";

            if (checkedAll)
            {
                checkVal = "0";
            }
            switch (btnName)
            {
            case "SUP":
                if (CommonProcs.CheckAccessLevel() < 9)
                {
                    MessageBox.Show("Not Authorized to approve Timesheet");
                    return;
                }
                break;

            case "OM":
                if (CommonProcs.CheckAccessLevel() < 10)
                {
                    MessageBox.Show("Not Authorized to approve Timesheet");
                    return;
                }

                break;
                //case "HO":
                //    if (CommonProcs.CheckAccessLevel() != 10)
                //    {
                //        MessageBox.Show("Not Authorized to approve Timesheet");
                //        return;
                //    }

                //    break;
            }
            ApproveAll(btnName, checkVal);
            FillTotalsView();
        }
Exemple #7
0
        private void fmMain_Load(object sender, EventArgs e)
        {
            isLoading = true;
            fmLogin fLogin = new fmLogin();

            if (!System.IO.File.Exists(@"C:\PowerCranes\user.txt"))
            {
                DialogResult = fLogin.ShowDialog();
            }
            lblWeekEnding.Text  = CommonProcs.GetWeekEnding(DateTime.Now).ToShortDateString();
            dtpWeekEnding.Value = CommonProcs.GetWeekEnding(DateTime.Now);
            accessLevel         = int.Parse(MyConfig.ReadValue("accessLevel"));
            branch = int.Parse(MyConfig.ReadValue("branch"));
            Text   = "Timesheet Entry v." + Application.ProductVersion;
            cbBranch.SelectedIndex = branch + 1;
            ShowCurrentUser();
            LoadBranchCombos();

            isLoading = false;
            cbCompany.SelectedIndex    = 0;
            tbTabs.TabPages[1].Enabled = CheckCompleteForRecap();
            SetAccessFromAccessLevel(accessLevel);
            FillGridView(false);
        }
Exemple #8
0
 private void dtpWeekEnding_ValueChanged(object sender, EventArgs e)
 {
     lblWeekEnding.Text         = CommonProcs.GetWeekEnding(dtpWeekEnding.Value).ToShortDateString();
     tbTabs.TabPages[1].Enabled = CheckCompleteForRecap();
 }