Exemplo n.º 1
0
        private void LoadDRTEnrolleeId()
        {
            Cursor = Cursors.WaitCursor;
            if (listBoxEnrollees.Items.Count > 0)
            {
                textBoxName.Text = listBoxEnrollees.Text;
                iMonth           = toolStripComboBoxMonth.SelectedIndex + 1;
                iYear            = int.Parse(toolStripComboBoxDuration.Text);

                textBoxDepartment.Text = GetEnrolleeDepartment();
                textBoxPosition.Text   = GetEnrolleePosition();
                Miscellaneous misc = ActionClass.FillMiscellaneous().FirstOrDefault(mi => mi.MiscActive == true);

                int      iEnrolleeId = ((JEnrollee)listBoxEnrollees.SelectedItem).EnrolleeId;
                Enrollee enrollee    = ActionClass.GetEnrollee(iEnrolleeId);

                lDTRSource = DataManagementClass.LoadDTRViaDTR(enrollee, iMonth, iYear, ActionClass.FillDTRs(iEnrolleeId), misc);
                dTRsBindingSource.DataSource = lDTRSource;

                ExecuteSaveDTRThread(); // loop to save dtr.

                MarkUnderOverTimeHours();
            }
            Cursor = Cursors.Default;
        }
Exemplo n.º 2
0
        private void ReportEnrolleeForm_Load(object sender, EventArgs e)
        {
            ReportParameter p1 = new ReportParameter("CompanyNamez", SCompanyName);

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1 });

            JEnrolleeBindingSource.DataSource = DataManagementClass.LoadEnrolleesAll();
            this.reportViewer1.RefreshReport();
        }
Exemplo n.º 3
0
 private void buttonGo_Click(object sender, EventArgs e)
 {
     if (textBoxSearch.Text.Length > 0)
     {
         jEnrolleeBindingSource.DataSource = DataManagementClass.LoadEnrollees(textBoxSearch.Text.Trim());
         listBoxEnrollees.DataSource       = jEnrolleeBindingSource;
         toolStripStatusLabel1.Text        = jEnrolleeBindingSource.Count.ToString() + " enrollees loaded.";
     }
 }
Exemplo n.º 4
0
        private void LoadEnrollees(bool bDepartment)
        {
            Cursor = Cursors.WaitCursor;
            List <JEnrollee> lEnrollee = bDepartment ? DataManagementClass.LoadEnrollees(true, iDepartmentId) : DataManagementClass.LoadEnrollees();

            jEnrolleeBindingSource.DataSource = lEnrollee;
            listBoxEnrollees.DataSource       = lEnrollee;
            toolStripStatusLabel1.Text        = String.Format("{0} enrollee(s) loaded.", lEnrollee.Count);
            Cursor = Cursors.Default;
        }
Exemplo n.º 5
0
        private void toolStripButtonGo_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            int  iMonth   = toolStripComboBoxMonth.SelectedIndex + 1;
            int  iYear    = int.Parse(toolStripComboBoxYear.Text);
            bool bSource  = toolStripComboBox1.SelectedIndex == 0 ? false : true;
            var  listJDTR = new JSortingListClass <JDTRClass>(DataManagementClass.LoadDTRUpdated(iYear, iMonth, bSource));

            jDTRClassBindingSource.DataSource = listJDTR;
            Cursor = Cursors.Default;
        }
Exemplo n.º 6
0
 private void textBoxSearch_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (textBoxSearch.Text.Length > 0)
         {
             jEnrolleeBindingSource.DataSource = DataManagementClass.LoadEnrollees(textBoxSearch.Text.Trim());
             listBoxEnrollees.DataSource       = jEnrolleeBindingSource;
             toolStripStatusLabel1.Text        = jEnrolleeBindingSource.Count.ToString() + " enrollees loaded.";
         }
     }
 }
