protected override void InsertValidate(DesignedReportColumn obj) { UIValidationExceptions exception = new UIValidationExceptions(); Report reportObj = new BReport().GetByID(obj.Report.ID); DesignedReportTypeEnum designedReportType = reportObj.DesignedType.CustomCode; IList <DesignedReportColumn> designedReportColumnList = GetDesignedReportsColumnsByReportID(obj.Report.ID); if (obj.Concept == null && obj.PersonInfo == null && obj.Traffic == null && obj.PersonParam == null) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportColumnIsRequired, "ستونی جهت ثبت انتخاب نشده است.", ExceptionSrc)); } else if (designedReportType == DesignedReportTypeEnum.Person && (obj.Concept != null || obj.Traffic != null)) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportTypeIsNotSelected, "نوع گزارش پرسنلی است .از ستون مفاهیم نمی توانید انتخاب کنید.", ExceptionSrc)); } else if (obj.Traffic != null && obj.ColumnType == DesignedReportColumnType.Traffic && obj.Traffic.Key == DesignedReportTrafficKeyColumn.AllTraffic && designedReportColumnList.Where(d => d.Traffic != null).Count(d => d.Traffic.Key == DesignedReportTrafficKeyColumn.FirstTraffic || d.Traffic.Key == DesignedReportTrafficKeyColumn.LastTraffic) > 0) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportTrafficTypeIsConflicted, "ستون انتخابی مجاز نمی باشد.", ExceptionSrc)); } else if (obj.Traffic != null && obj.ColumnType == DesignedReportColumnType.Traffic && (obj.Traffic.Key == DesignedReportTrafficKeyColumn.FirstTraffic || obj.Traffic.Key == DesignedReportTrafficKeyColumn.LastTraffic) && designedReportColumnList.Where(d => d.Traffic != null).Count(d => d.Traffic.Key == DesignedReportTrafficKeyColumn.AllTraffic) > 0) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportTrafficTypeIsConflicted, "ستون انتخابی مجاز نمی باشد.", ExceptionSrc)); } else { IList <DesignedReportColumn> columnList = GetDesignedReportsColumnsByReportID(obj.Report.ID); foreach (DesignedReportColumn item in columnList) { if (item.Concept != null) { if (obj.Concept != null && item.Concept.ID == obj.Concept.ID) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportColumnIsRepeated, "ستون انتخابی تکراری می باشد.", ExceptionSrc)); } } else if (item.PersonInfo != null) { if (obj.PersonInfo != null && item.PersonInfo.ID == obj.PersonInfo.ID) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportColumnIsRepeated, "ستون انتخابی تکراری می باشد.", ExceptionSrc)); } } else if (obj.Traffic != null && item.Traffic != null) { if (item.Traffic.ID == obj.Traffic.ID) { exception.Add(new ValidationException(ExceptionResourceKeys.DesignedReportColumnIsRepeated, "ستون انتخابی تکراری می باشد.", ExceptionSrc)); } } } } if (exception.Count > 0) { throw exception; } }
public IList <DesignedColumnProxy> GetAllConceptAndTrafficColumnsByPeriodicType(ScndCnpPeriodicType priodicType, decimal reportId) { try { IList <SecondaryConcept> conceptList = new GTS.Clock.Business.Concept.BConcept().GetAllConceptByPeriodicType(priodicType).Where(c => c.KeyColumnName != null && c.KeyColumnName.Trim() != string.Empty && c.ShowInReport).ToList(); List <DesignedColumnProxy> conceptProxyList = new List <DesignedColumnProxy>(); foreach (SecondaryConcept item in conceptList) { DesignedColumnProxy conceptProxy = new DesignedColumnProxy(item); conceptProxy.ColumnType = DesignedReportColumnType.Concept; conceptProxy.KeyColumn = item.KeyColumnName; conceptProxyList.Add(conceptProxy); } Report reportObj = new BReport().GetByID(reportId); DesignedReportType reportTypeObj = GetAllDesignedReportsTypes().SingleOrDefault(d => d.CustomCode == DesignedReportTypeEnum.Daily); if (reportObj.DesignedType == reportTypeObj) { IList <DesignedReportTrafficColumn> designedReportTrafficColumnList = new BDesignedReportsColumn().GetAllDesignedReportsTrafficColumns(); int i = 0; foreach (DesignedReportTrafficColumn item in designedReportTrafficColumnList) { DesignedColumnProxy conceptProxy = new DesignedColumnProxy(); conceptProxy.FnName = item.FnName; conceptProxy.EnName = item.EnName; conceptProxy.Name = item.Name; conceptProxy.ID = item.ID; conceptProxy.ColumnType = DesignedReportColumnType.Traffic; conceptProxy.KeyColumn = item.Key.ToString(); conceptProxyList.Insert(i, conceptProxy); i++; } } return(conceptProxyList); } catch (Exception ex) { throw ex; } }
public IList <DesignedColumnProxy> GetAllDesignedReportsPersonInfoProxyColumns(decimal reportId) { try { IList <DesignedColumnProxy> designedColumnProxyList = new List <DesignedColumnProxy>(); IList <DesignedReportPersonInfoColumn> designedReportPersonInfoColumnList = repDesignedReportPersonInfoColumn.GetAll().ToList <DesignedReportPersonInfoColumn>(); IList <PersonReserveField> personReserveFieldList = new List <PersonReserveField>(); if (designedReportPersonInfoColumnList.Count(d => d != null && d.IsReserveField) > 0) { personReserveFieldList = new BPersonReservedField().GetAll(); } foreach (DesignedReportPersonInfoColumn item in designedReportPersonInfoColumnList) { DesignedColumnProxy columnProxy = new DesignedColumnProxy(); if (item.IsReserveField) { string itemKey = item.Key.ToString().Replace("prsTA_", ""); PersonReserveField personReserveFieldObj = personReserveFieldList.FirstOrDefault(r => r.OrginalName.ToLower().Trim() == itemKey.ToLower().Trim()); if (personReserveFieldObj != null) { columnProxy.Name = personReserveFieldObj.Lable; } else { switch (BLanguage.CurrentLocalLanguage) { case LanguagesName.Parsi: columnProxy.Name = item.FnName; break; case LanguagesName.English: columnProxy.Name = item.EnName; break; default: columnProxy.Name = item.FnName; break; } } } else { switch (BLanguage.CurrentLocalLanguage) { case LanguagesName.Parsi: columnProxy.Name = item.FnName; break; case LanguagesName.English: columnProxy.Name = item.EnName; break; default: columnProxy.Name = item.FnName; break; } } columnProxy.ColumnType = DesignedReportColumnType.PersonInfo; columnProxy.ID = item.ID; columnProxy.KeyColumn = item.Key.ToString(); designedColumnProxyList.Add(columnProxy); } designedColumnProxyList = designedColumnProxyList.OrderBy(o => o.Name).ToList <DesignedColumnProxy>(); Report reportObj = new BReport().GetByID(reportId); DesignedReportType reportTypeObj = GetAllDesignedReportsTypes().SingleOrDefault(d => d.CustomCode == DesignedReportTypeEnum.Daily); if (reportObj.DesignedType == reportTypeObj) { IList <PersonParamField> personParamFieldList = new BPersonParamFields().GetAll().Where(p => p.Active && p.SubSystemId == SubSystemIdentifier.TimeAtendance).ToList(); foreach (PersonParamField item in personParamFieldList) { DesignedColumnProxy columnProxy = new DesignedColumnProxy(); DesignedReportPersonInfoColumn designedReportPersonInfoColumnObj = new DesignedReportPersonInfoColumn(); columnProxy.EnName = item.EnTitle; columnProxy.FnName = item.FnTitle; switch (BLanguage.CurrentLocalLanguage) { case LanguagesName.Parsi: columnProxy.Name = item.FnTitle; break; case LanguagesName.English: columnProxy.Name = item.EnTitle; break; default: columnProxy.Name = item.FnTitle; break; } columnProxy.ColumnType = DesignedReportColumnType.PersonParam; columnProxy.ID = item.ID; columnProxy.KeyColumn = item.Key; designedColumnProxyList.Add(columnProxy); } } return(designedColumnProxyList); } catch (Exception ex) { LogException(ex, "BDesignedReportsColumn", "GetAllDesignedReportsPersonInfoColumns"); throw ex; } }