internal static void ProcessAttendanceRequestMonthly(DateTime Dts, DateTime Dte, string empID) { try { int days = (Dte - Dts).Days; if (days < 40) { int DaysInPreviousMonth = System.DateTime.DaysInMonth(Dts.Year, Dts.Month); if (Dts.Month != Dte.Month) { Dte = new DateTime(Dts.Year, Dts.Month, DaysInPreviousMonth); } using (var db = new HRMEntities()) { Att_ProcessRequest ap = new Att_ProcessRequest(); ap.PeriodTag = "M"; ap.DateFrom = Dts; ap.DateTo = Dte; ap.LocationID = db.HR_Location.FirstOrDefault().LocID; //ap.CatID = db.HR_Category.FirstOrDefault().CatID; ap.ProcessingDone = false; ap.Criteria = "E"; ap.ProcessCat = true; ap.UserID = 5; ap.CreatedDate = DateTime.Now.AddSeconds(2); ap.EmpID = Convert.ToInt32(empID); ap.EmpNo = empID; ap.SystemGenerated = true; // ap.ManualProcessed = true; db.Att_ProcessRequest.Add(ap); db.SaveChanges(); db.Dispose(); } } } catch (Exception ex) { } }
public static void ProcessAttendanceRequest(DateTime Dts, DateTime Dte, int EmpID, string EmpNo) { try { int days = (Dte - Dts).Days; if (days < 40) { if (Dte <= DateTime.Today) { using (var db = new HRMEntities()) { Att_ProcessRequest ap = new Att_ProcessRequest(); ap.PeriodTag = "D"; ap.DateFrom = Dts; ap.DateTo = Dte; ap.LocationID = db.HR_Location.FirstOrDefault().LocID; // ap.CatID = db.HR_Category.FirstOrDefault().CatID; ap.ProcessingDone = false; ap.Criteria = "E"; ap.ProcessCat = true; ap.UserID = 5; ap.CreatedDate = DateTime.Now; ap.EmpID = EmpID; ap.EmpNo = EmpNo; ap.SystemGenerated = true; // ap.ManualProcessed = true; db.Att_ProcessRequest.Add(ap); db.SaveChanges(); db.Dispose(); } } } } catch (Exception ex) { } }