public JsonResult WPSNotify(WPSNotifyRequest body) { _log.WriteInfo("开始请求接口【onnotify】"); WPSBaseModel result = new WPSBaseModel(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { result.code = (int)Enumerator.ErrorCode.OK; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【onnotify】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
public bool IsShowingPlatformSetup(Platform platformName) { var setupPlatformDoc = Browser.Driver.FindElement(By.CssSelector("#ShowDocumentationDiv>h1")); string platformDescription = EnumExtension.GetDescription(platformName).ToLower(); return(setupPlatformDoc.Text.ToLower().Contains(platformDescription)); }
public string GetStatus() { if (Script != null) { //ToDo translation via catalog string state = EnumExtension.GetDescription(Script.GetState()); string fraction = GetStateFractionScripted(); if (String.IsNullOrEmpty(state) && String.IsNullOrEmpty(fraction)) { return(String.Empty); } else if (!String.IsNullOrEmpty(state) && String.IsNullOrEmpty(fraction)) { return(state); } else if (String.IsNullOrEmpty(state) && !String.IsNullOrEmpty(fraction)) { return(fraction); } else { return(String.Format("{0} {1}", state, fraction)); } } else { return(String.Empty); } }
public virtual string GetStatus() { if (Notches.Count == 0) { return(string.Format("{0:F0}%", 100 * CurrentValue)); } INotchController notch = Notches[CurrentNotch]; //TODO translation via (static?) Catalog //also if NotchStateType == ControllerState.Running, need to use GetParticularString using ControllerState enum description attribute for context string name = EnumExtension.GetDescription(notch.NotchStateType); if (!notch.Smooth && notch.NotchStateType == ControllerState.Dummy) { return(string.Format("{0:F0}%", 100 * CurrentValue)); } if (!notch.Smooth) { return(name); } if (!string.IsNullOrEmpty(name)) { return(string.Format("{0} {1:F0}%", name, 100 * GetNotchFraction())); } return(string.Format("{0:F0}%", 100 * GetNotchFraction())); }
public void EnumSpecifyLoopDescriptionTest() { string description = null; TimeMonitor.WatchLoop("获取枚举描述", 100, () => { description = EnumExtension.GetDescription(GenderType.Male); }, str => output.WriteLine(str) ); output.WriteLine($"{GenderType.Male}:{description}"); }
public JsonResultModel CreateTable(string dbName, TableVo tableVo) { JsonResultModel response = new JsonResultModel(); CreateTableResult returnValue = RealCreateTable(dbName, tableVo); response.Status = (int)returnValue; response.Message = EnumExtension.GetDescription(returnValue); return(response); }
public JsonResultModel Create(TransformVo transform) { JsonResultModel response = new JsonResultModel(); CreateTransformResult returnValue = RealCreateTransform(transform); response.Status = (int)returnValue; response.Message = EnumExtension.GetDescription(returnValue); return(response); }
public JsonResultModel Create(TemplateVo template) { CreateTemplateResult returnValue = RealCreateTransform(template); JsonResultModel response = new JsonResultModel(); response.Status = (int)returnValue; response.Message = EnumExtension.GetDescription(returnValue); return(response); }
public bool IsShowingPlatformSetup(Platform platformName) { var setupPlatformDoc = GraphBrowser.Driver.FindElement(By.CssSelector("#ShowDocumentationDiv>h4")); string platformDescription = EnumExtension.GetDescription(platformName).ToLower(); //iOS swift and objective C descriptions only contain the word "ios," not full platform name if (platformDescription.Contains("ios")) { return(setupPlatformDoc.Text.ToLower().Contains("ios")); } return(setupPlatformDoc.Text.ToLower().Contains(platformDescription)); }
private CampaignActivityEditModel CampaignActivityDomainToModel(CampaignActivity activity) { return(new CampaignActivityEditModel { ActivityId = activity.Id, ActivityDate = activity.ActivityDate, Sequence = activity.Sequence, ActivityType = activity.TypeId, DirectMailType = activity.DirectMailTypeId ?? 0, Name = EnumExtension.GetDescription(((CampaignActivityType)activity.TypeId)) }); }
public JsonResult RenameFile(RenameFileRequest body) { _log.WriteInfo("开始请求接口【file/rename】,请求参数:" + JsonConvert.SerializeObject(body)); WPSBaseModel result = new WPSBaseModel(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { #region 在测试环境暂时不要将此块房开,由于上面获取文件名是固定的,成功更改文件成功后,不能打开文件 //var fileName = request.FileId == "1000" ? "TestFile.docx" : (request.FileId == "1001" ? "TestFile_v1.docx" : "TestFile_v2.docx"); ////原文件的物理路径 //string filePath = Server.MapPath($"/Files/{fileName}"); //// 移动到的新位置的物理路径(如果还是当前文件夹, 则会重命名文件) //string fileTargetPath = Server.MapPath($"/Files/{body.name}"); ////判断到的新地址是否存在重命名文件 //if (System.IO.File.Exists(fileTargetPath)) //{ // result.code = (int)Enumerator.ErrorCode.文件已存在; // result.message = EnumExtension.GetDescription(Enumerator.ErrorCode.文件已存在); //} //System.IO.File.Move(filePath, fileTargetPath);//2个文件在不同目录则是移动,如果在相同目录下则是重命名 #endregion result.code = (int)Enumerator.ErrorCode.OK; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/rename】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
public JsonResult Version(int version) { _log.WriteInfo("开始请求接口【file/version】"); GetFileByVersionResult result = new GetFileByVersionResult(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { // 从数据库查询文件信息...... // 创建时间和修改时间默认全是现在 var now = TimestampHelper.GetCurrentTimestamp(); var fileName = version == 1 ? "TestFile_v1.docx" : (version == 2 ? "TestFile_v2.docx" : "TestFile.docx"); string filePath = Server.MapPath($"/Files/{fileName}"); result.file = new GetFileResult { id = request.FileId, name = fileName, version = version, size = FileHelper.FileSize(filePath), // WPS单位是B, create_time = now, creator = "天玺", modify_time = now, modifier = "天玺", download_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/{fileName}" }; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/version】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result, JsonRequestBehavior.AllowGet)); }
static TrackViewerSettings() { if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Json)))) { SettingsStoreType = StoreType.Json; } if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Ini)))) { SettingsStoreType = StoreType.Ini; } else { SettingsStoreType = StoreType.Registry; Location = EnumExtension.GetDescription(StoreType.Registry); } }
#pragma warning disable CA1810 // Initialize reference type static fields inline static TrackViewerSettings() #pragma warning restore CA1810 // Initialize reference type static fields inline { if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Json)))) { SettingsStoreType = StoreType.Json; } if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Ini)))) { SettingsStoreType = StoreType.Ini; } else { SettingsStoreType = StoreType.Registry; Location = EnumExtension.GetDescription(StoreType.Registry); } }
public JsonResult SaveFile() { _log.WriteInfo("开始请求接口【file/save】"); SaveFileResult result = new SaveFileResult(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { var fileName = request.FileId == "1000" ? "TestFile.docx" : (request.FileId == "1001" ? "TestFile_v1.docx" : "TestFile_v2.docx"); HttpFileCollection files = HttpContext.ApplicationInstance.Request.Files; foreach (string key in files.AllKeys) { HttpPostedFile file = files[key]; if (string.IsNullOrEmpty(file.FileName) == false) { file.SaveAs(Server.MapPath("~/Files/") + fileName); } } result.file = new WPSFileModel { download_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/{fileName}", id = request.FileId, name = request.Params["_w_fileName"].ToString() }; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/save】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
public JsonResult NewFile(CreateWPSFileRequest request) { _log.WriteInfo("开始请求接口【file/new】"); var result = new CreateWPSFileResult(); try { var filterRequest = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!filterRequest.Status) { result.code = filterRequest.code; result.message = filterRequest.message; result.details = filterRequest.details; result.hint = filterRequest.hint; } else { HttpFileCollection files = HttpContext.ApplicationInstance.Request.Files; string fileName = Guid.NewGuid().ToString("N") + ".docx"; foreach (string key in files.AllKeys) { HttpPostedFile file = files[key]; if (string.IsNullOrEmpty(file.FileName) == false) { file.SaveAs(Server.MapPath("~/Files/") + fileName); } } result.redirect_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/{fileName}"; result.user_id = "1000"; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/new】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
public JsonResult GetUserInfo(GetUserInfoRequest body) { _log.WriteInfo("开始请求接口【user/info】"); UserModelList result = new UserModelList(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { result.users = new List <UserModel>(); result.users.Add(new UserModel { id = "1000", name = "天玺", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo1.jpg", }); result.users.Add(new UserModel { id = "1001", name = "兆丰", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo2.jpg" }); } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【user/info】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
public JsonResult Online(GetUserInfoRequest body) { _log.WriteInfo("开始请求接口【file/online】"); WPSBaseModel result = new WPSBaseModel(); try { result.code = 200; result.message = "success"; } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/online】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }
internal static void SetBufferAppearance(BootstrapTheme theme, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { lock (Bootstrap.Threads) { string descTheme = EnumExtension.GetDescription(theme); string descType = EnumExtension.GetDescription(type); string fgColor = (theme != BootstrapTheme.LigthColor ? descType : $"Dark{descType}"); string bgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); if (style == BootstrapStyle.Text) { fgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); } Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), fgColor, true); Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), (style != BootstrapStyle.Text ? bgColor : "Black"), true); } FillLineBackground(fillLineBackground); }
static UserSettings() { //TODO: user settings (as any other runtime data) may not be saved in exe folder (which might be under \Program Files if installed via installer) // default user settings are searched in order: Json, Ini, Registry if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Json)))) { SettingsStoreType = StoreType.Json; } if (File.Exists(Location = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), EnumExtension.GetDescription(StoreType.Ini)))) { SettingsStoreType = StoreType.Ini; } else { SettingsStoreType = StoreType.Registry; Location = EnumExtension.GetDescription(StoreType.Registry); } UserDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName); Directory.CreateDirectory(UserDataFolder); DeletedSaveFolder = Path.Combine(UserDataFolder, "Deleted Saves"); SavePackFolder = Path.Combine(UserDataFolder, "Save Packs"); }
public static bool SaveConfig(Guid oemId, Dictionary <ConfigUseType, Tuple <string, string> > config, string opAccount) { bool success = false; IAirlineConfigRepository repository = Factory.CreateAirlineConfigRepository(); success = repository.SaveConfig(oemId, config); LogService.SaveOperationLog(new OperationLog(OperationModule.OEM信息设置, OperationType.Update, opAccount, OperatorRole.Platform, "修改OEM指令配置", config.Aggregate(string.Empty, (result, pair) => string.Format("{0}配置用途:{1},用户名{2};OfficeNO:{3} ", result, EnumExtension.GetDescription(pair.Key), pair.Value.Item1, pair.Value.Item2)) + "修改" + (success?"是":"否"))); return(success); }
/// <summary> /// 服务注册配置应用程序的服务This method gets called by the runtime. Use this method to add services to the container. /// </summary> /// <param name="services">服务</param> public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); #region 添加Swagger var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; //var basePath = AppDomain.CurrentDomain.BaseDirectory; services.AddSwaggerGen(c => { var enumGroup = typeof(ApiGroups); //遍历出全部的版本,做文档信息展示 enumGroup.GetEnumNames().ToList().ForEach(name => { var value = Convert.ToInt32(Enum.Parse(enumGroup, name)); string description = EnumExtension.GetDescription(enumGroup, value); c.SwaggerDoc(name, new Info { // {ApiName} 定义成全局变量,方便修改 Version = name, Title = $"{ApiName} 接口文档", Description = description, TermsOfService = "None", Contact = new Contact { Name = "Dncthic.WebAPI", Email = "*****@*****.**", Url = "https://www.baidu.com" } }); // 按相对路径排序 c.OrderActionsBy(o => o.RelativePath); }); #region 获取接口描述并赋默认值(废弃) //c.DocInclusionPredicate((docName, description) => //{ // description.TryGetMethodInfo(out MethodInfo mi); // var attr = mi.DeclaringType.GetCustomAttribute<ApiExplorerSettingsAttribute>(); // if (attr != null) // { // return attr.GroupName == docName; // } // else { // return attr.GroupName == "Default"; // } // //else if(string.IsNullOrEmpty(groupName.ToString())) // //{ // // return docName == "Default"; // //} // //if (!description.TryGetMethodInfo(out MethodInfo mi)) return false; // //var groupName = mi.DeclaringType.GetCustomAttributes(true).OfType<ApiExplorerSettingsAttribute>().Select(attr => attr.GroupName); // //if (groupName.FirstOrDefault() == null) // //{ // // return docName == "Default"; // //} // //else // //{ // // return groupName.Any(g => g.ToString() == docName); // //} //}); #endregion //添加读取注释服务 var apiXmlPath = Path.Combine(basePath, "DncEthic.WebAPI.xml"); //控制器层注释(true表示显示控制器注释) c.IncludeXmlComments(apiXmlPath, true); var entityXmlPath = Path.Combine(basePath, "DncEthic.Domain.xml"); //实体层注释 c.IncludeXmlComments(entityXmlPath, true); //添加对控制器的标签(描述) //c.DocumentFilter<SwaggerDocTag>(); //添加header验证信息 //c.OperationFilter<SwaggerHeader>(); var security = new Dictionary <string, IEnumerable <string> > { { "Bearer", new string[] { } }, }; c.AddSecurityRequirement(security);//添加一个必须的全局安全信息,和AddSecurityDefinition方法指定的方案名称要一致,这里是Bearer。 c.AddSecurityDefinition("Bearer", new ApiKeyScheme { Description = "JWT授权(数据将在请求头中进行传输) 参数结构: \"Authorization: Bearer {token}\"", Name = "Authorization", //jwt默认的参数名称 In = "header", //jwt默认存放Authorization信息的位置(请求头中) Type = "apiKey" }); }); #endregion #region 跨域CORS services.AddCors(c => { c.AddPolicy("Any", policy => { policy.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials(); }); c.AddPolicy("AllowSpecificOrigin", policy => { policy.WithOrigins("http://localhost:8083")//运行跨越访问的请求地址么,有多个的话用逗号隔开 .WithMethods("GET", "POST", "PUT", "DELETE") .WithHeaders("authorization"); }); }); #endregion }
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 }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); #region 跨域设置 app.UseCors(builder => { builder.AllowAnyHeader(); builder.AllowAnyMethod(); builder.AllowAnyOrigin(); }); #endregion #region 添加Swagger app.UseSwagger(); app.UseSwaggerUI(c => { //c.SwaggerEndpoint("/swagger/G2/swagger.json", "API文档-业务");//业务接口文档首先显示 //c.SwaggerEndpoint("/swagger/G1/swagger.json", "API文档-平台");//基础接口文档放后面后显示 //c.SwaggerEndpoint("/swagger/Default/swagger.json", "API文档-默认"); //c.RoutePrefix = string.Empty;//设置后直接输入IP就可以进入接口文档 var enumGroup = typeof(ApiGroups); //根据分组名称倒序遍历展示 enumGroup.GetEnumNames().OrderByDescending(p => Convert.ToInt32(Enum.Parse(enumGroup, p))).ToList().ForEach(name => { var value = Convert.ToInt32(Enum.Parse(enumGroup, name)); string description = EnumExtension.GetDescription(enumGroup, value); c.SwaggerEndpoint($"/swagger/{name}/swagger.json", $"{description}"); }); // 将swagger首页,设置成我们自定义的页面,记得这个字符串的写法:解决方案名.index.html //c.IndexStream = () => GetType().GetTypeInfo().Assembly.GetManifestResourceStream("DncEthic.WebAPI.index.html"); c.RoutePrefix = ""; //路径配置,设置为空,表示直接在根域名(localhost:8001)访问该文件,注意localhost:8001/swagger是访问不到的,去launchSettings.json把launchUrl去掉 }); #endregion #region 静态资源 app.UseStaticFiles();//用于访问wwwroot下的文件 //app.UseStaticFiles(new StaticFileOptions //{ // FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider( // System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "ExcelModel")), // RequestPath = "/ExcelModel" //}); #endregion #region 解决Ubuntu Nginx 代理不能获取IP问题 app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedFor | Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto }); #endregion app.UseMvc(); }
public DistributionEndpointBuilder WithType(Type type) { CreateOrOverwriteProperty(RDF.Type, EnumExtension.GetDescription(type)); return(this); }
public DistributionEndpointBuilder WithDistributionEndpointLifecycleStatus(LifecycleStatus status) { CreateOrOverwriteProperty(Resource.DistributionEndpoints.DistributionEndpointLifecycleStatus, EnumExtension.GetDescription(status)); return(this); }
override public string ToString() { return("Suit=" + EnumExtension.GetDescription((SuitEnum)Suit) + " Value=" + Value.ToString()); }
public JsonResult FileInfo() { _log.WriteInfo("开始请求接口【file/info】"); FileInfoResult result = new FileInfoResult(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { // 获取自定义参数 var userId = request.Params["_w_userId"].ToString(); //用户ID var fileId = request.FileId; //文件ID #region >>>从数据库查询用户名、文件 等信息......<<< #endregion #region >>>示例<<< // 创建时间和修改时间默认全是现在,可更改,但是注意时间戳是11位的(秒) var now = TimestampHelper.GetCurrentTimestamp(); var fileName = request.FileId == "1000" ? "TestFile.docx" : (request.FileId == "1001" ? "TestFile_v1.docx" : "TestFile_v2.docx"); int version = request.FileId == "1000" ? 5 : (request.FileId == "1001" ? 1 : 2); string filePath = Server.MapPath($"/Files/{fileName}"); result.file = new WPSFile { id = "1000", name = "TestFile.docx", // 如果线下修改后将修改此版本重新上传 version = 5, size = FileHelper.FileSize(filePath), // WPS单位是B create_time = now, creator = "天玺", modify_time = now, modifier = "天玺", download_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/{fileName}", user_acl = new User_acl { history = 1, // 允许查看历史版本 rename = 1, // 允许重命名 copy = 1, // 允许复制 export = 1, }, watermark = new Watermark { type = 1, // 1为有水印 value = "水印文字" } }; result.user = new UserForFile() { id = "1000", name = "天玺", //permission = "read", permission = "write", // write为允许编辑,read为只能查看 avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo1.jpg", }; #endregion } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/info】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result, JsonRequestBehavior.AllowGet)); }
public bool UrlContainsServiceName() { if (IsParameterTableDisplayed()) { switch (currentSerivce) { case ServiceToTry.GetMessages: case ServiceToTry.GetEvents: case ServiceToTry.GetContacts: return(Browser.Driver.FindElement(By.Id("urlValue")).Text.Contains(EnumExtension.GetDescription(currentSerivce))); case ServiceToTry.GetFiles: case ServiceToTry.GetUsers: case ServiceToTry.GetGroups: return(isParameterValueContained); default: return(false); } } else { switch (currentSerivce) { case ServiceToTry.GetMessages: case ServiceToTry.GetEvents: case ServiceToTry.GetContacts: return(Browser.Driver.FindElement(By.Id("urlValue")).Text.Contains(EnumExtension.GetDescription(currentSerivce))); case ServiceToTry.GetFiles: return(Browser.Driver.FindElement(By.Id("urlValue")).Text.Contains("drive/root/children")); case ServiceToTry.GetUsers: return(Browser.Driver.FindElement(By.Id("urlValue")).Text.Contains("me")); case ServiceToTry.GetGroups: return(Browser.Driver.FindElement(By.Id("urlValue")).Text.Contains("me/memberOf")); default: return(false); } } }
public JsonResult GetHistory(GetHistoryRequest body) { _log.WriteInfo("开始请求接口【file/history】"); GetHistoryResult result = new GetHistoryResult(); try { var request = GetFilterRequest.GetParams(HttpContext.ApplicationInstance.Request); if (!request.Status) { result.code = request.code; result.message = request.message; result.details = request.details; result.hint = request.hint; } else { // 从数据库查询用户、文件信息等...... // 创建时间和修改时间默认全是现在 //var now = TimestampHelper.GetCurrentTimestamp(); var startNow = TimestampHelper.ConvertToTimeStamp(DateTime.Now.AddHours(-10)); // 不需要使用历史版本功能的此处也请返回,如果此接口不通时,文档加载会报错:“GetFileInfoFailed” result.histories = new List <HistroyModel> { new HistroyModel { id = "1001", name = "TestFile_v1.docx", size = FileHelper.FileSize(Server.MapPath("/Files/TestFile_v1.docx")), // 单位B version = 1, download_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/TestFile_v1.docx", create_time = startNow, modify_time = startNow, creator = new UserModel { id = "1001", name = "兆丰", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo2.jpg" }, modifier = new UserModel { id = "1001", name = "兆丰", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo2.jpg" } }, new HistroyModel { id = "1002", name = "TestFile_v2.docx", size = FileHelper.FileSize(Server.MapPath("/Files/TestFile_v2.docx")), // 单位B version = 2, download_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Files/TestFile_v2.docx", create_time = startNow, modify_time = startNow, creator = new UserModel { id = "1002", name = "丫丫", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo3.jpg" }, modifier = new UserModel { id = "1002", name = "丫丫", avatar_url = $"{ConfigurationManager.AppSettings["WPSTokenUrl"]}/Images/photo3.jpg" } } }; } } catch (Exception ex) { _log.WriteError("【系统异常】-【" + ex.Message + "】", ex); result.code = (int)Enumerator.ErrorCode.ServerError; result.message = Enumerator.ErrorCode.ServerError.ToString(); result.details = result.hint = EnumExtension.GetDescription(Enumerator.ErrorCode.ServerError); } _log.WriteInfo("请求接口【file/history】完成,返回数据:" + JsonConvert.SerializeObject(result)); return(Json(result)); }