Example #1
0
        public bool processPermanentMonthlyAttSingle(DateTime startDate, DateTime endDate, Emp _Emp, List <AttData> _EmpAttData)
        {
            //Get Attendance data of employee according to selected month
            try
            {
                EmpAttData = _EmpAttData;
            }
            catch (Exception ex)
            {
                string _error = "";
                if (ex.InnerException.Message != null)
                {
                    _error = ex.InnerException.Message;
                }
                else
                {
                    _error = ex.Message;
                }
                _myHelperClass.WriteToLogFile("Exception at Contactual Monthly Process: " + _error);
                return(false);
            }
            string EmpMonth = _Emp.EmpID + endDate.Date.Month.ToString();

            //Check for already processed data
            if (context.AttMnDataPers.Where(aa => aa.EmpMonth == EmpMonth).Count() > 0)
            {
                AttMnDataPer _TempAttMn = context.AttMnDataPers.Where(aa => aa.EmpMonth == EmpMonth).FirstOrDefault();
                _attMonth                  = _TempAttMn;
                _attMonth.PreDays          = 0;
                _attMonth.WorkDays         = 0;
                _attMonth.AbDays           = 0;
                _attMonth.LeaveDays        = 0;
                _attMonth.OfficialDutyDays = 0;
                _attMonth.ExpectedWrkTime  = 0;
                _attMonth.GZDays           = 0;
                _attMonth.RestDays         = 0;
                _attMonth.TEarlyIn         = 0;
                _attMonth.TEarlyOut        = 0;
                _attMonth.TGZOT            = 0;
                _attMonth.TLateIn          = 0;
                _attMonth.TLateOut         = 0;
                _attMonth.TNOT             = 0;
                _attMonth.TotalDays        = 0;
                _attMonth.TWorkTime        = 0;
                _attMonth.OT1              = 0;
                _attMonth.OT2              = 0;
                _attMonth.OT3              = 0;
                _attMonth.OT4              = 0;
                _attMonth.OT5              = 0;
                _attMonth.OT6              = 0;
                _attMonth.OT7              = 0;
                _attMonth.OT8              = 0;
                _attMonth.OT9              = 0;
                _attMonth.OT10             = 0;
                _attMonth.OT11             = 0;
                _attMonth.OT12             = 0;
                _attMonth.OT13             = 0;
                _attMonth.OT14             = 0;
                _attMonth.OT15             = 0;
                _attMonth.OT16             = 0;
                _attMonth.OT17             = 0;
                _attMonth.OT18             = 0;
                _attMonth.OT19             = 0;
                _attMonth.OT20             = 0;
                _attMonth.OT21             = 0;
                _attMonth.OT22             = 0;
                _attMonth.OT23             = 0;
                _attMonth.OT24             = 0;
                _attMonth.OT25             = 0;
                _attMonth.OT26             = 0;
                _attMonth.OT27             = 0;
                _attMonth.OT28             = 0;
                _attMonth.OT29             = 0;
                _attMonth.OT30             = 0;
                _attMonth.OT31             = 0;
            }
            TDays       = 0;
            WorkDays    = 0;
            PresentDays = 0;
            AbsentDays  = 0;
            LeaveDays   = 0;
            RestDays    = 0;
            GZDays      = 0;
            EarlyIn     = 0;
            EarlyOut    = 0;
            LateIn      = 0;
            LateOut     = 0;
            WorkTime    = 0;
            NOT         = 0;
            GOT         = 0;
            TDays       = Convert.ToByte((endDate - startDate).Days + 1);
            CalculateMonthlyAttendanceSheet(EmpAttData);
            _attMonth.Period   = endDate.Date.Month.ToString() + endDate.Date.Year.ToString();
            _attMonth.EmpMonth = EmpMonth;
            _attMonth.EmpID    = _Emp.EmpID;
            _attMonth.EmpNo    = _Emp.EmpNo;
            _attMonth.EmpName  = _Emp.EmpName;
            try
            {
                if (context.AttMnDataPers.Where(aa => aa.EmpMonth == EmpMonth).Count() == 0)
                {
                    context.AttMnDataPers.AddObject(_attMonth);
                }
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                string _error = "";
                if (ex.InnerException.Message != null)
                {
                    _error = ex.InnerException.Message;
                }
                else
                {
                    _error = ex.Message;
                }
                _myHelperClass.WriteToLogFile("Exception at Contactual Monthly Process: " + _error);
                return(false);
            }
            return(true);
        }
