/// <summary>
 /// Create a new AttMnData object.
 /// </summary>
 /// <param name="empMonth">Initial value of the EmpMonth property.</param>
 public static AttMnData CreateAttMnData(global::System.String empMonth)
 {
     AttMnData attMnData = new AttMnData();
     attMnData.EmpMonth = empMonth;
     return attMnData;
 }
        public bool processContractualMonthlyAttSingle(DateTime startDate, DateTime endDate, Emp _Emp, List<AttData> _EmpAttData)
        {
            string EmpMonth = _Emp.EmpID + startDate.Date.Month.ToString();
            //Attendance data of employee for selected dates
            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;
            }
            //Check for already processed data
            if (context.AttMnDatas.Where(aa => aa.EmpMonth == EmpMonth).Count() > 0)
            {
                AttMnData _TempAttMn = context.AttMnDatas.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;
                _attMonth.L1 = null;
                _attMonth.L2 = null;
                _attMonth.L3 = null;
                _attMonth.L4 = null;
                _attMonth.L5 = null;
                _attMonth.L6 = null;
                _attMonth.L7 = null;
                _attMonth.L8 = null;
                _attMonth.L9 = null;
                _attMonth.L10 = null;
                _attMonth.L11 = null;
                _attMonth.L12 = null;
                _attMonth.L13 = null;
                _attMonth.L14 = null;
                _attMonth.L15 = null;
                _attMonth.L16 = null;
                _attMonth.L17 = null;
                _attMonth.L18 = null;
                _attMonth.L19 = null;
                _attMonth.L20 = null;
                _attMonth.L21 = null;
                _attMonth.L22 = null;
                _attMonth.L23 = null;
                _attMonth.L24 = null;
                _attMonth.L25 = null;
                _attMonth.L26 = null;
                _attMonth.L27 = null;
                _attMonth.L28 = null;
                _attMonth.L29 = null;
                _attMonth.L30 = null;
                _attMonth.L31 = null;

            }

            TDays = Convert.ToByte((endDate - startDate).Days + 1);
            List<LvData> _lvData = context.LvDatas.Where(aa => aa.AttDate >= startDate && aa.AttDate <= endDate).ToList();
            CalculateMonthlyAttendanceSheet(EmpAttData, _lvData);
            _attMonth.Period = startDate.Date.Month.ToString() + startDate.Date.Year.ToString();
            _attMonth.EmpMonth = _Emp.EmpID + startDate.Date.Month.ToString();
            _attMonth.EmpNo = _Emp.EmpNo;
            _attMonth.EmpID = _Emp.EmpID;
            _attMonth.EmpName = _Emp.EmpName;
            try
            {
                if (context.AttMnDatas.Where(aa => aa.EmpMonth == EmpMonth).Count() == 0)
                {
                    context.AttMnDatas.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 2: " + _error);
                return false;
            }
            return true;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the AttMnDatas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAttMnDatas(AttMnData attMnData)
 {
     base.AddObject("AttMnDatas", attMnData);
 }