Exemplo n.º 7
0
        private void LoadEnrollees(bool bDepartment)
        {
            Cursor = Cursors.WaitCursor;
            List <JEnrollee> lEnrollee = bDepartment ? DataManagementClass.LoadEnrollees(true, iDepartmentId) : DataManagementClass.LoadEnrollees();

            jEnrolleeBindingSource1.DataSource = lEnrollee;
            //listBox2.DataSource = listEnrollee;
            //listBox2.DisplayMember = "GetFullName";
            //listBox2.ValueMember = "EnrolleeNo";
            toolStripStatusLabel1.Text = String.Format("{0} enrollee(s) loaded.", listEnrollee.Count);
            Cursor = Cursors.Default;
        }
        private void LoadDTROverUnder()
        {
            iMonth = toolStripComboBoxMonth.SelectedIndex + 1;
            iYear  = Convert.ToInt16(toolStripComboBoxYear.Text);

            var p1 = new ReportParameter("Duration", toolStripComboBoxMonth.Text + " " + toolStripComboBoxYear.Text);
            var p2 = new ReportParameter("CompanyNamez", SCompanyName);

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });

            JDTRClassBindingSource.DataSource = DataManagementClass.LoadDTROverUnder(iYear, iMonth);
            this.reportViewer1.RefreshReport();
        }
Exemplo n.º 9
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            lDTR = DataManagementClass.LoadDTRViaLogs(OEnrollee, IMonth, IYear, out lDumpLogs);
            var dtDate = new Comparison <DTR>(DataManagementClass.CompareDTRDate);

            lDTR.Sort(dtDate);
            dTRBindingSource.DataSource = lDTR;
            toolStripStatusLabel1.Text  = "(" + dTRBindingSource.Count.ToString() + ") valid and " +
                                          lDumpLogs.Count.ToString() + " delinquent logs loaded.";

            toolStripButtonDelinquent.Enabled   = lDumpLogs.Count > 0;
            dTRBindingNavigatorSaveItem.Enabled = lDTR.Count > 0;
        }
Exemplo n.º 10
0
        private void LoadDRTEnrollee(JEnrollee en, Miscellaneous misc)
        {
            Cursor = Cursors.WaitCursor;
            if (listBox1.Items.Count > 0)
            {
                var      eName    = en.GetFullName;
                Enrollee enrollee = ActionClass.GetEnrollee(en.EnrolleeId);

                List <JDTR> lDTRSource01 = DataManagementClass.LoadDTRViaDTRBatch(enrollee, iMonth, iStartDay, iEndDay, iYear, ActionClass.FillDTRs(en.EnrolleeId), misc, eName, labelDuration.Text);

                lDTRSource.AddRange(lDTRSource01);
            }
            Cursor = Cursors.Default;
        }
Exemplo n.º 11
0
        private void LoadEnrollees(bool bDepartment)
        {
            List <ObjectManager.JEnrollee> listEnrollee = bDepartment ? DataManagementClass.LoadEnrollees(true, iDepartmentId) : DataManagementClass.LoadEnrollees();

            //checkedListBox1.Items.Clear();
            checkedListBox1.DataSource    = listEnrollee;
            checkedListBox1.DisplayMember = "GetFullName";
            checkedListBox1.ValueMember   = "EnrolleeNo";
            //foreach (var enrollee in listEnrollee)
            //{
            //    checkedListBox1.DataSource = listEnrollee;
            //    checkedListBox1.Items.Add(String.Format("{0}, {1} {2}.", enrollee.LastName.Trim().ToUpper(),
            //                                            enrollee.FirstName.Trim(), enrollee.MiddleName.Substring(0, 1)));

            //}
        }
