/// <summary> /// Initializes a new instance of the <see cref="PagedApp" /> class. /// </summary> /// <param name="appName">A user defined unique identifier for an app. It is alpha-numeric, may contain dashes, underscores, periods, and be less then 250 characters long. It must be unique within your account. .</param> /// <param name="appId">A globally unique identifier for an app..</param> /// <param name="appType">appType.</param> /// <param name="classifications">An App maybe associated to many classifications. A classification drives how the integration is presented to the user in the SmartThings mobile clients. These classifications include: * AUTOMATION - Denotes an integration that should display under the \"Automation\" tab in mobile clients. * SERVICE - Denotes an integration that is classified as a \"Service\". * DEVICE - Denotes an integration that should display under the \"Device\" tab in mobile clients. * CONNECTED_SERVICE - Denotes an integration that should display under the \"Connected Services\" menu in mobile clients. * HIDDEN - Denotes an integration that should not display in mobile clients .</param> /// <param name="displayName">A default display name for an app. .</param> /// <param name="description">A default description for an app. .</param> /// <param name="iconImage">iconImage.</param> /// <param name="owner">owner.</param> /// <param name="createdDate">A UTC ISO-8601 Date-Time String.</param> /// <param name="lastUpdatedDate">A UTC ISO-8601 Date-Time String.</param> public PagedApp(string appName = default(string), Guid appId = default(Guid), AppType?appType = default(AppType?), List <AppClassification> classifications = default(List <AppClassification>), string displayName = default(string), string description = default(string), IconImage iconImage = default(IconImage), Owner owner = default(Owner), DateTime createdDate = default(DateTime), DateTime lastUpdatedDate = default(DateTime)) { this.AppName = appName; this.AppId = appId; this.AppType = appType; this.Classifications = classifications; this.DisplayName = displayName; this.Description = description; this.IconImage = iconImage; this.Owner = owner; this.CreatedDate = createdDate; this.LastUpdatedDate = lastUpdatedDate; }
public async Task <AppData> GetApp(string appId, AppType?appType, bool includeStore = false) { using var ctx = _ContextFactory.CreateContext(); var query = ctx.Apps .Where(us => us.Id == appId && (appType == null || us.AppType == appType.ToString())); if (includeStore) { query = query.Include(data => data.StoreData); } return(await query.FirstOrDefaultAsync()); }
public ActionResult UpdateUserState(UserState userState, string userId, AppType?type) { if (type == null) { type = AppType.Service; } if (new UserService().UpdateUserState(userState, userId, type) > 0) { return(Json(new { success = "操作成功!" })); } else { return(Json(new { error = "操作失败!" })); } }
private async Task <AppData> GetOwnedApp(string appId, AppType?type = null) { var userId = GetUserId(); using (var ctx = _ContextFactory.CreateContext()) { var app = await ctx.UserStore .Where(us => us.ApplicationUserId == userId && us.Role == StoreRoles.Owner) .SelectMany(us => us.StoreData.Apps.Where(a => a.Id == appId)) .FirstOrDefaultAsync(); if (type != null && type.Value.ToString() != app.AppType) { return(null); } return(app); } }
private async Task <ViewResult> GoToApp(string appId, AppType?appType) { if (appType.HasValue && !string.IsNullOrEmpty(appId)) { this.HttpContext.Response.Headers.Remove("Onion-Location"); switch (appType.Value) { case AppType.Crowdfund: { var serviceProvider = HttpContext.RequestServices; var controller = (AppsPublicController)serviceProvider.GetService(typeof(AppsPublicController)); controller.Url = Url; controller.ControllerContext = ControllerContext; var res = await controller.ViewCrowdfund(appId, null) as ViewResult; if (res != null) { res.ViewName = $"/Views/AppsPublic/ViewCrowdfund.cshtml"; return(res); // return } break; } case AppType.PointOfSale: { var serviceProvider = HttpContext.RequestServices; var controller = (AppsPublicController)serviceProvider.GetService(typeof(AppsPublicController)); controller.Url = Url; controller.ControllerContext = ControllerContext; var res = await controller.ViewPointOfSale(appId) as ViewResult; if (res != null) { res.ViewName = $"/Views/AppsPublic/{res.ViewName}.cshtml"; return(res); // return } break; } } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="App" /> class. /// </summary> /// <param name="appName">A user defined unique identifier for an app. It is alpha-numeric, may contain dashes, underscores, periods, and be less then 250 characters long. It must be unique within your account. .</param> /// <param name="appId">A globally unique identifier for an app..</param> /// <param name="appType">appType.</param> /// <param name="principalType">principalType.</param> /// <param name="classifications">An App maybe associated to many classifications. A classification drives how the integration is presented to the user in the SmartThings mobile clients. These classifications include: * AUTOMATION - Denotes an integration that should display under the \"Automation\" tab in mobile clients. * SERVICE - Denotes an integration that is classified as a \"Service\". * DEVICE - Denotes an integration that should display under the \"Device\" tab in mobile clients. * CONNECTED_SERVICE - Denotes an integration that should display under the \"Connected Services\" menu in mobile clients. * HIDDEN - Denotes an integration that should not display in mobile clients .</param> /// <param name="displayName">A default display name for an app. .</param> /// <param name="description">A default description for an app. .</param> /// <param name="singleInstance">Inform the installation systems that a particular app can only be installed once within a user's account. (default to false).</param> /// <param name="iconImage">iconImage.</param> /// <param name="installMetadata">System generated metadata that impacts eligibility requirements around installing an App..</param> /// <param name="owner">owner.</param> /// <param name="createdDate">A UTC ISO-8601 Date-Time String.</param> /// <param name="lastUpdatedDate">A UTC ISO-8601 Date-Time String.</param> /// <param name="lambdaSmartApp">lambdaSmartApp.</param> /// <param name="webhookSmartApp">webhookSmartApp.</param> /// <param name="ui">ui.</param> public App(string appName = default(string), Guid appId = default(Guid), AppType?appType = default(AppType?), PrincipalType?principalType = default(PrincipalType?), List <AppClassification> classifications = default(List <AppClassification>), string displayName = default(string), string description = default(string), bool singleInstance = false, IconImage iconImage = default(IconImage), Dictionary <string, string> installMetadata = default(Dictionary <string, string>), Owner owner = default(Owner), DateTime createdDate = default(DateTime), DateTime lastUpdatedDate = default(DateTime), LambdaSmartApp lambdaSmartApp = default(LambdaSmartApp), WebhookSmartApp webhookSmartApp = default(WebhookSmartApp), AppUISettings ui = default(AppUISettings)) { this.AppName = appName; this.AppId = appId; this.AppType = appType; this.PrincipalType = principalType; this.Classifications = classifications; this.DisplayName = displayName; this.Description = description; this.SingleInstance = singleInstance; this.IconImage = iconImage; this.InstallMetadata = installMetadata; this.Owner = owner; this.CreatedDate = createdDate; this.LastUpdatedDate = lastUpdatedDate; this.LambdaSmartApp = lambdaSmartApp; this.WebhookSmartApp = webhookSmartApp; this.Ui = ui; }
/// <summary> /// 搜索列表筛选条件初始化数据 /// </summary> /// <returns></returns> public ActionResult InitData(AppType?type) { string companyId = ""; if (type == AppType.Service) { companyId = ApiUser.Current.ServiceCompanyId ?? ""; } else { companyId = ApiUser.Current.UseCompanyId ?? ""; } var category = ds.Categorys(companyId, type); var area = ds.Areas(companyId, type); var brand = ds.Brands(companyId, type); return(Json(new { brand = (brand.Count != 0 ? brand.Where(m => m != null).Select(m => new { id = m.BrandId, name = m.Name, right = 0, left = 0, depth = 0 }) : null), category = (category.Count != 0 ? category.Where(m => m != null).Select(m => new { id = m.CategoryId, name = m.Name, right = m.Right, left = m.Left, depth = m.LevelDeep }) : null), area = (area.Count != 0 ? area.Where(m => m != null).Select(m => new { name = m.Name, right = m.Right, left = m.Left, depth = m.LevelDeep, id = m.AreaId }) : null) }, JsonRequestBehavior.AllowGet)); }
private Task <AppData> GetOwnedApp(string appId, AppType?type = null) { return(_AppService.GetAppDataIfOwner(GetUserId(), appId, type)); }
/// <summary> /// 提交工单状态操作 /// </summary> /// <param name="orderId"></param> /// <param name="description"></param> /// <param name="state"></param> /// <param name="utype"></param> /// <param name="userId"></param> /// <returns></returns> public ActionResult SubmitState(string orderId, string description, OrderState state, decimal amount = 0, int level = 5, long toUserId = 0, AppType?appType = null) { try { var flag = false; RepairType repairType = RepairType.App; string repairUserId = ""; var userId = ApiUser.Current.UserId; var utype = ApiUser.Current.RoleKey; var userPhone = ""; switch (state) { case OrderState.Worked: flag = os.Worked(orderId, userId, amount, utype, description, ref repairUserId, ref repairType, ref userPhone, appType); //发短信 SMSManager.Instance.SendNotify(userPhone, orderId); if (appType == AppType.Service) { //更新坐标轨迹 new UserService().PositionAction(orderId, userId, PositionAction.Worked); } break; case OrderState.Cancel: flag = os.Cancel(orderId, userId, utype, description, ref repairUserId, ref repairType, appType); break; case OrderState.Close: flag = os.Close(orderId, userId, utype, description, appType); break; case OrderState.Unsolved: if (appType == AppType.Use) { flag = os.ResetWorking(orderId, userId, description, ref repairType, ref userPhone); //SMSManager.Instance.SendNotify(userPhone, orderId); } else { flag = os.Unsolved(orderId, userId, utype, description, appType); } break; case OrderState.Confirm: flag = os.Confirm(orderId, userId, utype, description, appType); break; case OrderState.UseComment: flag = os.UseComment(orderId, userId, utype, description, appType); flag = new CommentService().Comments(userId, toUserId, orderId, description, level); break; } if (flag) { //判断报修终端 if (repairType == RepairType.Wx && appType == AppType.Service) { //发送公共号消息 new Task(new Action(() => { var resultMsg = os.SendWxTmpMsg(repairUserId, orderId, state); Logger.InfoFormat("微信消息推送{0}===={1}", orderId, resultMsg); })).Start(); } return(Json(new { success = "操作成功" } , JsonRequestBehavior.AllowGet)); } else { return(Json(new { error = "服务器繁忙,请稍后再试试" } , JsonRequestBehavior.AllowGet)); } } catch (Exception e) { Logger.Error("操作异常", e); return(Json(new { error = "服务器繁忙,请稍后再试试" } , JsonRequestBehavior.AllowGet)); } }