/// <summary>
 /// Create a new AttMnDataPer object.
 /// </summary>
 /// <param name="empMonth">Initial value of the EmpMonth property.</param>
 public static AttMnDataPer CreateAttMnDataPer(global::System.String empMonth)
 {
     AttMnDataPer attMnDataPer = new AttMnDataPer();
     attMnDataPer.EmpMonth = empMonth;
     return attMnDataPer;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the AttMnDataPers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAttMnDataPers(AttMnDataPer attMnDataPer)
 {
     base.AddObject("AttMnDataPers", attMnDataPer);
 }
        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.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 = 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;
        }