public JsonResult Get_StatusEnumList() => Json(EnumExtension.EnumToLocalizedList <StatusEnum>(_localizer).Select(x => new { Id = x.Value, Name = x.Text }));
private string GetCampaignOutcome(string disposition) { return(EnumExtension.GetDescription(((RequirementStatusDescription)Enum.Parse(typeof(RequirementStatusDescription), disposition)))); }
private async Task <List <ViolationErrorInfo> > CheckError(List <BatchTableModelDto> batchTableModels) { var violationErrorInfos = new List <ViolationErrorInfo>(); try { if (batchTableModels != null && batchTableModels.Count > 0) { //查询代办人列表 var agentNames = batchTableModels.Where(x => !string.IsNullOrEmpty(x.代办方)).Select(x => x.代办方).ToList(); var users = new List <Users>(); if (agentNames.Any()) { users = await _userServices.GetUsersByKeys(agentNames, AbpSession.WebSiteId); } var carTypeNames = EnumExtension.GetDescriptions <CarTypeEnum>(); #region 数据判断 foreach (var item in batchTableModels) { string ret = ""; bool checkSucssful = true; if (string.IsNullOrEmpty(item.序号)) { checkSucssful = false; ret += "序号不能为空!"; } else if (batchTableModels.Where(x => x.序号 == item.序号).Count() >= 2) { checkSucssful = false; ret += $"序号:{item.序号}重复!"; } if (string.IsNullOrEmpty(item.车牌号)) { checkSucssful = false; ret += "车牌不能为空!"; } if (string.IsNullOrEmpty(item.车型名称)) { item.车型名称 = "小型汽车"; } if (string.IsNullOrEmpty(item.车辆性质)) { item.车辆性质 = "单位车"; } #region 获取车型代码 string carTypeName = item.车型名称; carTypeName = carTypeNames.Where(x => x == carTypeName).FirstOrDefault(); if (carTypeName == null) { checkSucssful = false; ret += "车型名称 格式有误!"; } var carCodeResult = carTypeName.GetEnumByDesc <CarTypeEnum>(); item.车型代码 = ((int)carCodeResult).ToString().PadLeft(2, '0'); #endregion if (string.IsNullOrEmpty(item.车架号)) { checkSucssful = false; ret += "车架号不能为空!"; } if (string.IsNullOrEmpty(item.发动机号)) { checkSucssful = false; ret += "发动机号不能为空!"; } if (string.IsNullOrWhiteSpace(item.是否超证)) { checkSucssful = false; ret += "是否超证不能为空!"; } //有违章 if (!string.IsNullOrWhiteSpace(item.违章时间) && !string.IsNullOrWhiteSpace(item.扣分)) { if (!item.违章时间.IsDate()) { checkSucssful = false; ret += "违章时间不是正确的日期格式!"; } if (!item.扣分.IsNumber()) { checkSucssful = false; ret += "扣分不是整数!"; } if (string.IsNullOrWhiteSpace(item.违章城市)) { checkSucssful = false; ret += "违章城市不能为空!"; } else { #region 用违章城市进行反算城市代码 var cityQuery = CommonHelper.InByCityName(item.违章城市.ToString()); if (cityQuery != null) { string Code = cityQuery.ID; if (Code.Length != 4) { Code = Code.PadRight(4, '0'); } item.违章城市代码 = Code; } #endregion } if (string.IsNullOrEmpty(item.违章地点)) { checkSucssful = false; ret += "违章地点不能为空!"; } if (string.IsNullOrEmpty(item.违章原因)) { checkSucssful = false; ret += "违章原因不能为空!"; } if (string.IsNullOrEmpty(item.违法代码)) { item.违法代码 = ""; } else { if (!item.违法代码.IsDigitOrNumber()) { checkSucssful = false; ret += "违法代码错误!"; } if (item.违法代码.Length > 10) { checkSucssful = false; ret += "违法代码错误!"; } } if (string.IsNullOrEmpty(item.罚金)) { checkSucssful = false; ret += "罚金不能为空!"; } else { if (item.罚金.ToDecimal() == null) { checkSucssful = false; ret += "罚金格式错误!"; } } if (string.IsNullOrWhiteSpace(item.滞纳金)) { checkSucssful = false; ret += "滞纳金不能为空!"; } else { if (item.滞纳金.ToDecimal() == null) { checkSucssful = false; ret += "滞纳金格式错误!"; } } if (!item.文书号.IsNullOrEmpty() && item.文书号.Length > 32) { checkSucssful = false; ret += "文书号长度超过32位!"; } } //人工报价—服务费 if (!string.IsNullOrEmpty(item.手续费) && item.手续费.ToInt() > 0) { if (item.代办方.IsNullOrEmpty()) { checkSucssful = false; ret += "代办方不能为空!"; } else if (item.代办成本.IsNullOrEmpty()) { checkSucssful = false; ret += "代办成本不能为空!"; } } if (!string.IsNullOrEmpty(item.代办成本) && decimal.TryParse(item.代办成本, out decimal dbcb)) { if (item.代办方.IsNullOrEmpty()) { checkSucssful = false; if (!ret.Contains("代办方不能为空!")) { ret += "代办方不能为空!"; } } } if (!string.IsNullOrEmpty(item.代办方)) { var userId = users.FirstOrDefault(x => (x.Shortname == item.代办方 || x.LoginName == item.代办方))?.Id; if (string.IsNullOrEmpty(userId)) { checkSucssful = false; ret += $"代办方:{item.代办方}信息有误!"; } if (item.代办成本.IsNullOrEmpty() || !decimal.TryParse(item.代办成本, out dbcb)) { checkSucssful = false; if (!ret.Contains("代办成本不能为空!")) { ret += "代办成本不能为空!"; } } } #region 正确与错误记录 if (!checkSucssful) { item.DataStatus = (int)ViolationDataStatusEnum.Error; violationErrorInfos.Add(new ViolationErrorInfo { Index = item.序号, Type = "错误", Reason = ret }); } #endregion var count = batchTableModels.Where(x => x.车牌号 == item.车牌号 && x.是否挑单 != item.是否挑单).Count(); if (count > 0) { violationErrorInfos.Add(new ViolationErrorInfo { Index = item.序号, Type = "错误", Reason = "车辆:" + item.车牌号 + "存在多种挑单方式!" }); } } #endregion } else { violationErrorInfos.Add(new ViolationErrorInfo { Index = "", Type = "错误", Reason = "导入的有效数据为空或者模板不正确" }); } } catch (Exception ex) { _logger.Error($"BatchCarViolationService.CheckError:{ex.Message}"); return(null); } return(violationErrorInfos); }
public IList <PaymentVendorDetail> GetList(string query, Sort sort, int page, int start, int limit, ref int totalRecords, ref string errMsg, int PayVendorId) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = (PayVendorId > 0) ? string.Format("a.PayVendorId = {0}", PayVendorId) :"1=1"; // Handle Order string order = "a.PayVendorDetailId"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; } string sql = @"SELECT * FROM ( SELECT a.*, b.PayModeDescription as x_PayModeDescription, RTRIM(ISNULL(d.BankName,'')) + ', ' + RTRIM(c.AccountReference) + ', ***' + RIGHT(ISNULL(c.AccountNumber,''),4) as BankAccount, ROW_NUMBER() OVER (ORDER BY {2} {3}) as row, IsNull((select count(*) from PaymentVendorDetails a WHERE {0}),0) as TotalRecords FROM PaymentVendorDetails a INNER JOIN PaymentModes b ON a.PayModeID = b.PayModeID LEFT JOIN BankAccounts c ON a.AccountID = c.AccountID LEFT JOIN BankingInstitutions d ON c.BankID = d.BankID WHERE {0} ) a WHERE {1} ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); errMsg = ex.Message; return(null); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <PaymentVendorDetail> data = EnumExtension.ToList <PaymentVendorDetail>(dt); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
private Panel InitializeRailDriverInputControls() { Panel panel = new Panel() { AutoScroll = true, Width = panelRDSettings.Width / 2 }; panel.SuspendLayout(); int columnWidth = (panel.ClientSize.Width - 20) / 3; Label tempLabel = new Label(); RDButtonInputControl tempControl = new RDButtonInputControl(settings.RailDriver.UserCommands[UserCommand.GameQuit], RailDriverSettings.GetDefaultValue(UserCommand.GameQuit), instance); int rowTop = Math.Max(tempLabel.Margin.Top, tempControl.Margin.Top); int rowHeight = tempControl.Height; int rowSpacing = rowHeight + tempControl.Margin.Vertical; Size categorySize = new Size(columnWidth * 2 - tempLabel.Margin.Horizontal, rowHeight); Size inputControlSize = new Size(columnWidth - tempControl.Margin.Horizontal, rowHeight); Size labelSize = new Size(columnWidth * 2 - tempLabel.Margin.Horizontal, rowHeight); string previousCategory = ""; int i = 0; foreach (UserCommand command in EnumExtension.GetValues <UserCommand>()) { string name = commonCatalog.GetString(command.GetDescription()); string category, description; int index = name.IndexOf(' '); if (index == -1) { category = string.Empty; description = name; } else { category = name.Substring(0, index); description = name.Substring(index + 1); } if (category != previousCategory) { Label categorylabel = new Label { Location = new Point(tempLabel.Margin.Left, rowTop + rowSpacing * i), Size = categorySize, Text = category, TextAlign = ContentAlignment.MiddleLeft }; categorylabel.Font = new Font(categorylabel.Font, FontStyle.Bold); panel.Controls.Add(categorylabel); previousCategory = category; ++i; } Label label = new Label { Location = new Point(tempLabel.Margin.Left, rowTop + rowSpacing * i), Size = labelSize, Text = description, TextAlign = ContentAlignment.MiddleRight }; panel.Controls.Add(label); RDButtonInputControl rdButtonControl = new RDButtonInputControl(settings.RailDriver.UserCommands[command], RailDriverSettings.GetDefaultValue(command), instance) { Location = new Point(columnWidth * 2 + tempControl.Margin.Left, rowTop + rowSpacing * i), Size = inputControlSize, Tag = command }; panel.Controls.Add(rdButtonControl); ++i; } panel.ResumeLayout(true); tempControl.Dispose(); tempLabel.Dispose(); return(panel); }
public DataTable GetQuotes(int roleId, string receivedFrom, string receivedTo, string query, IAMTradingWA.Models.Filter filter, Sort sort, int page, int start, int limit) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; // Set received filter date DateTime dateReceivedFrom, dateReceivedTo; dateReceivedFrom = (!string.IsNullOrEmpty(receivedFrom)) ? Convert.ToDateTime(receivedFrom) : DateTime.Now; dateReceivedTo = (!string.IsNullOrEmpty(receivedTo)) ? Convert.ToDateTime(receivedTo) : DateTime.Now; dateReceivedTo = new DateTime(dateReceivedTo.Year, dateReceivedTo.Month, dateReceivedTo.Day, 23, 59, 59); where += (!string.IsNullOrEmpty(receivedFrom)) ? " AND dbo.fn_GetPurchaseOrderDate(a.QHeaderId) >= @receivedFrom " : ""; where += (!string.IsNullOrEmpty(receivedTo)) ? " AND dbo.fn_GetPurchaseOrderDate(a.QHeaderId) <= @receivedTo " : ""; #region Filtros if (!string.IsNullOrWhiteSpace(filter.property)) { where += String.Format(" and a.{0} = {1}", filter.property, filter.value); } #endregion Filtros if (!string.IsNullOrEmpty(query)) { string fieldName = "a.QHeaderReference+dbo.fn_GetVendor(a.QHeaderId)+ISNULL(e.StatusName,'')+ISNULL(a.QHeaderOC,'')+ISNULL(a.QHeaderStatusInfo,'')+ISNULL(f.BrokerName,'')+ISNULL(g.CustName,'')"; where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } // Handle Orders string order = "a.QHeaderDate"; string direction = "DESC"; if (roleId == -1) { order = "dbo.fn_GetOrderQuoteHeader(a.QHeaderStatusInfo), a.QHeaderDate"; direction = "ASC"; } if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; if (order == "x_DateApproved") { order = "ISNULL(DATEDIFF(DD, a.QHeaderDate, ISNULL(dbo.fn_GetPurchaseOrderDate(a.QHeaderId),a.QHeaderOCDate)), (CASE WHEN a.QHeaderStatusInfo='COTIZADA' THEN DATEDIFF(DD, a.QHeaderDate,getdate()) ELSE 0 END))"; } } decimal tasa = Utils.GetDolarTodayRate(); string sql = "WITH qData " + " AS ( " + " SELECT a.*, " + " ISNULL(e.StatusName,'') as x_StatusName, ISNULL(f.BrokerName,'') as x_BrokerName, ISNULL (g.CustName,'') as x_CustName, " + " dbo.fn_GetVendor(a.QHeaderId) as x_VendorName, dbo.fn_GetProfit(a.QHeaderId) as x_Profit, " + " dbo.fn_ExchangeVariation(a.QHeaderId, @DolarTodayRate)*-1 as x_ExchangeVariation, " + " dbo.fn_GetPurchaseOrderDate(a.QHeaderId) as x_DateOrderReceived, " + " dbo.fn_GetPORate(a.QHeaderId) as x_PORate, " + " dbo.fn_GetPBRate(a.QHeaderId) as x_PBRate, " + " ISNULL(DATEDIFF(DD, a.QHeaderDate, ISNULL(dbo.fn_GetPurchaseOrderDate(a.QHeaderId),a.QHeaderOCDate)), (CASE WHEN a.QHeaderStatusInfo='COTIZADA' THEN DATEDIFF(DD, a.QHeaderDate,getdate()) ELSE 0 END)) as x_DateApproved, " + " ROW_NUMBER() OVER (ORDER BY {2} {3}) as row " + " FROM QuoteHeader a LEFT JOIN Status e ON a.StatusId=e.StatusId " + " LEFT JOIN Brokers f ON a.BrokerId = f.BrokerId " + " LEFT JOIN Customers g ON a.CustId = g.CustId " + " WHERE {0}) " + "SELECT *,ISNULL((select sum(QHeaderTotal) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_TotalInQuotes, " + " ISNULL((select sum(QHeaderCost) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_CostInQuotes, " + " ISNULL((select sum(x_Profit) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_ProfitInQuotes, " + " ISNULL((select sum(QHeaderVolumeWeight) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_VolumeWeightInQuotes, " + " ISNULL((select sum(QHeaderCubicFeet) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_CubicFeetInQuotes, " + " (CASE WHEN QHeaderTotal IS NOT NULL AND QHeaderTotal>0 THEN ROUND(ISNULL(x_Profit/QHeaderTotal,0)*100,2) ELSE 0 END) as x_ProfitPct , " + " ISNULL((select sum(x_ExchangeVariation) from qData WHERE QHeaderStatusInfo<>'ANULADA'),0) as x_ExchangeVariationInQuotes, " + " ISNULL((select SUM(x_DateApproved)/COUNT(*) from qData WHERE x_DateApproved > 0),0) as x_DaysAvg, " + " ISNULL((select SUM(QHeaderCurrencyRate)/COUNT(*) from qData WHERE QHeaderCurrencyRate <> 0 AND QHeaderStatusInfo<>'ANULADA'),0) as x_DolarIAM, " + " ISNULL(t1.Total,0) as x_ExchVarHistory, " + " ISNULL(t2.Total,0) as x_TotalPorAprobacion, ISNULL(t2.Count,0) as x_CountPorAprobacion, " + " IsNull((select count(*) from qData),0) as TotalRecords " + "FROM qData " + " LEFT OUTER JOIN ((select sum(dbo.fn_ExchangeVariation(QHeaderId, @DolarTodayRate)*-1) as total from QuoteHeader WHERE QHeaderStatusInfo<>'ANULADA')) as t1 ON 1=1 " + " LEFT OUTER JOIN ((select sum(QHeaderTotal) as Total, Count(*) as Count from QuoteHeader WHERE QHeaderStatusInfo in ('POR REEMPLAZO','COTIZADA'))) as t2 ON 1=1 " + "WHERE {1} " + "ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); da.SelectCommand.Parameters.Add("@DolarTodayRate", SqlDbType.Decimal).Value = tasa; // Setting params for Received Date if (!string.IsNullOrEmpty(receivedFrom)) { da.SelectCommand.Parameters.Add("@receivedFrom", SqlDbType.DateTime).Value = dateReceivedFrom; } if (!string.IsNullOrEmpty(receivedTo)) { da.SelectCommand.Parameters.Add("@receivedTo", SqlDbType.DateTime).Value = dateReceivedTo; } DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); return(null); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; return(dt); }
/// <summary> /// Convert name argument to <see cref="QueueAgentType"/>. /// </summary> /// <param name="name"></param> /// <returns></returns> public static QueueAgentType GetAgent(string name) { return(EnumExtension.Parse <QueueAgentType>(name, QueueAgentType.MQueue)); }
public ListModelBase <InterviewInboundViewModel, InterviewInboundFilter> Create(IEnumerable <EventCustomer> eventCustomers, IEnumerable <Customer> customers, IEnumerable <ChaseOutbound> chaseOutbounds, IEnumerable <CustomerChaseCampaign> customerChaseCampaigns, IEnumerable <ChaseCampaign> chaseCampaigns, IEnumerable <Call> calls, IEnumerable <Appointment> appointments, IEnumerable <Event> events, IEnumerable <EventAppointmentCancellationLog> eventAppointmentCancellationLogs, IEnumerable <CustomerCallNotes> customerCallNotes, IEnumerable <OrderedPair <long, long> > eventIdStaffIdPairs, IEnumerable <OrganizationRoleUser> organizationRoleUsers, IEnumerable <User> users) { var collection = new List <InterviewInboundViewModel>(); foreach (var customer in customers) { var customerCalls = calls.Where(x => x.CalledCustomerId == customer.CustomerId).ToArray().OrderByDescending(x => x.CallDateTime).ToArray(); var recentCall = customerCalls.Any() ? customerCalls.First() : null; var appointmentBookedCalls = customerCalls.OrderByDescending(x => x.CallDateTime).FirstOrDefault(x => x.EventId > 0); var eventCustomer = appointmentBookedCalls != null?eventCustomers.FirstOrDefault(x => x.EventId == appointmentBookedCalls.EventId && x.CustomerId == customer.CustomerId) : null; if (appointmentBookedCalls != null && eventCustomer == null) { eventCustomer = eventCustomers.FirstOrDefault(x => x.CustomerId == customer.CustomerId && x.AppointmentId.HasValue); } var theEvent = eventCustomer != null?events.First(x => x.Id == eventCustomer.EventId) : null; var appointment = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? appointments.Single(x => x.Id == eventCustomer.AppointmentId.Value) : null; var chaseOutbound = chaseOutbounds.FirstOrDefault(x => x.CustomerId == customer.CustomerId); if (chaseOutbound == null) { continue; } var customerChaseCampaign = !customerChaseCampaigns.IsNullOrEmpty() ? customerChaseCampaigns.FirstOrDefault(x => x.CustomerId == customer.CustomerId) : null; var campaign = !chaseCampaigns.IsNullOrEmpty() && customerChaseCampaign != null?chaseCampaigns.FirstOrDefault(x => x.Id == customerChaseCampaign.ChaseCampaignId) : null; var eventIdStaffIdPairsForEvent = eventCustomer != null?eventIdStaffIdPairs.Where(x => x.FirstValue == eventCustomer.EventId) : null; var organizationRoleUsersForEvent = eventIdStaffIdPairsForEvent != null && eventIdStaffIdPairsForEvent.Any() ? organizationRoleUsers.Where(x => eventIdStaffIdPairsForEvent.Select(y => y.SecondValue).Contains(x.Id)) : null; var usersForEvent = organizationRoleUsersForEvent != null && organizationRoleUsersForEvent.Any() ? users.Where(x => organizationRoleUsersForEvent.Select(y => y.UserId).Contains(x.Id)) : null; var userId = usersForEvent != null && usersForEvent.Any() ? usersForEvent.First().Id.ToString() : ""; string requirementStatus = string.Empty; string requirementStatusDescription = string.Empty; if (eventCustomer != null && eventCustomer.AppointmentId.HasValue && appointment != null) { requirementStatus = RequirementStatus.Open.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.BookedAppointment); if (appointment.CheckInTime.HasValue && appointment.CheckOutTime.HasValue && !eventCustomer.NoShow && !eventCustomer.LeftWithoutScreeningReasonId.HasValue) { requirementStatus = RequirementStatus.Completed.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.AssessmentCompleted); } else if (eventCustomer.NoShow) { requirementStatus = RequirementStatus.Cancelled.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.NoShow); } else if (eventCustomer.LeftWithoutScreeningReasonId.HasValue) { requirementStatus = RequirementStatus.Cancelled.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.LeftWithoutScreening); } } else { if (eventCustomer != null && !eventCustomer.AppointmentId.HasValue) { requirementStatus = RequirementStatus.Cancelled.ToString(); var eventAppointmentCancellationLog = eventAppointmentCancellationLogs.FirstOrDefault(x => x.EventCustomerId == eventCustomer.Id); var reason = eventAppointmentCancellationLog != null ? ((CancelAppointmentReason)eventAppointmentCancellationLog.ReasonId).ToString() : ""; try { requirementStatusDescription = !string.IsNullOrEmpty(reason) ? EnumExtension.GetDescription(((RequirementStatusDescription)Enum.Parse(typeof(RequirementStatusDescription), reason))) : ""; } catch (Exception) { requirementStatusDescription = eventAppointmentCancellationLog != null?EnumExtension.GetDescription(((CancelAppointmentReason)eventAppointmentCancellationLog.ReasonId)) : ""; } if (eventAppointmentCancellationLog != null) { customerCalls = customerCalls.Where(x => x.CallDateTime > eventAppointmentCancellationLog.DateCreated).OrderBy(x => x.CallDateTime).ToArray(); } } if (customerCalls.Any()) { if (recentCall != null && recentCall.Disposition == ProspectCustomerTag.Deceased.ToString() || recentCall.Disposition == ProspectCustomerTag.DoNotCall.ToString() || recentCall.Disposition == ProspectCustomerTag.MobilityIssue.ToString() || recentCall.Disposition == ProspectCustomerTag.TransportationIssue.ToString() || recentCall.Disposition == ProspectCustomerTag.MobilityIssues_LeftMessageWithOther.ToString() || recentCall.Disposition == ProspectCustomerTag.IncorrectPhoneNumber.ToString() || recentCall.Disposition == ProspectCustomerTag.DebilitatingDisease.ToString() || recentCall.Disposition == ProspectCustomerTag.NoLongeronInsurancePlan.ToString() || recentCall.Disposition == ProspectCustomerTag.HomeVisitRequested.ToString() || recentCall.Disposition == ProspectCustomerTag.MemberStatesIneligibleMastectomy.ToString()) { requirementStatus = RequirementStatus.Cancelled.ToString(); try { requirementStatusDescription = EnumExtension.GetDescription(((RequirementStatusDescription)Enum.Parse(typeof(RequirementStatusDescription), recentCall.Disposition))); } catch (Exception) { requirementStatusDescription = EnumExtension.GetDescription(((ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), recentCall.Disposition))); } /*if (string.IsNullOrEmpty(requirementStatusDescription)) * { * requirementStatusDescription = !eventCustomer.AppointmentId.HasValue && cancellationNote != null && !string.IsNullOrEmpty(cancellationNote.Notes) ? ReplaceNewLine(Truncate(cancellationNote.Notes, 0, 250), " ") : ""; * }*/ } else if (customerCalls.Count() <= 10) { requirementStatus = RequirementStatus.Open.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.CallAttempt) + " " + customerCalls.Count(); } else if (customerCalls.Count() > 10) { requirementStatus = RequirementStatus.Cancelled.ToString(); requirementStatusDescription = EnumExtension.GetDescription(RequirementStatusDescription.MemberCalledMaxAttempts); } } else if (eventCustomer == null) { requirementStatus = string.IsNullOrEmpty(requirementStatus) ? RequirementStatus.Hold.ToString() : requirementStatus; } } if (requirementStatus == RequirementStatus.Open.ToString() || requirementStatus == RequirementStatus.Hold.ToString()) { requirementStatus = RequirementStatus.Cancelled.ToString(); } var interviewInboundViewModel = new InterviewInboundViewModel { TenantId = chaseOutbound.TenantId, ClientId = chaseOutbound.ClientId, CampaignId = campaign != null ? campaign.CampaignId : "", IndividualIDNumber = chaseOutbound.IndividualId, ContractNumber = chaseOutbound.ContractNumber, ContractPersonNumber = chaseOutbound.ContractPersonNumber, ConsumerId = chaseOutbound.ConsumerId, VendorPersonId = customer.CustomerId.ToString(), ChartNumber = "", RequirementCode = RequirementCode, RequirementStatus = requirementStatus, RequirementStatusDescription = requirementStatusDescription, RequirementStatusDate = eventCustomer != null && eventCustomer.AppointmentId.HasValue && theEvent != null ? theEvent.EventDate : recentCall != null ? recentCall.CallDateTime : (DateTime?)null, RequirementStatusTime = appointment != null ? appointment.StartTime : recentCall != null ? recentCall.CallDateTime : (DateTime?)null, RequirementUserCode = !string.IsNullOrEmpty(userId) ? userId.Length > Maxlength?userId.Substring(0, Maxlength) : userId : "" }; collection.Add(interviewInboundViewModel); } return(new InterviewInboundListModel { Collection = collection }); }
public Mappingprofile() { var config = new MapperConfiguration(cfg => { cfg.AllowNullDestinationValues = true; cfg.AllowNullCollections = true; }); CreateMap <ApplicationUser, AccountUserDTO>() .ForMember(dest => dest.Verified, opt => opt.MapFrom(src => src.EmailConfirmed)); CreateMap <RegistrationDTO, ApplicationUser>() .ForMember(dest => dest.DateOfBirth, opt => opt.MapFrom(src => !src.DateOfBirth.HasValue ? src.DateOfBirth : src.DateOfBirth.Value.Date)); CreateMap <Company, CompanyFullDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.ReviewCount, opt => opt.MapFrom(src => src.ReviewCount)) .ForMember(dest => dest.OverallRating, opt => opt.MapFrom(src => src.AllGroupsRatings.AverageRating.Rating)) .ForMember(dest => dest.CustomerRating, opt => opt.MapFrom(src => src.AllGroupsRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeRating, opt => opt.MapFrom(src => src.AllGroupsRatings.EmployeeRating.Rating)) .ForMember(dest => dest.SocietyRating, opt => opt.MapFrom(src => src.AllGroupsRatings.SocietyRating.Rating)) .ForMember(dest => dest.EmployeeOverallRating, opt => opt.MapFrom(src => src.EmployeeRatings.AverageRating.Rating)) .ForMember(dest => dest.EmployeeCustomerRating, opt => opt.MapFrom(src => src.EmployeeRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeEmployeeRating, opt => opt.MapFrom(src => src.EmployeeRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EmployeeSocietyRating, opt => opt.MapFrom(src => src.EmployeeRatings.SocietyRating.Rating)) .ForMember(dest => dest.EssentialOverallRating, opt => opt.MapFrom(src => src.EssentialRatings.AverageRating.Rating)) .ForMember(dest => dest.EssentialCustomerRating, opt => opt.MapFrom(src => src.EssentialRatings.CustomerRating.Rating)) .ForMember(dest => dest.EssentialEmployeeRating, opt => opt.MapFrom(src => src.EssentialRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EssentialSocietyRating, opt => opt.MapFrom(src => src.EssentialRatings.SocietyRating.Rating)) .ForMember(dest => dest.VulnerableOverallRating, opt => opt.MapFrom(src => src.VulnerableRatings.AverageRating.Rating)) .ForMember(dest => dest.VulnerableCustomerRating, opt => opt.MapFrom(src => src.VulnerableRatings.CustomerRating.Rating)) .ForMember(dest => dest.VulnerableEmployeeRating, opt => opt.MapFrom(src => src.VulnerableRatings.EmployeeRating.Rating)) .ForMember(dest => dest.VulnerableSocietyRating, opt => opt.MapFrom(src => src.VulnerableRatings.SocietyRating.Rating)) .ForMember(dest => dest.StreetNumber, opt => opt.MapFrom(src => src.Address.StreetNumber)) .ForMember(dest => dest.StreetName, opt => opt.MapFrom(src => src.Address.StreetName)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)) .ForMember(dest => dest.PostCode, opt => opt.MapFrom(src => src.Address.PostCode)) .ForMember(dest => dest.Longitude, opt => opt.MapFrom(src => src.Address.Longitude)) .ForMember(dest => dest.Latitude, opt => opt.MapFrom(src => src.Address.Latitude)); CreateMap <Company, CompanyTopBottomDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.OverallRating, opt => opt.MapFrom(src => src.AllGroupsRatings.AverageRating.Rating)); CreateMap <Company, CompanyLightDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.StreetNumber, opt => opt.MapFrom(src => src.Address.StreetNumber)) .ForMember(dest => dest.StreetName, opt => opt.MapFrom(src => src.Address.StreetName)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)) .ForMember(dest => dest.PostCode, opt => opt.MapFrom(src => src.Address.PostCode)); CreateMap <Company, CompanyIncRatingsDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.ReviewCount, opt => opt.MapFrom(src => src.ReviewCount)) .ForMember(dest => dest.OverallRating, opt => opt.MapFrom(src => src.AllGroupsRatings.AverageRating.Rating)) .ForMember(dest => dest.CustomerRating, opt => opt.MapFrom(src => src.AllGroupsRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeRating, opt => opt.MapFrom(src => src.AllGroupsRatings.EmployeeRating.Rating)) .ForMember(dest => dest.SocietyRating, opt => opt.MapFrom(src => src.AllGroupsRatings.SocietyRating.Rating)) .ForMember(dest => dest.EmployeeOverallRating, opt => opt.MapFrom(src => src.EmployeeRatings.AverageRating.Rating)) .ForMember(dest => dest.EmployeeCustomerRating, opt => opt.MapFrom(src => src.EmployeeRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeEmployeeRating, opt => opt.MapFrom(src => src.EmployeeRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EmployeeSocietyRating, opt => opt.MapFrom(src => src.EmployeeRatings.SocietyRating.Rating)) .ForMember(dest => dest.EssentialOverallRating, opt => opt.MapFrom(src => src.EssentialRatings.AverageRating.Rating)) .ForMember(dest => dest.EssentialCustomerRating, opt => opt.MapFrom(src => src.EssentialRatings.CustomerRating.Rating)) .ForMember(dest => dest.EssentialEmployeeRating, opt => opt.MapFrom(src => src.EssentialRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EssentialSocietyRating, opt => opt.MapFrom(src => src.EssentialRatings.SocietyRating.Rating)) .ForMember(dest => dest.VulnerableOverallRating, opt => opt.MapFrom(src => src.VulnerableRatings.AverageRating.Rating)) .ForMember(dest => dest.VulnerableCustomerRating, opt => opt.MapFrom(src => src.VulnerableRatings.CustomerRating.Rating)) .ForMember(dest => dest.VulnerableEmployeeRating, opt => opt.MapFrom(src => src.VulnerableRatings.EmployeeRating.Rating)) .ForMember(dest => dest.VulnerableSocietyRating, opt => opt.MapFrom(src => src.VulnerableRatings.SocietyRating.Rating)) .ForMember(dest => dest.StreetNumber, opt => opt.MapFrom(src => src.Address.StreetNumber)) .ForMember(dest => dest.StreetName, opt => opt.MapFrom(src => src.Address.StreetName)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)) .ForMember(dest => dest.PostCode, opt => opt.MapFrom(src => src.Address.PostCode)); CreateMap <Company, CompanyRankingDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.ReviewCountAll, opt => opt.MapFrom(src => src.AllGroupsRatings != null ? src.AllGroupsRatings.AverageRating.Count : -1)) .ForMember(dest => dest.OverallRating, opt => opt.MapFrom(src => src.AllGroupsRatings.AverageRating.Rating)) .ForMember(dest => dest.CustomerRating, opt => opt.MapFrom(src => src.AllGroupsRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeRating, opt => opt.MapFrom(src => src.AllGroupsRatings.EmployeeRating.Rating)) .ForMember(dest => dest.SocietyRating, opt => opt.MapFrom(src => src.AllGroupsRatings.SocietyRating.Rating)) .ForMember(dest => dest.ReviewCountEmployee, opt => opt.MapFrom(src => src.EmployeeRatings != null ? src.EmployeeRatings.AverageRating.Count : -1)) .ForMember(dest => dest.EmployeeOverallRating, opt => opt.MapFrom(src => src.EmployeeRatings.AverageRating.Rating)) .ForMember(dest => dest.EmployeeCustomerRating, opt => opt.MapFrom(src => src.EmployeeRatings.CustomerRating.Rating)) .ForMember(dest => dest.EmployeeEmployeeRating, opt => opt.MapFrom(src => src.EmployeeRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EmployeeSocietyRating, opt => opt.MapFrom(src => src.EmployeeRatings.SocietyRating.Rating)) .ForMember(dest => dest.ReviewCountEssential, opt => opt.MapFrom(src => src.EssentialRatings != null ? src.EssentialRatings.AverageRating.Count : -1)) .ForMember(dest => dest.EssentialOverallRating, opt => opt.MapFrom(src => src.EssentialRatings.AverageRating.Rating)) .ForMember(dest => dest.EssentialCustomerRating, opt => opt.MapFrom(src => src.EssentialRatings.CustomerRating.Rating)) .ForMember(dest => dest.EssentialEmployeeRating, opt => opt.MapFrom(src => src.EssentialRatings.EmployeeRating.Rating)) .ForMember(dest => dest.EssentialSocietyRating, opt => opt.MapFrom(src => src.EssentialRatings.SocietyRating.Rating)) .ForMember(dest => dest.ReviewCountVulnerable, opt => opt.MapFrom(src => src.VulnerableRatings != null ? src.VulnerableRatings.AverageRating.Count : -1)) .ForMember(dest => dest.VulnerableOverallRating, opt => opt.MapFrom(src => src.VulnerableRatings.AverageRating.Rating)) .ForMember(dest => dest.VulnerableCustomerRating, opt => opt.MapFrom(src => src.VulnerableRatings.CustomerRating.Rating)) .ForMember(dest => dest.VulnerableEmployeeRating, opt => opt.MapFrom(src => src.VulnerableRatings.EmployeeRating.Rating)) .ForMember(dest => dest.VulnerableSocietyRating, opt => opt.MapFrom(src => src.VulnerableRatings.SocietyRating.Rating)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)); CreateMap <CompanyFullDTO, Company>() .ForPath(dest => dest.Guid, opt => opt.Ignore()) .ForPath(dest => dest.Address.StreetNumber, opt => opt.MapFrom(src => src.StreetNumber)) .ForPath(dest => dest.Address.StreetName, opt => opt.MapFrom(src => src.StreetName)) .ForPath(dest => dest.Address.City, opt => opt.MapFrom(src => src.City)) .ForPath(dest => dest.Address.Region, opt => opt.MapFrom(src => src.Region)) .ForPath(dest => dest.Address.Country, opt => opt.MapFrom(src => src.Country)) .ForPath(dest => dest.Address.PostCode, opt => opt.MapFrom(src => src.PostCode)) .ForPath(dest => dest.Address.Longitude, opt => opt.MapFrom(src => src.Longitude)) .ForPath(dest => dest.Address.Latitude, opt => opt.MapFrom(src => src.Latitude)) .ForPath(dest => dest.Structure, opt => opt.MapFrom(src => src.Structure)) .ForPath(dest => dest.BrandName, opt => opt.MapFrom(src => src.Brands[0])) .ForPath(dest => dest.POIName, opt => opt.MapFrom(src => src.POIName)) .ForPath(dest => dest.CompanyAligns, opt => opt.MapFrom(src => src.CompanyAligns)) .ForPath(dest => dest.BrandAligns, opt => opt.MapFrom(src => src.BrandAligns)) .ForPath(dest => dest.IsPOI, opt => opt.MapFrom(src => src.POI)); CreateMap <Branch, BranchFullDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.Company, opt => opt.MapFrom(src => src.Company)) .ForMember(dest => dest.StreetNumber, opt => opt.MapFrom(src => src.Address.StreetNumber)) .ForMember(dest => dest.StreetName, opt => opt.MapFrom(src => src.Address.StreetName)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)) .ForMember(dest => dest.PostCode, opt => opt.MapFrom(src => src.Address.PostCode)) .ForMember(dest => dest.Longitude, opt => opt.MapFrom(src => src.Address.Longitude)) .ForMember(dest => dest.Latitude, opt => opt.MapFrom(src => src.Address.Latitude)); CreateMap <Branch, BranchNoRatingsDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.StreetNumber, opt => opt.MapFrom(src => src.Address.StreetNumber)) .ForMember(dest => dest.StreetName, opt => opt.MapFrom(src => src.Address.StreetName)) .ForMember(dest => dest.City, opt => opt.MapFrom(src => src.Address.City)) .ForMember(dest => dest.Region, opt => opt.MapFrom(src => src.Address.Region)) .ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.Address.Country)) .ForMember(dest => dest.PostCode, opt => opt.MapFrom(src => src.Address.PostCode)) .ForMember(dest => dest.Latitude, opt => opt.MapFrom(src => src.Address.Latitude)) .ForMember(dest => dest.Longitude, opt => opt.MapFrom(src => src.Address.Longitude)) .AfterMap((src, dest) => { dest.Company = new CompanyLightDTO() { Guid = new ShortGuid(src.Company.Guid).Value, Name = src.Company.Name, PrimarySector = src.Company.PrimarySector.ToString(), SecondarySector = src.Company.SecondarySector.ToString(), Structure = src.Company.Structure.ToString(), HasBranches = src.Company.HasBranches, CompanyDescriptor = src.Company.CompanyDescriptor.ToString(), BranchDescriptor = src.Company.BranchDescriptor.ToString(), StreetNumber = src.Company.Address.StreetNumber, StreetName = src.Company.Address.StreetName, City = src.Company.Address.City, Region = src.Company.Address.Region, Country = src.Company.Address.Country.ToString(), PostCode = src.Company.Address.PostCode }; }); CreateMap <BranchFullDTO, Branch>() .ForMember(dest => dest.Guid, opt => opt.Ignore()) .ForMember(dest => dest.Company, opt => opt.MapFrom(src => src.Company)) .ForPath(dest => dest.Address.StreetNumber, opt => opt.MapFrom(src => src.StreetNumber)) .ForPath(dest => dest.Address.StreetName, opt => opt.MapFrom(src => src.StreetName)) .ForPath(dest => dest.Address.City, opt => opt.MapFrom(src => src.City)) .ForPath(dest => dest.Address.Region, opt => opt.MapFrom(src => src.Region)) .ForPath(dest => dest.Address.Country, opt => opt.MapFrom(src => src.Country.Length == 2 ? src.Country : EnumExtension.GetValueFromDescription <Country>(src.Country).ToString())) .ForPath(dest => dest.Address.PostCode, opt => opt.MapFrom(src => src.PostCode)) .ForPath(dest => dest.Address.Longitude, opt => opt.MapFrom(src => src.Longitude)) .ForPath(dest => dest.Address.Latitude, opt => opt.MapFrom(src => src.Latitude)) .ForMember(dest => dest.BrandName, opt => opt.MapFrom(src => src.Brands[0])) .ForMember(dest => dest.POIName, opt => opt.MapFrom(src => src.POIName)) .ForMember(dest => dest.CompanyAligns, opt => opt.MapFrom(src => src.CompanyAligns)) .ForMember(dest => dest.BrandAligns, opt => opt.MapFrom(src => src.BrandAligns)) .ForMember(dest => dest.IsPOI, opt => opt.MapFrom(src => src.POI)) .ForMember(dest => dest.CountryAligns, opt => opt.MapFrom(src => src.CountryAligns)); CreateMap <Review, ReviewLightDTO>() .ForMember(dest => dest.Guid, opt => opt.MapFrom(src => new ShortGuid(src.Guid).Value)) .ForMember(dest => dest.ReviewedBy, opt => opt.MapFrom(src => src.CreatedBy.UserName)) .ForMember(dest => dest.CompanyName, opt => opt.MapFrom(src => src.Company.Name)) .ForMember(dest => dest.CompanyId, opt => opt.MapFrom(src => new ShortGuid(src.Company.Guid).Value)) .ForMember(dest => dest.Branch, opt => opt.MapFrom(src => src.Branch == null ? null : new BranchNoRatingsDTO() { Guid = new ShortGuid(src.Branch.Guid).Value, StreetNumber = src.Branch.Address.StreetNumber, StreetName = src.Branch.Address.StreetName, City = src.Branch.Address.City, Region = src.Branch.Address.Region, Country = src.Branch.Address.Country.ToString(), PostCode = src.Branch.Address.PostCode, Company = new CompanyLightDTO() { Guid = new ShortGuid(src.Company.Guid).Value } })); //.ForMember(dest => dest.Branch, opt => opt.MapFrom((src, d, dc, ctx) => ctx.Mapper.Map<Branch, BranchNoRatingsDTO>(src.Branch))); CreateMap <ReviewFullDTO, Review>() .ForMember(dest => dest.Guid, opt => opt.Ignore()) .ForMember(dest => dest.Date, opt => opt.Ignore()) .ForMember(dest => dest.Employee, opt => opt.MapFrom(src => src.Employee)) .ForMember(dest => dest.Company, opt => opt.MapFrom(src => src.Company)) .ForMember(dest => dest.Branch, opt => opt.MapFrom(src => src.Branch)) .ForMember(dest => dest.Tags, opt => opt.MapFrom(src => src.Tags)) .ForMember(dest => dest.ConsumerRating, opt => opt.MapFrom(src => src.ConsumerRating)) .ForMember(dest => dest.EmployeeRating, opt => opt.MapFrom(src => src.EmployeeRating)) .ForMember(dest => dest.SocietyRating, opt => opt.MapFrom(src => src.SocietyRating)) .ForMember(dest => dest.ReviewMessage, opt => opt.MapFrom(src => src.ReviewMessage)) .ForMember(dest => dest.Source1, opt => opt.MapFrom(src => src.Source1)) .ForMember(dest => dest.Source2, opt => opt.MapFrom(src => src.Source2)); CreateMap <Report, ReportDTO>(); //CreateMap(typeof(PaginatedList<>), typeof(PaginatedList<>)).ConvertUsing(typeof(PaginatedListConverter<,>)); }
public static IEnumerable <UserCommand> GetScanCodeCommands(int scanCode, EnumArray <UserCommandInput, UserCommand> commands) { return(EnumExtension.GetValues <UserCommand>().Where(uc => ((commands[uc] as UserCommandKeyInput)?.ScanCode == scanCode))); }
public IList <Item> GetList(string query, Sort sort, Filter filter, String[] queryBy, int page, int start, int limit, ref int totalRecords, ref string errMsg) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; #region Filtros if (!string.IsNullOrWhiteSpace(filter.property)) { where += String.Format(" and a.{0} = {1}", filter.property, filter.value); } #endregion Filtros if (!string.IsNullOrEmpty(query)) { string fieldName = "a.ItemName+b.VendorName+a.ItemGYCode"; where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } #region Query By Settings if (!string.IsNullOrEmpty(query)) { string fieldName = ""; if (queryBy.Length == 0) { fieldName = "a.ItemName+b.VendorName+ISNULL(a.ItemGYCode,'')"; } else { foreach (string field in queryBy) { switch (field) { case "ItemName": fieldName += (!String.IsNullOrWhiteSpace(fieldName)) ? " + " : ""; fieldName += "a.ItemName"; break; case "VendorName": fieldName += (!String.IsNullOrWhiteSpace(fieldName)) ? " + " : ""; fieldName += "b.VendorNAme"; break; case "ItemGYCode": fieldName += (!String.IsNullOrWhiteSpace(fieldName)) ? " + " : ""; fieldName += "a.ItemGYCode"; break; default: fieldName += (!String.IsNullOrWhiteSpace(fieldName)) ? " + " : ""; fieldName += field; break; } } } where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } #endregion Query By Settings // Handle Order string order = "a.ItemName"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; } string sql = "SELECT * FROM ( " + "SELECT a.*,b.VendorName as x_VendorName, " + " ROW_NUMBER() OVER (ORDER BY {2} {3}) as row, " + " IsNull((select count(*) from Items a INNER JOIN Vendors b ON a.VendorId=b.VendorId WHERE {0}),0) as TotalRecords " + " FROM Items a INNER JOIN Vendors b ON a.VendorId=b.VendorId WHERE {0}) a " + " WHERE {1} " + " ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); errMsg = ex.Message; return(null); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <Item> data = EnumExtension.ToList <Item>(dt); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
public EnumCheckBoxListRender() { Data = EnumExtension.EnumToSelectItem <T>(); }
public JsonResult Get_MunicipalityCityList() => Json(EnumExtension.EnumToLocalizedList <MunicipalityCityEnum>(_localizer).Select(x => new { Id = x.Value, Name = x.Text }));
public JsonResult Get_ApprovalTypeList() => Json(EnumExtension.EnumToLocalizedList <ApprovalStatus>(_localizer).Select(x => new { Id = x.Value, Name = x.Text }));
/// <summary> /// Returns a new IList<ComboBoxItem<T>> created from source enum. /// Keys and values are mapped from enum values, typically keys are enum values or enum value names /// </summary> private static IList <ComboBoxItem <T> > FromEnumCustomLookup <E, T>(Func <E, T> keyLookup, Func <E, string> valueLookup) where E : Enum { return((from data in EnumExtension.GetValues <E>() select new ComboBoxItem <T>(keyLookup(data), valueLookup(data))).ToList()); }
public static Color GetRandomColor() { var type = EnumExtension.GetRandom <BlockColorType>(); return(type.ToColor()); }
public NHibernateUnitOfWorkFactory( DbProvider provider, string connectionString, string cacheProvider, Assembly[] mappingAssemblies) { _DbProvider = provider; _connectionString = connectionString; FluentConfiguration cfg = null; switch (_DbProvider) { case DbProvider.MsSqlProvider: { cfg = Fluently.Configure().Database(MsSqlConfiguration.MsSql2008 .Raw("format_sql", "true") .ConnectionString(_connectionString)) .ExposeConfiguration( c => c.Properties.Add( Environment.SqlExceptionConverter, typeof(SqlExceptionHandler).AssemblyQualifiedName)) .ExposeConfiguration(c => c.Properties.Add(Environment.DefaultSchema, "dbo")); break; } case DbProvider.SQLiteProvider: { cfg = Fluently.Configure().Database(SQLiteConfiguration.Standard .Raw("format_sql", "true") .ConnectionString(_connectionString)); _InMemoryDatabase = _connectionString.ToUpperInvariant().Contains(":MEMORY:"); break; } case DbProvider.SqlCe: { cfg = Fluently.Configure().Database(MsSqlCeConfiguration.Standard .Raw("format_sql", "true") .ConnectionString(_connectionString)) .ExposeConfiguration( c => c.Properties.Add( Environment.SqlExceptionConverter, typeof(SqlExceptionHandler).AssemblyQualifiedName)); _validationSupported = false; break; } case DbProvider.Firebird: { cfg = Fluently.Configure().Database(new FirebirdConfiguration() .Raw("format_sql", "true") .ConnectionString(_connectionString)); break; } case DbProvider.PostgreSQLProvider: { cfg = Fluently.Configure().Database(PostgreSQLConfiguration.PostgreSQL82 .Raw("format_sql", "true") .ConnectionString(_connectionString)); _validationSupported = false; break; } } Guard.IsNotNull( cfg, string.Format( "Db provider {0} is currently not supported.", EnumExtension.GetEnumMemberValue(_DbProvider))); PropertyInfo pinfo = typeof(FluentConfiguration) .GetProperty( "Configuration", BindingFlags.Instance | BindingFlags.NonPublic); Configuration nhConfiguration = pinfo.GetValue(cfg, null) as Configuration; ServiceLocator.RegisterInstance <Configuration>(nhConfiguration); cfg.Mappings(m => { m.FluentMappings.Conventions.AddAssembly(typeof(NHibernateUnitOfWorkFactory <TIdentifier>).Assembly); foreach (Assembly mappingAssembly in mappingAssemblies) { m.FluentMappings.Conventions.AddAssembly(mappingAssembly); } }) .Mappings(m => { m.FluentMappings.AddFromAssembly(typeof(NHibernateUnitOfWorkFactory <TIdentifier>).Assembly); foreach (Assembly mappingAssembly in mappingAssemblies) { m.FluentMappings.AddFromAssembly(mappingAssembly); } }) .Mappings(m => { m.HbmMappings.AddFromAssembly(typeof(NHibernateUnitOfWorkFactory <TIdentifier>).Assembly); foreach (Assembly mappingAssembly in mappingAssemblies) { m.HbmMappings.AddFromAssembly(mappingAssembly); } }) .ExposeConfiguration(c => c.Properties.Add(Environment.BatchSize, "100")) .ExposeConfiguration(c => c.Properties.Add(Environment.UseProxyValidator, "true")); if (!string.IsNullOrEmpty(cacheProvider)) { cfg.ExposeConfiguration(c => c.Properties.Add(Environment.CacheProvider, cacheProvider)) .ExposeConfiguration(c => c.Properties.Add(Environment.UseSecondLevelCache, "true")) .ExposeConfiguration(c => c.Properties.Add(Environment.UseQueryCache, "true")); } _builtConfiguration = cfg.BuildConfiguration(); _builtConfiguration.SetProperty( Environment.ProxyFactoryFactoryClass, typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName); #region Add Listeners to NHibernate pipeline.... _builtConfiguration.SetListeners( ListenerType.Flush, new IFlushEventListener[] { new FixedDefaultFlushEventListener() }); _builtConfiguration.SetListeners( ListenerType.FlushEntity, new IFlushEntityEventListener[] { new AuditFlushEntityEventListener <TIdentifier>() }); _builtConfiguration.SetListeners( ListenerType.PreInsert, _builtConfiguration.EventListeners.PreInsertEventListeners.Concat( new IPreInsertEventListener[] { new ValidateEventListener(), new AuditEventListener <TIdentifier>() }).ToArray()); _builtConfiguration.SetListeners( ListenerType.PreUpdate, _builtConfiguration.EventListeners.PreUpdateEventListeners.Concat( new IPreUpdateEventListener[] { new ValidateEventListener(), new AuditEventListener <TIdentifier>() }).ToArray()); #endregion }
public IList <PaymentVendor> GetList(string query, Sort sort, int page, int start, int limit, ref int totalRecords, ref string errMsg) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; // Handle Order string order = "a.PayVendorDate"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; } string sql = "SELECT * FROM ( " + "SELECT a.*, " + " ROW_NUMBER() OVER (ORDER BY {2} {3}) as row, " + " IsNull((select count(*) from PaymentVendors a WHERE {0}),0) as TotalRecords " + " FROM PaymentVendors a WHERE {0}) a " + " WHERE {1} " + " ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); errMsg = ex.Message; return(null); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <PaymentVendor> data = EnumExtension.ToList <PaymentVendor>(dt); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
public static BlockGroupInfo GetRandomBlock() { return(new BlockGroupInfo(EnumExtension.GetRandom <BlockShapeType>(), EnumExtension.GetRandom <BlockColorType>())); }
public IList <GastosGrupoItem> GetWithQuery(string query, Sort sort, int page, int start, int limit, ref int totalRecords) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; if (!string.IsNullOrEmpty(query)) { string fieldName = "GGrupoItemNombre+STR(GGrupoItemId)"; where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } // Ordenamiento string order = "GGrupoItemNombre"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; //if (order == "x_Estatus") order = "EstatusTipo"; } string sql = "SELECT * FROM ( " + "SELECT *, " + " ROW_NUMBER() OVER (ORDER BY {2} {3}) as row, " + " IsNull((select count(*) from GastosGruposItems WHERE {0}),0) as TotalRecords " + " FROM GastosGruposItems WHERE {0}) a " + " WHERE {1} " + " ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <GastosGrupoItem> data = EnumExtension.ToList <GastosGrupoItem>(dt); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
public IList <DocumentType> GetList(string query, Sort sort, int page, int start, int limit, ref int totalRecords, ref string errMsg) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; if (!string.IsNullOrEmpty(query)) { string fieldName = "DocTypeName"; where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } // Handle Order string order = "DocTypeName"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; } string sql = @"WITH qData AS ( SELECT *, ROW_NUMBER() OVER (ORDER BY {2} {3}) as row FROM DocumentTypes WHERE {0} ) SELECT t1.*, t2.TotalRecords FROM qData as t1 INNER JOIN (select TOP 1 row as TotalRecords from qData order by row desc) as t2 ON 1=1 WHERE {1} ORDER BY row"; sql = String.Format(sql, where, wherepage, order, direction); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); errMsg = ex.Message; return(null); } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <DocumentType> data = EnumExtension.ToList <DocumentType>(dt); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
/// <summary> /// 获取当前语言 /// </summary> /// <returns></returns> public LanguageEnum GetLanguage() { return(EnumExtension.GetEnum <LanguageEnum>(language)); }
public object ConvertBack(object pObjValue, Type pObjTargetType, object pObjParameter, CultureInfo pObjCulture) { return(EnumExtension.GetValueFromDescription <EntityStatusEnum>(pObjValue.ToString())); }
/// <summary> /// 设置语言 /// </summary> /// <param name="language"></param> public void SetLanguage(LanguageEnum language) { this.language = EnumExtension.GetEnumName(language); }
public async Task <User> Add(UserModel userModel) { var user = UserFactory.NewUser(userModel.Name, userModel.Email); user.AddProfile(new UserProfile(userModel.Document, userModel.Address, userModel.Avatar, EnumExtension.Parse <ProfileType>(userModel.Type).Value)); user.SetAsActive(); _userRepository.Add(user); await _userRepository.UnitOfWork.Commit(); return(user); }
/// <summary> /// 得到数据源 /// </summary> /// <returns></returns> protected virtual object GetEnumSource() { DataTextField = "Message"; DataValueField = "Name"; return(EnumExtension.GetNames(ObjectName)); }
public ResponseVendorReportListModel Create(IEnumerable <Customer> customers, IEnumerable <Language> languages, IEnumerable <EventCustomer> eventCustomers, IEnumerable <Appointment> appointments, IEnumerable <Event> events, IEnumerable <Call> calls, IEnumerable <PcpAppointment> pcpAppointments, IEnumerable <PcpDisposition> pcpDispositions, IEnumerable <EventCustomerBarrier> eventCustomerBarriers, IEnumerable <Barrier> barriers, IEnumerable <ChaseOutbound> chaseOutbounds, IEnumerable <CustomerChaseCampaign> customerChaseCampaigns, IEnumerable <ChaseCampaign> chaseCampaigns, IEnumerable <ChaseCampaignType> chaseCampaignTypes, IEnumerable <EventAppointmentCancellationLog> eventAppointmentCancellationLogs, IEnumerable <CustomerInfo> resultPostedCustomers, IEnumerable <CustomerEligibility> customerEligibilities) { var collection = new List <ResponseVendorReportViewModel>(); foreach (var customer in customers) { var customerCalls = calls.Where(x => x.CalledCustomerId == customer.CustomerId).OrderByDescending(x => x.CallDateTime).ToArray(); var customerEligibility = customerEligibilities.FirstOrDefault(x => x.CustomerId == customer.CustomerId); var recentCall = customerCalls.Any() ? customerCalls.First() : null; var language = customer.LanguageId.HasValue ? languages.First(x => x.Id == customer.LanguageId.Value) : null; var appointmentBookedCalls = customerCalls.OrderByDescending(x => x.CallDateTime).FirstOrDefault(x => x.EventId > 0); var eventCustomer = appointmentBookedCalls != null?eventCustomers.FirstOrDefault(x => x.EventId == appointmentBookedCalls.EventId && x.CustomerId == customer.CustomerId) : null; if (appointmentBookedCalls != null && eventCustomer == null) { eventCustomer = eventCustomers.FirstOrDefault(x => x.CustomerId == customer.CustomerId && x.AppointmentId.HasValue); } var theEvent = eventCustomer != null?events.First(x => x.Id == eventCustomer.EventId) : null; var appointment = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? appointments.Single(x => x.Id == eventCustomer.AppointmentId.Value) : null; var totalDuration = customerCalls.Where(x => x.StartTime.HasValue && x.EndTime.HasValue && x.EndTime.Value > x.StartTime.Value).Select(x => x.EndTime.Value.Subtract(x.StartTime.Value)).Aggregate(new TimeSpan(0), (p, v) => p.Add(v)); var pcpAppointment = eventCustomer != null?pcpAppointments.FirstOrDefault(x => x.EventCustomerId == eventCustomer.Id) : null; var pcpDisposition = eventCustomer != null?pcpDispositions.FirstOrDefault(x => x.EventCustomerId == eventCustomer.Id) : null; var eventCustomerBarrier = eventCustomer != null?eventCustomerBarriers.FirstOrDefault(x => x.EventCustomerId == eventCustomer.Id) : null; var barrier = eventCustomerBarrier != null?barriers.FirstOrDefault(x => x.Id == eventCustomerBarrier.BarrierId) : null; var chaseOutbound = chaseOutbounds.FirstOrDefault(x => x.CustomerId == customer.CustomerId); if (chaseOutbound == null) { continue; } var customerChaseCampaign = !customerChaseCampaigns.IsNullOrEmpty() ? customerChaseCampaigns.FirstOrDefault(x => x.CustomerId == customer.CustomerId) : null; var campaign = !chaseCampaigns.IsNullOrEmpty() && customerChaseCampaign != null?chaseCampaigns.FirstOrDefault(x => x.Id == customerChaseCampaign.ChaseCampaignId) : null; var campaignType = campaign != null?chaseCampaignTypes.FirstOrDefault(x => x.Id == campaign.ChaseCampaignTypeId) : null; string serviceStatus = string.Empty; string campaignOutcome = string.Empty; CustomerInfo resultPostedCustomer = null; if (eventCustomer != null && eventCustomer.AppointmentId.HasValue && appointment != null) { serviceStatus = RequirementStatus.Open.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.BookedAppointment); if (appointment.CheckInTime.HasValue && appointment.CheckOutTime.HasValue && !eventCustomer.NoShow && !eventCustomer.LeftWithoutScreeningReasonId.HasValue) { serviceStatus = RequirementStatus.Completed.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.AssessmentCompleted); } else if (eventCustomer.NoShow) { serviceStatus = RequirementStatus.Cancelled.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.NoShow); } else if (eventCustomer.LeftWithoutScreeningReasonId.HasValue) { serviceStatus = RequirementStatus.Cancelled.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.LeftWithoutScreening); } resultPostedCustomer = resultPostedCustomers.FirstOrDefault(x => x.CustomerId == customer.CustomerId && x.EventId == theEvent.Id); } else { if (eventCustomer != null && !eventCustomer.AppointmentId.HasValue) { serviceStatus = RequirementStatus.Cancelled.ToString(); var eventAppointmentCancellationLog = eventAppointmentCancellationLogs.FirstOrDefault(x => x.EventCustomerId == eventCustomer.Id); var reason = eventAppointmentCancellationLog != null ? ((CancelAppointmentReason)eventAppointmentCancellationLog.ReasonId).ToString() : ""; try { campaignOutcome = !string.IsNullOrEmpty(reason) ? EnumExtension.GetDescription(((RequirementStatusDescription)Enum.Parse(typeof(RequirementStatusDescription), reason))) : ""; } catch (Exception) { campaignOutcome = eventAppointmentCancellationLog != null?EnumExtension.GetDescription(((CancelAppointmentReason)eventAppointmentCancellationLog.ReasonId)) : ""; } if (eventAppointmentCancellationLog != null) { customerCalls = customerCalls.Where(x => x.CallDateTime > eventAppointmentCancellationLog.DateCreated).OrderBy(x => x.CallDateTime).ToArray(); } } if (customerCalls.Any()) { if (recentCall != null && recentCall.Disposition == ProspectCustomerTag.Deceased.ToString() || recentCall.Disposition == ProspectCustomerTag.DoNotCall.ToString() || recentCall.Disposition == ProspectCustomerTag.MobilityIssue.ToString() || recentCall.Disposition == ProspectCustomerTag.TransportationIssue.ToString() || recentCall.Disposition == ProspectCustomerTag.MobilityIssues_LeftMessageWithOther.ToString() || recentCall.Disposition == ProspectCustomerTag.IncorrectPhoneNumber.ToString() || recentCall.Disposition == ProspectCustomerTag.DebilitatingDisease.ToString() || recentCall.Disposition == ProspectCustomerTag.NoLongeronInsurancePlan.ToString() || recentCall.Disposition == ProspectCustomerTag.HomeVisitRequested.ToString() || recentCall.Disposition == ProspectCustomerTag.MemberStatesIneligibleMastectomy.ToString()) { serviceStatus = RequirementStatus.Cancelled.ToString(); try { campaignOutcome = EnumExtension.GetDescription(((RequirementStatusDescription)Enum.Parse(typeof(RequirementStatusDescription), recentCall.Disposition))); } catch (Exception) { campaignOutcome = EnumExtension.GetDescription(((ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), recentCall.Disposition))); } /*if (string.IsNullOrEmpty(requirementStatusDescription)) * { * requirementStatusDescription = !eventCustomer.AppointmentId.HasValue && cancellationNote != null && !string.IsNullOrEmpty(cancellationNote.Notes) ? ReplaceNewLine(Truncate(cancellationNote.Notes, 0, 250), " ") : ""; * }*/ } else if (customerCalls.Count() <= 10) { serviceStatus = RequirementStatus.Open.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.CallAttempt) + " " + customerCalls.Count(); } else if (customerCalls.Count() > 10) { serviceStatus = RequirementStatus.Cancelled.ToString(); campaignOutcome = EnumExtension.GetDescription(RequirementStatusDescription.MemberCalledMaxAttempts); } } else if (eventCustomer == null) { serviceStatus = string.IsNullOrEmpty(serviceStatus) ? RequirementStatus.Hold.ToString() : serviceStatus; } } if (serviceStatus == RequirementStatus.Open.ToString() || serviceStatus == RequirementStatus.Hold.ToString()) { serviceStatus = RequirementStatus.Cancelled.ToString(); } var responseVendorReportViewModel = new ResponseVendorReportViewModel { TenantId = chaseOutbound.TenantId, ClientId = chaseOutbound.ClientId, CampaignId = campaign != null ? campaign.CampaignId : "", IndividualIdNumber = chaseOutbound.IndividualId, ContractNumber = chaseOutbound.ContractNumber, ContractPersonNumber = chaseOutbound.ContractPersonNumber, ConsumerId = chaseOutbound.ConsumerId, VendorPersonId = customer.CustomerId.ToString(), CampaignType = campaignType != null ? campaignType.Name : "", FirstName = customer.Name.FirstName, MiddleInitial = !string.IsNullOrEmpty(customer.Name.MiddleName) ? customer.Name.MiddleName.Substring(0, 1) : string.Empty, LastName = customer.Name.LastName, GenderCode = customer.Gender == Gender.Male ? GenderMaleAbbr : (customer.Gender == Gender.Female ? GenderFemaleAbbr : GenderUnspecifiedAbbr), BirthDate = customer.DateOfBirth, Height = customer.Height != null ? ((customer.Height.Feet * 12) + customer.Height.Inches).ToString() : "", Weight = customer.Weight != null && customer.Weight.Pounds > 0 ? Math.Round(customer.Weight.Pounds).ToString() : "", EligibilityDate = customerEligibility != null && customerEligibility.IsEligible.HasValue && customerEligibility.IsEligible.Value ? DateTime.Now : (DateTime?)null, HealthAssessComp = eventCustomer != null && appointment != null && appointment.CheckInTime.HasValue && !eventCustomer.NoShow && !eventCustomer.LeftWithoutScreeningReasonId.HasValue ? AbbrYes : AbbrNo, HealthAssessCompDate = eventCustomer != null && appointment != null && appointment.CheckInTime.HasValue && !eventCustomer.NoShow && !eventCustomer.LeftWithoutScreeningReasonId.HasValue ? theEvent.EventDate : (DateTime?)null, Race = EnumExtension.GetDescription(customer.Race), LanguagePreferenceUpdate = language != null ? language.Name : null, MemberPhonePreference = PhoneNumber.ToNumber(customer.HomePhoneNumber.ToString()), MemberSecondPhonePreference = PhoneNumber.ToNumber(customer.MobilePhoneNumber.ToString()), MemberEmailPreference = customer.Email.ToString(), NewProviderName = customer.PrimaryCarePhysician != null ? customer.PrimaryCarePhysician.Name.FullName : "", NewProviderId = customer.PrimaryCarePhysician != null?customer.PrimaryCarePhysician.Id.ToString() : "", CareBarrier1 = barrier != null ? barrier.Name : "", /*ApptScheduled = pcpAppointment != null ? AbbrYes : AbbrNo, * ApptScheduledDate = pcpAppointment != null ? pcpAppointment.AppointmentOn : (DateTime?)null, * ApptScheduledTime = pcpAppointment != null ? pcpAppointment.AppointmentOn : (DateTime?)null,*/ ApptScheduled = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? AbbrYes : AbbrNo, ApptScheduledDate = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? theEvent.EventDate : (DateTime?)null, ApptScheduledTime = appointment != null ? appointment.StartTime : (DateTime?)null, ApptScheduledProviderName = pcpAppointment != null && customer.PrimaryCarePhysician != null ? customer.PrimaryCarePhysician.Name.FullName : "", ApptScheduledProviderId = pcpAppointment != null && customer.PrimaryCarePhysician != null?customer.PrimaryCarePhysician.Id.ToString() : "", ServiceCode = RequirementCode, ServiceStatus = serviceStatus, CampaignOutcome = campaignOutcome, ServiceStartDate = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? theEvent.EventDate : recentCall != null ? recentCall.CallDateTime : (DateTime?)null, ServiceEndDate = eventCustomer != null && eventCustomer.AppointmentId.HasValue ? theEvent.EventDate : (DateTime?)null, ServiceStatusTime = appointment != null ? appointment.StartTime : (DateTime?)null, LengthOfCall = totalDuration.Seconds == 0 ? "" : new DateTime(totalDuration.Ticks).ToString("HH:mm:ss"), DoNotContact = customer.DoNotContactTypeId.HasValue && customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotContact ? AbbrYes : AbbrNo, DoNotCall = customer.DoNotContactTypeId.HasValue && customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotCall ? AbbrYes : AbbrNo, CallAttempt1Datetime = customerCalls.Any() ? customerCalls.First().CallDateTime : (DateTime?)null, CallAttempt2Datetime = customerCalls.Any() && customerCalls.Count() >= 2 ? customerCalls.ElementAt(1).CallDateTime : (DateTime?)null, CallAttempt3Datetime = customerCalls.Any() && customerCalls.Count() >= 3 ? customerCalls.ElementAt(2).CallDateTime : (DateTime?)null, CallAttempt4Datetime = customerCalls.Any() && customerCalls.Count() >= 4 ? customerCalls.ElementAt(3).CallDateTime : (DateTime?)null, CallAttempt5Datetime = customerCalls.Any() && customerCalls.Count() >= 5 ? customerCalls.ElementAt(4).CallDateTime : (DateTime?)null, CallAttempt6Datetime = customerCalls.Any() && customerCalls.Count() >= 6 ? customerCalls.ElementAt(5).CallDateTime : (DateTime?)null, CallAttempt7Datetime = customerCalls.Any() && customerCalls.Count() >= 7 ? customerCalls.ElementAt(6).CallDateTime : (DateTime?)null, CallAttempt8Datetime = customerCalls.Any() && customerCalls.Count() >= 8 ? customerCalls.ElementAt(7).CallDateTime : (DateTime?)null, NoResponse = totalDuration.Seconds == 0 ? AbbrYes : AbbrNo, AcceptedScheduleAssistance = pcpDisposition != null && pcpDisposition.Disposition == PcpAppointmentDisposition.ScheduledHealthFairBooked ? AbbrYes : AbbrNo, AcceptedScheduleAssistanceDate = pcpDisposition != null ? pcpDisposition.DataRecorderMetaData.DateCreated : (DateTime?)null, Assisted = pcpDisposition != null && pcpDisposition.Disposition == PcpAppointmentDisposition.ScheduledHealthFairBooked ? AbbrYes : AbbrNo, AppointmentNotRequired = pcpDisposition != null && (pcpDisposition.Disposition == PcpAppointmentDisposition.DeniedRefusesToReviewHealthFairResults || pcpDisposition.Disposition == PcpAppointmentDisposition.DeniedNotCurrentPatient || pcpDisposition.Disposition == PcpAppointmentDisposition.DeniedRequiresPatientCallDirectly) ? AbbrYes : AbbrNo, FormSubmitted = resultPostedCustomer != null ? AbbrYes : AbbrNo //PreferredContactMethod = pcpAppointment != null ? ((PreferredContactMethod)pcpAppointment.PreferredContactMethod).GetDescription() : "" }; collection.Add(responseVendorReportViewModel); } return(new ResponseVendorReportListModel { Collection = collection }); }
public IList <CustomerShipAddress> GetList(FieldFilters fieldFilters, string query, Sort sort, int page, int start, int limit, ref int totalRecords) { limit = limit + start; SqlConnection oConn = null; try { oConn = ConnManager.OpenConn(); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); throw; }; string wherepage = (page != 0) ? String.Format("row>{0} and row<={1} ", start, limit) : "1=1"; string where = "1=1"; #region Field Filters if (fieldFilters.fields != null && fieldFilters.fields.Count > 0) { foreach (var item in fieldFilters.fields) { string value = item.value; string name = item.name; if (item.type == "string" || item.type == "date") { value = "'" + value + "'"; } if (item.type == "date") { name = String.Format("CAST({0} as DATE)", name); } where += String.Format(" AND {0} = {1}", name, value); } } #endregion Field Filters if (!string.IsNullOrEmpty(query)) { string fieldName = "CustShipAddress"; where += (!string.IsNullOrEmpty(where) ? " and " : "") + EnumExtension.generateLikeWhere(query, fieldName); } // Handle Order string order = "CustShipKey"; string direction = "ASC"; if (!string.IsNullOrWhiteSpace(sort.property)) { order = sort.property; direction = sort.direction; } string sql = @"WITH qData AS ( SELECT *, ROW_NUMBER() OVER (ORDER BY {2} {3}) as row FROM vCustShipAddress WHERE {0} ) SELECT {4} a.*, t5.TotalRecords FROM qData a CROSS APPLY (select MAX(row) as TotalRecords from qData) as t5 WHERE {1} ORDER BY row "; where = (where.StartsWith("1=1 AND ")) ? where.Replace("1=1 AND ", "") : where; string topLimit = ((@limit > 0) ? String.Format(" TOP {0} ", @limit) : ""); sql = String.Format(sql, where, wherepage, order, direction, topLimit); SqlDataAdapter da = new SqlDataAdapter(sql, oConn); DataSet ds = new DataSet(); try { da.Fill(ds); } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); LogManager.Write(sql); throw; } ConnManager.CloseConn(oConn); DataTable dt; dt = ds.Tables[0]; totalRecords = dt.Rows.Count; if (totalRecords > 0) { IList <CustomerShipAddress> data = dt.ToList <CustomerShipAddress>(); totalRecords = Convert.ToInt32(dt.Rows[0]["TotalRecords"]); return(data); } else { return(null); } }
protected override PropertyManagerPageOptionBoxControl Create(PropertyManagerPageGroupBase group, IAttributeSet atts, ref int idRange) { idRange = EnumExtension.GetEnumFields(atts.BoundType).Count; return(base.Create(group, atts)); }
public JsonResult Get_AuthorityTypeEnumList() => Json(EnumExtension.EnumToLocalizedList <AuthorityTypeEnum>(_localizer).Select(x => new { Id = x.Value, Name = x.Text }));