Example #2
0
        public AttMnDataPer processPermanentMonthlyAttSingle(DateTime startDate, DateTime endDate, EmpView _Emp, List <AttData> _EmpAttData)
        {
            //Get Attendance data of employee according to selected month
            _attMonth = new AttMnDataPer();
            try
            {
                EmpAttData = _EmpAttData;
            }
            catch (Exception ex)
            {
            }
            string EmpMonth = _Emp.EmpID + endDate.Date.Month.ToString();

            //Check for already processed data
            _attMonth.StartDate        = startDate;
            _attMonth.EndDate          = endDate;
            _attMonth.PreDays          = 0;
            _attMonth.WorkDays         = 0;
            _attMonth.AbDays           = 0;
            _attMonth.LeaveDays        = 0;
            _attMonth.OfficialDutyDays = 0;
            _attMonth.ExpectedWrkTime  = 0;
            _attMonth.GZDays           = 0;
            _attMonth.RestDays         = 0;
            _attMonth.TEarlyIn         = 0;
            _attMonth.TEarlyOut        = 0;
            _attMonth.TGZOT            = 0;
            _attMonth.TLateIn          = 0;
            _attMonth.TLateOut         = 0;
            _attMonth.TNOT             = 0;
            _attMonth.TotalDays        = 0;
            _attMonth.TWorkTime        = 0;
            _attMonth.OT1  = 0;
            _attMonth.OT2  = 0;
            _attMonth.OT3  = 0;
            _attMonth.OT4  = 0;
            _attMonth.OT5  = 0;
            _attMonth.OT6  = 0;
            _attMonth.OT7  = 0;
            _attMonth.OT8  = 0;
            _attMonth.OT9  = 0;
            _attMonth.OT10 = 0;
            _attMonth.OT11 = 0;
            _attMonth.OT12 = 0;
            _attMonth.OT13 = 0;
            _attMonth.OT14 = 0;
            _attMonth.OT15 = 0;
            _attMonth.OT16 = 0;
            _attMonth.OT17 = 0;
            _attMonth.OT18 = 0;
            _attMonth.OT19 = 0;
            _attMonth.OT20 = 0;
            _attMonth.OT21 = 0;
            _attMonth.OT22 = 0;
            _attMonth.OT23 = 0;
            _attMonth.OT24 = 0;
            _attMonth.OT25 = 0;
            _attMonth.OT26 = 0;
            _attMonth.OT27 = 0;
            _attMonth.OT28 = 0;
            _attMonth.OT29 = 0;
            _attMonth.OT30 = 0;
            _attMonth.OT31 = 0;
            TDays          = 0;
            WorkDays       = 0;
            PresentDays    = 0;
            AbsentDays     = 0;
            LeaveDays      = 0;
            RestDays       = 0;
            GZDays         = 0;
            EarlyIn        = 0;
            EarlyOut       = 0;
            LateIn         = 0;
            LateOut        = 0;
            WorkTime       = 0;
            NOT            = 0;
            GOT            = 0;
            TDays          = Convert.ToByte((endDate - startDate).Days + 1);
            CalculateMonthlyAttendanceSheet(EmpAttData);
            _attMonth.Period   = endDate.Date.Month.ToString() + endDate.Date.Year.ToString();
            _attMonth.EmpMonth = EmpMonth;
            _attMonth.EmpID    = _Emp.EmpID;
            _attMonth.EmpNo    = _Emp.EmpNo;
            _attMonth.EmpName  = _Emp.EmpName;
            return(_attMonth);
        }