本文整理汇总了C#中HRM.Data.Entity.VnrHrmDataContext.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# VnrHrmDataContext.SaveChanges方法的具体用法?C# VnrHrmDataContext.SaveChanges怎么用?C# VnrHrmDataContext.SaveChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HRM.Data.Entity.VnrHrmDataContext
的用法示例。
在下文中一共展示了VnrHrmDataContext.SaveChanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
//.........这里部分代码省略.........
}).ToList();
var listRosterGroupEntity = lstRosterGroup.Select(d => new Att_RosterGroupEntity
{
ID = d.ID,
DateEnd = d.DateEnd,
DateStart = d.DateStart,
MonShiftID = d.MonShiftID,
TueShiftID = d.TueShiftID,
WedShiftID = d.WedShiftID,
ThuShiftID = d.ThuShiftID,
FriShiftID = d.FriShiftID,
SatShiftID = d.SatShiftID,
SunShiftID = d.SunShiftID,
RosterGroupName = d.RosterGroupName
}).ToList();
Dictionary<DateTime, Cat_Shift> listMonthShifts = Att_AttendanceLib.GetDailyShifts(profile.ID, dateStart, dateEnd, listRosterEntity, listRosterGroupEntity, shifts);
for (DateTime date = dateStart; date <= dateEnd; date = date.AddDays(1))
{
var leavdayProfiles = leaveDays.Where(s => s.DateStart.Date <= date.Date && date.Date <= s.DateEnd.Date && s.ProfileID == profile.ID).ToList();
if (leavdayProfiles.Count > 0)
{
bool isWorkDay = gradeCfg != null && Att_WorkDayHelper.IsWorkDay(date, gradeCfg, listMonthShifts, listHoliday);
var leaveday = leavdayProfiles.FirstOrDefault(s => ledvedayPaidIds.Contains(s.LeaveDayTypeID));
if (!isWorkDay)// neu ngay do ko phai ngay di lam
{
if (leaveday != null && leaveDayTypeRejectIDs.Contains(leaveday.LeaveDayTypeID) || listHoliday.Exists(s => s.DateOff == date))// neu ngay do la ngay nghi dc xem la ko xem ca or ngay nghi
{
isWorkDay = true;
}
}
if (isWorkDay)
{
var workDay = workDays.FirstOrDefault(s => s.ProfileID == profile.ID && s.WorkDate.Date == date.Date);
DataRow row = table.NewRow();
Guid? orgId = profile.OrgStructureID;
var org = orgs.FirstOrDefault(s => s.ID == profile.OrgStructureID);
var orgBranch = LibraryService.GetNearestParent(orgId, OrgUnit.E_BRANCH, orgs, orgTypes);
var orgOrg = LibraryService.GetNearestParent(orgId, OrgUnit.E_DEPARTMENT, orgs, orgTypes);
var orgTeam = LibraryService.GetNearestParent(orgId, OrgUnit.E_TEAM, orgs, orgTypes);
var orgSection = LibraryService.GetNearestParent(orgId, OrgUnit.E_SECTION, orgs, orgTypes);
row[Att_LeaveDayEntity.FieldNames.CodeBranch] = orgBranch != null ? orgBranch.Code : string.Empty;
row[Att_LeaveDayEntity.FieldNames.CodeOrg] = orgOrg != null ? orgOrg.Code : string.Empty;
row[Att_LeaveDayEntity.FieldNames.CodeTeam] = orgTeam != null ? orgTeam.Code : string.Empty;
row[Att_LeaveDayEntity.FieldNames.CodeSection] = orgSection != null ? orgSection.Code : string.Empty;
row[Att_LeaveDayEntity.FieldNames.BranchName] = orgBranch != null ? orgBranch.OrgStructureName : string.Empty;
row[Att_LeaveDayEntity.FieldNames.OrgName] = orgOrg != null ? orgOrg.OrgStructureName : string.Empty;
row[Att_LeaveDayEntity.FieldNames.TeamName] = orgTeam != null ? orgTeam.OrgStructureName : string.Empty;
row[Att_LeaveDayEntity.FieldNames.SectionName] = orgSection != null ? orgSection.OrgStructureName : string.Empty;
var positon = positions.FirstOrDefault(s => s.ID == profile.PositionID);
var jobtitle = jobtitles.FirstOrDefault(s => s.ID == profile.JobTitleID);
row[Att_LeaveDayEntity.FieldNames.ProfileName] = profile.ProfileName;
row[Att_LeaveDayEntity.FieldNames.CodeEmp] = profile.CodeEmp;
row[Att_LeaveDayEntity.FieldNames.CodePosition] = positon != null ? positon.Code : string.Empty;
row[Att_LeaveDayEntity.FieldNames.CodeJobtitle] = jobtitle != null ? jobtitle.Code : string.Empty;
var shift = shifts.FirstOrDefault(s => workDay != null && s.ID == workDay.ShiftID);
row[Att_LeaveDayEntity.FieldNames.Date] = date;
row[Att_LeaveDayEntity.FieldNames.DateFrom] = dateStart;
row[Att_LeaveDayEntity.FieldNames.DateTo] = dateEnd;
row[Att_LeaveDayEntity.FieldNames.DateExport] = DateTime.Now;
//row[Att_LeavedayEntity.FieldNames.UserExport] = Session[SessionObjects.UserLogin];
if (leaveday != null && leaveday.LeaveDays > 0)
{
row["Paid"] = "X";
}
if (workDay != null)
{
row[Att_LeaveDayEntity.FieldNames.Cat_Shift] = shift.ShiftName;
row[Att_LeaveDayEntity.FieldNames.udInTime] = workDay.InTime1 != null ? workDay.InTime1.Value.ToString("HH:mm") : string.Empty;
row[Att_LeaveDayEntity.FieldNames.udOutTime] = workDay.OutTime1 != null ? workDay.OutTime1.Value.ToString("HH:mm") : string.Empty;
}
foreach (var leaday in leavedayTypes)
{
var leaday1 = leavdayProfiles.FirstOrDefault(s => s.LeaveDayTypeID == leaday.ID);
if (leaday1 != null && leaday1.LeaveDays > 0)
{
row[leaday.Code] = "X";
}
}
if (leaveday != null)
{
row[Att_LeaveDayEntity.FieldNames.Status] = leaveday.Status;
}
table.Rows.Add(row);
}
}
}
}
//EntityService.SubmitChanges(GuidContext, LoginUserID.Value);
context.SaveChanges();
return table;
}
}