public Color ColorCell(float v, short daycode, EKind1 kind1) { if (SomeDataDefs.IsKindPlan(kind1)) { var daycodeplan = (EDayPlanId)daycode; switch (daycodeplan) { case EDayPlanId.BD: return(FreeDay); case EDayPlanId.SD: case EDayPlanId.SDDD: case EDayPlanId.DDSD: return(HolyDay); default: return(Color.Empty); } } else { var daycodefact = (EDayFactId)daycode; if (SomeDataDefs.IsDayVacation(daycodefact)) { return(VacationDay); } if (SomeDataDefs.IsSickDay(daycodefact)) { return(SickDay); } if (daycodefact == EDayFactId.B) { return(FreeDay); } if (daycodefact == EDayFactId.S || daycodefact == EDayFactId.DS || daycodefact == EDayFactId.KS || daycodefact == EDayFactId.V) { return(HolyDay); } return(Color.Empty); } }
public ErrorList CheckDays(SalaryInfo wt, DateTime dt1, DateTime dt2, int idp) { var error_list = new ErrorList(); string errstr = string.Format("{0}.{1}", dt1.Year, dt1.Month); int i, j; int i1 = dt1.Day; int i2 = dt2.Day; EDayPlanId daycodeplan = EDayPlanId.None; EDayFactId daycodefact = EDayFactId.None; EDayPlanId daycodeplan2 = EDayPlanId.None; EDayFactId daycodefact2 = EDayFactId.None; bool iscodeset; for (i = i1; i <= i2; i++) { iscodeset = false; for (j = 0; j < this.Count; j++) { daycodeplan = this[j].Plan.DxPlan[i - 1]; if (!iscodeset) { daycodeplan2 = daycodeplan; iscodeset = true; continue; } if (daycodeplan != daycodeplan2) { var errs = string.Format("{0} nesakrīt darba laika plāna dati dažādiem amatiem dienai: {1}", errstr, i); error_list.AddPersonError(idp, errs); } } iscodeset = false; for (j = 0; j < this.Count; j++) { daycodefact = this[j].Fact.DxFact[i - 1]; daycodeplan = this[j].Plan.DxPlan[i - 1]; if (daycodefact == EDayFactId.X || daycodefact == EDayFactId.None) { continue; } if (!iscodeset) { daycodefact2 = daycodefact; daycodeplan2 = daycodeplan; iscodeset = true; if (!SomeDataDefs.CanPlanHaveFact(daycodeplan, daycodefact)) { var errs = string.Format("{0} nekorekts faktiski nostrādās dienas kods: {1}", errstr, i); error_list.AddPersonError(idp, errs); } continue; } bool b1 = SomeDataDefs.IsSickDay(daycodefact) || SomeDataDefs.IsDayVacation(daycodefact) || daycodefact == EDayFactId.V; bool b2 = SomeDataDefs.IsSickDay(daycodefact2) || SomeDataDefs.IsDayVacation(daycodefact2) || daycodefact2 == EDayFactId.V; if (b1 != b2) { var errs = string.Format("{0} nesakrīt darba laika dati dažādiem amatiem dienai: {1}", errstr, i); error_list.AddPersonError(idp, errs); } } } return(error_list); }