Exemplo n.º 12
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                string sUserName = textBoxUserName.Text.Trim();
                string sPassword = textBoxPassword.Text.Trim();

                if ((sUserName.Length > 0) && (sPassword.Length > 0))
                {
                    User u = DataManagementClass.GetUserViaUserNamePass(sUserName, sPassword);
                    if ((u != null) && (u.Active == true))
                    {
                        Company company = ActionClass.GetCompanyActive();
                        labelCompany.Text = company.CompanyName.ToUpper();
                        Application.DoEvents();
                        Thread.Sleep(2000);
                        AttendanceKeeper.MianForm mf = new MianForm();
                        mf.OUser     = u;
                        mf.OCompany  = company;
                        mf.IUserId   = u.UserId;
                        mf.SUserName = u.UserName;
                        mf.SLevel    = u.Level;
                        mf.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Access Denied. You need to have a valid account to access.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occured, please contact system administrator.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                Console.WriteLine("Error - " + ex.Message);
                //throw;
            }
            Cursor = Cursors.Default;
        }
Exemplo n.º 13
0
        private void InitComponents()
        {
            var lDates = UtilityClass.FillMonth();

            toolStripComboBoxMonth.Items.Clear();
            foreach (var list in lDates)
            {
                toolStripComboBoxMonth.Items.Add(list);
            }

            var lYears = UtilityClass.FillYear();

            toolStripComboBoxDuration.Items.Clear();
            foreach (var year in lYears)
            {
                toolStripComboBoxDuration.Items.Add(year);
            }

            toolStripComboBoxMonth.SelectedIndex    = DateTime.Today.Month - 1;
            toolStripComboBoxDuration.SelectedIndex = 0;
            listBoxEnrollees.DataSource             = DataManagementClass.LoadEnrollees();
            toolStripStatusLabel1.Text = jEnrolleeBindingSource.Count.ToString() + " enrollees loaded.";
            labelCompanyName.Text      = SCompanyName;
        }
Exemplo n.º 14
0
        private void SaveLogsToDbase(int iMacInstanceId)
        {
            label1.Text = @"Preparing to port data to database...";
            Thread.Sleep(100);
            Application.DoEvents();
            if (lLogs != null)
            {
                try
                {
                    foreach (var mac in lMac)
                    {
                        mac.MachineInsId = iMacInstanceId;
                    }

                    Thread.Sleep(200);
                    label1.Text = @"Saving logs to database...";
                    Thread.Sleep(200);
                    Application.DoEvents();

                    if (lMac.Count > 0)
                    {
                        int iResult = ActionClass.SaveMachine(lMac);
                        if (iResult > 0)
                        {
                            label1.Text = @"Processing DTR for all enrollees.";
                            Thread.Sleep(200);
                            Application.DoEvents();
                            List <MacDumpLog> listMacDump;
                            List <DTR>        listDTR =
                                DataManagementClass.LoadEnrolleeAttendanceDTRAll(ActionClass.FillEnrollees(true),
                                                                                 out listMacDump, SUserName);
                            if (listDTR.Count > 0)
                            {
                                try
                                {
                                    label1.Text = @"Saving DTR for all enrollees.";
                                    Thread.Sleep(200);
                                    Application.DoEvents();
                                    int iDTRResult = ActionClass.SaveDTR(listDTR);

                                    if (listMacDump.Count > 0)
                                    {
                                        foreach (var macDumpLog in listMacDump)
                                        {
                                            macDumpLog.MachineInsId = iMacInstanceId;
                                        }
                                        int iMacDumoLog = ActionClass.SaveMacDumpLogAll(listMacDump);
                                    }
                                    label1.Text = @"Saving data to database successfull.";
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(@"Error - " + ex.Message);
                                    label1.Text = @"An Error Occured while processing data.";
                                    //throw;
                                }
                            }
                        }
                        else
                        {
                            label1.Text = @"Error encountered.";
                        }
                        label1.Text = @"Saving data to database successfull.";
                    }
                    else
                    {
                        label1.Text = @"Record already exists.";
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(@"Error - " + ex.Message);
                    //throw;
                }
            }
        }
Exemplo n.º 15
0
 private void InitComponents()
 {
     jLeaveClassBindingSource.DataSource = DataManagementClass.LoadLeaves();
     labelCompanyName.Text = SCompanyName;
 }