private IList <ImperativeUndermanagementInfoProxy> ConvertToImperativeUndermanagementInfoProxy(IList <Person> personList, ImperativeRequest imperativeRequest, int pageSize, int pageIndex) { IList <ImperativeUndermanagementInfoProxy> imperativeUndermanagementInfoProxyList = new List <ImperativeUndermanagementInfoProxy>(); IList <UnderManagementPerson> underManagementPersonList = new List <UnderManagementPerson>(); DateTime date = DateTime.Now; switch (BLanguage.CurrentSystemLanguage) { case LanguagesName.Parsi: date = Utility.ToMildiDate(String.Format("{0}/{1}/1", imperativeRequest.Year, imperativeRequest.Month)); break; case LanguagesName.English: date = new DateTime(imperativeRequest.Year, imperativeRequest.Month, 1); break; } underManagementPersonList = managerRepository.GetUnderManagment(imperativeRequest.Month, imperativeRequest.Month > 0 ? 0 : Utility.ToDateRangeIndex(date, BLanguage.CurrentSystemLanguage), date.ToString("yyyy/MM/dd"), personList.Select(person => person.ID).ToList <decimal>(), pageIndex, pageSize); foreach (UnderManagementPerson underManagementPersonItem in underManagementPersonList) { ImperativeUndermanagementInfoProxy imperativeUndermanagementInfoProxy = new ImperativeUndermanagementInfoProxy(); imperativeUndermanagementInfoProxy.PersonID = underManagementPersonItem.PersonId; imperativeUndermanagementInfoProxy.PersonName = underManagementPersonItem.PersonName; imperativeUndermanagementInfoProxy.PersonCode = underManagementPersonItem.BarCode; imperativeUndermanagementInfoProxy.PersonImage = this.personBusiness.GetByID(underManagementPersonItem.PersonId).PersonDetail.Image; imperativeRequest.Person = new Person() { ID = underManagementPersonItem.PersonId }; ImperativeRequest impReq = this.imperativeRequestRepository.GetImperativeRequest(imperativeRequest); if (impReq != null) { imperativeUndermanagementInfoProxy.ImperativeValue = impReq.Value; imperativeUndermanagementInfoProxy.IsLockedImperative = impReq.IsLocked; imperativeUndermanagementInfoProxy.ImperativeDescription = impReq.Description; } else { imperativeUndermanagementInfoProxy.ImperativeValue = 0; imperativeUndermanagementInfoProxy.IsLockedImperative = false; imperativeUndermanagementInfoProxy.ImperativeDescription = string.Empty; } imperativeUndermanagementInfoProxy.CalcInfo = new CalcInfoProxy() { DailyAbsence = underManagementPersonItem.DailyAbsence, DailyLeave = underManagementPersonItem.DailyMeritoriouslyLeave, HourlyAbsence = underManagementPersonItem.HourlyUnallowableAbsence, HourlyLeave = underManagementPersonItem.HourlyMeritoriouslyLeave, OverTime = underManagementPersonItem.AllowableOverTime }; imperativeUndermanagementInfoProxyList.Add(imperativeUndermanagementInfoProxy); } return(imperativeUndermanagementInfoProxyList); }
private IList <ImperativeUndermanagementInfoProxy> ConvertToImperativeUndermanagementInfoProxy(IList <Person> personList, ImperativeRequest imperativeRequest, int pageSize, int pageIndex) { IList <ImperativeUndermanagementInfoProxy> imperativeUndermanagementInfoProxyList = new List <ImperativeUndermanagementInfoProxy>(); IList <UnderManagementPerson> underManagementPersonList = new List <UnderManagementPerson>(); DateTime date = DateTime.Now; switch (BLanguage.CurrentSystemLanguage) { case LanguagesName.Parsi: date = Utility.ToMildiDate(String.Format("{0}/{1}/1", imperativeRequest.Year, imperativeRequest.Month)); break; case LanguagesName.English: date = new DateTime(imperativeRequest.Year, imperativeRequest.Month, 1); break; } underManagementPersonList = managerRepository.GetUnderManagment(imperativeRequest.Month, imperativeRequest.Month > 0 ? 0 : Utility.ToDateRangeIndex(date, BLanguage.CurrentSystemLanguage), date.ToString("yyyy/MM/dd"), personList.Select(person => person.ID).ToList <decimal>(), pageIndex, pageSize); foreach (UnderManagementPerson underManagementPersonItem in underManagementPersonList) { ImperativeUndermanagementInfoProxy imperativeUndermanagementInfoProxy = new ImperativeUndermanagementInfoProxy(); imperativeUndermanagementInfoProxy.PersonID = underManagementPersonItem.PersonId; imperativeUndermanagementInfoProxy.PersonName = underManagementPersonItem.PersonName; imperativeUndermanagementInfoProxy.PersonCode = underManagementPersonItem.BarCode; imperativeUndermanagementInfoProxy.PersonImage = this.personBusiness.GetByID(underManagementPersonItem.PersonId).PersonDetail.Image; imperativeRequest.Person = new Person() { ID = underManagementPersonItem.PersonId }; ImperativeRequest impReq = this.imperativeRequestRepository.GetImperativeRequest(imperativeRequest); if (impReq != null) { imperativeUndermanagementInfoProxy.ImperativeValue = impReq.Value; imperativeUndermanagementInfoProxy.IsLockedImperative = impReq.IsLocked; imperativeUndermanagementInfoProxy.ImperativeDescription = impReq.Description; } else { imperativeUndermanagementInfoProxy.ImperativeValue = 0; imperativeUndermanagementInfoProxy.IsLockedImperative = false; imperativeUndermanagementInfoProxy.ImperativeDescription = string.Empty; } IList <InfoPeriodicScndCnpValue> infoPeriodicScndCnpValueList = NHibernateSessionManager.Instance.GetSession().GetNamedQuery("GetPeriodicScndCnpValueList") .SetParameter("date", underManagementPersonItem.Date) .SetParameter("dateRangeOrderIndex", underManagementPersonItem.DateRangeOrderIndex) .SetParameter("dateRangeOrder", underManagementPersonItem.DateRangeOrder) .SetParameter("prsId", underManagementPersonItem.PersonId) .SetResultTransformer(Transformers.AliasToBean(typeof(InfoPeriodicScndCnpValue))) .List <InfoPeriodicScndCnpValue>(); string defaultValue = "0"; InfoPeriodicScndCnpValue ipscv_DailyAbsence = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_DailyAbsence") .FirstOrDefault(); InfoPeriodicScndCnpValue ipscv_DailyMeritoriouslyLeave = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_DailyMeritoriouslyLeave") .FirstOrDefault(); InfoPeriodicScndCnpValue ipscv_HourlyUnallowableAbsence = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_HourlyUnallowableAbsence") .FirstOrDefault(); InfoPeriodicScndCnpValue ipscv_HourlyMeritoriouslyLeave = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_HourlyMeritoriouslyLeave") .FirstOrDefault(); InfoPeriodicScndCnpValue ipscv_AllowableOverTime = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_AllowableOverTime") .FirstOrDefault(); InfoPeriodicScndCnpValue ipscv_AllowableFridayOverTime = infoPeriodicScndCnpValueList.Where(x => x.ScndCnpValue_KeyColumnName == "gridFields_HourlyPureAllowableOverTimeFriday") .FirstOrDefault(); imperativeUndermanagementInfoProxy.CalcInfo = new CalcInfoProxy() { DailyAbsence = ipscv_DailyAbsence != null ? ipscv_DailyAbsence == null ? defaultValue : ipscv_DailyAbsence.ScndCnpValue_PeriodicValue.ToString() : defaultValue, DailyLeave = ipscv_DailyMeritoriouslyLeave != null ? ipscv_DailyMeritoriouslyLeave == null ? defaultValue : ipscv_DailyMeritoriouslyLeave.ScndCnpValue_PeriodicValue.ToString() : defaultValue, HourlyAbsence = ipscv_HourlyUnallowableAbsence != null?Utility.IntTimeToTime(ipscv_HourlyUnallowableAbsence == null?int.Parse(defaultValue) : ipscv_HourlyUnallowableAbsence.ScndCnpValue_PeriodicValue) : defaultValue, HourlyLeave = ipscv_HourlyMeritoriouslyLeave != null?Utility.IntTimeToTime(ipscv_HourlyMeritoriouslyLeave == null?int.Parse(defaultValue) : ipscv_HourlyMeritoriouslyLeave.ScndCnpValue_PeriodicValue) : defaultValue, OverTime = ipscv_AllowableOverTime != null?Utility.IntTimeToTime(ipscv_AllowableOverTime == null?int.Parse(defaultValue) : ipscv_AllowableOverTime.ScndCnpValue_PeriodicValue) : defaultValue, FridayOverTime = ipscv_AllowableFridayOverTime != null?Utility.IntTimeToTime(ipscv_AllowableFridayOverTime == null?int.Parse(defaultValue) : ipscv_AllowableFridayOverTime.ScndCnpValue_PeriodicValue) : defaultValue }; imperativeUndermanagementInfoProxyList.Add(imperativeUndermanagementInfoProxy); } return(imperativeUndermanagementInfoProxyList); }