コード例 #1
0
        private void LoadDRTEnrolleeId()
        {
            Cursor = Cursors.WaitCursor;
            //try catch here
            if (listBox1.Items.Count > 0)
            {
                _iEnrolleeId = ((EmployeeData)listBox1.SelectedItem).EnrolleeId;
                var enrollee = EmployeeManager.Get(_iEnrolleeId);
                var position = PositionManager.Get(enrollee.PositionId);

                if (position != null)
                {
                    _principal        = position.PositionName?.Substring(0, 3).ToUpper() ?? @"NO";
                    _employeePosition = position.PositionName;
                }

                _employeeName = String.Format(@"{0} {1}. {2}", enrollee.EmployeeFirstName,
                                              enrollee.EmployeeMiddleName.Substring(0, 1), enrollee.EmployeeLastName);
                labelEmployee.Text = String.Format(@"{0} - ({1})", _employeeName, _employeePosition);

                _listDTR = DTRManagement.LoadDTRViaDTR(enrollee, _iMonth, _iYear, DTRManager.GetAll(_iEnrolleeId), out _setting);
                dTRBindingSource.DataSource = _listDTR;

                ExecuteSaveDTRThread(); // loop to save dtr.

                MarkUnderOverTimeHours();
            }
            Cursor = Cursors.Default;
        }
コード例 #2
0
ファイル: DTRForm.cs プロジェクト: techrepublik/atttt
 private void dTRDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     //if (User.UserLevel == 3)
     //{
     //    labelSuper.Text = @"Note: Authorized User.";
     //    labelSuper.ForeColor = Color.Green;
     if (dTRBindingSource?.Current == null)
     {
         return;
     }
     if (dTRDataGridView.Rows.Count > 0)
     {
         if (dTRDataGridView.IsCurrentRowDirty)
         {
             Validate();
             ((DTR)dTRBindingSource.Current).IsSource   = true;
             ((DTR)dTRBindingSource.Current).EditedBy   = User.UserName;
             ((DTR)dTRBindingSource.Current).EditedOn   = DateTime.Now;
             ((DTR)dTRBindingSource.Current).EmployeeId = ((EmployeeData)listBox1.SelectedItem).EnrolleeId;
             ((DTR)dTRBindingSource.Current).EmployeeNo = ((EmployeeData)listBox1.SelectedItem).EnrolleeNo;
             dTRBindingSource.EndEdit();
             var iResult = DTRManager.Save((DTR)dTRBindingSource.Current);
             Console.WriteLine(iResult > 0 ? @"Row Saved." : @"Row Save Error.");
         }
     }
     //}
     //else
     //{
     //    dTRDataGridView.CancelEdit();
     //    labelSuper.Text = @"Note: User is not authorized to modify record(s).";
     //    labelSuper.ForeColor = Color.Red;
     //}
 }
コード例 #3
0
 private void SaveDTR()
 {
     foreach (var dtr in _listDTR)
     {
         if (dtr.DTRId > 0)
         {
             int iResult = DTRManager.Save(dtr);
             if (iResult > 0)
             {
                 Console.WriteLine(dtr.DTRId.ToString() + " " + dtr.DTRDay);
             }
         }
     }
 }
コード例 #4
0
 private void dTRDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     if (dTRBindingSource?.Current == null)
     {
         return;
     }
     if (dTRDataGridView.Rows.Count > 0)
     {
         if (dTRDataGridView.IsCurrentRowDirty)
         {
             Validate();
             ((DTR)dTRBindingSource.Current).IsSource   = true;
             ((DTR)dTRBindingSource.Current).EditedBy   = User.UserName;
             ((DTR)dTRBindingSource.Current).EditedOn   = DateTime.Now;
             ((DTR)dTRBindingSource.Current).EmployeeId = ((EmployeeData)listBox1.SelectedItem).EnrolleeId;
             ((DTR)dTRBindingSource.Current).EmployeeNo = ((EmployeeData)listBox1.SelectedItem).EnrolleeNo;
             dTRBindingSource.EndEdit();
             var iResult = DTRManager.Save((DTR)dTRBindingSource.Current);
             Console.WriteLine(iResult > 0 ? @"Row Saved." : @"Row Save Error.");
         }
     }
 }
コード例 #5
0
ファイル: ReportWizardForm.cs プロジェクト: techrepublik/att
        private void LoadDRTEnrollee(EmployeeData en)
        {
            Cursor = Cursors.WaitCursor;
            if (listBox1.Items.Count > 0)
            {
                var     eName    = en.GetFullName;
                Empoyee enrollee = EmployeeManager.Get(en.EnrolleeId);

                List <DtrData> lDTRSource01 = DTRManagement.LoadDTRViaDTRBatch(enrollee, iMonth, iStartDay, iEndDay, iYear, DTRManager.GetAll(en.EnrolleeId), eName, labelDuration.Text);
                lDTRSource.AddRange(lDTRSource01 as IEnumerable <DtrData>);
            }
            Cursor = Cursors.Default;
        }
コード例 #6
0
ファイル: ImportLogForm.cs プロジェクト: techrepublik/att
        private void buttonSave_Click(object sender, EventArgs e)
        {
            var bSuccessfull = false;
            var setNme       = String.Format(@"USB{0}", DateTime.Now);

            Application.DoEvents();
            Thread.Sleep(200);
            machineInsNameTextBox.Text = setNme;
            //save machine instance
            var iResult = SaveMachineInstance();

            if (iResult <= 0)
            {
                return;
            }
            var listLogs = DTRManagement.RemoveDuplicateUsb(_listDat, iResult);
            var iiResult = MachineManager.Save(listLogs);

            if (iiResult <= 0)
            {
                return;
            }
            List <MacDumpLog> listMacDump;
            var listDTR = DTRManagement.LoadEnrolleeAttendanceDtrAll(EmployeeManager.GetAll(true),
                                                                     out listMacDump, User.UserName);

            //save DTR
            var iiiResult = DTRManager.Save(listDTR);

            if (iiiResult > 0)
            {
                bSuccessfull = true;
            }

            //save macDump
            if (listMacDump.Count > 0)
            {
                var tempMacDump = new List <MacDumpLog>();
                foreach (var dumpLog in listMacDump)
                {
                    if (dumpLog.MacDumpDate != null)
                    {
                        tempMacDump.Add(dumpLog);
                    }
                }
                var iiiiResult = MacDumpLogManager.Save(tempMacDump);
                if (iiiiResult > 0)
                {
                    Console.WriteLine(@"MacDump Successfully Record.");
                }
            }

            if (bSuccessfull)
            {
                MessageBox.Show(@"DTR Generated Successfully. Kindly Close the form and go to DTR Management",
                                @"Save - DTR", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(@"Error occured during save.",
                                @"Error Save - DTR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }