public HttpResponseMessage Install(string uid, byte?type, string pluginVersion, string domain) { Logger.Debug(String.Format("PLUGIN INSTALL MSG::uid = {0}::type = {1}::domain {2}", uid, type, domain)); if (type == null || String.IsNullOrEmpty(uid)) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } var pluginType = Utils.ParseEnum <PluginEnums.ePluginType>(type.ToString()); var token = new PluginInstallationDTO { Uid = uid, Type = pluginType, Domain = domain }; string error; var result = WidgetEndpointServices.SavePluginInstallaltion(token, out error); if (result) { SaveUserEvent(CommonEnums.eUserEvents.PLUGIN_INSTALLATION, Utils.GetEnumDescription(pluginType) + " plugin installed::" + uid, uid); } Logger.Debug(String.Format("PLUGIN INSTALL MSG::installed{3}::uid = {0}::type = {1}::domain {2}", uid, type, domain, result)); return(new HttpResponseMessage(result ? HttpStatusCode.OK : HttpStatusCode.InternalServerError)); }
public ActionResult AppSettingsNew(string instance, string origCompId, string compId) { var user = this.CurrentUser(); if (user == null) { return(RedirectToAction("Index", "Home", new { area = "WixEndPoint", instance = instance, compId = compId, origCompId = origCompId })); } var wixInstance = GetInstanceDto(instance); if (instance != null) { #region save plugin var token = new PluginInstallationDTO { Uid = wixInstance.instanceId.ToString(), Type = PluginEnums.ePluginType.WIX }; string error; if (WidgetEndpointServices.SavePluginInstallaltion(token, out error)) { SaveUserEvent(CommonEnums.eUserEvents.PLUGIN_INSTALLATION, Utils.GetEnumDescription(PluginEnums.ePluginType.WIX) + " plugin installed::" + wixInstance.instanceId, wixInstance.instanceId.ToString()); } #endregion var wixUser = UserServices.FindUserDtoByWixInstanceId(wixInstance.instanceId); if (wixUser != null && user.UserId != wixUser.UserId) { var returnUrl = Url.ToWixLoginHandlerUrl(wixInstance.instanceToken, compId, origCompId); return(RedirectToAction("ForceWixUserSignIn", "Account", new { area = "", returnUrl, email = wixUser.Email, userProfileId = wixUser.UserProfileId, trackingId = wixInstance.instanceId.ToString() })); } #region update plugin owner WidgetEndpointServices.VerifyPluginOwner(wixInstance.instanceId.ToString(), out error); #endregion } var webStore = WidgetServices.GetWidgetStoreDto(wixInstance.instanceId.ToString()) ?? UserServices.GetAndUpdateZombieStore(wixInstance.instanceId, user.UserId); //check for zombie store (if user had store and clicked disconnect and than reconnected) var settingToken = new SettingsViewToken { Instance = wixInstance, UserId = user.UserId, StoreId = webStore != null ? webStore.WebStoreID : (int?)null, UserCoursesList = CoursesServices.GetAuthorCoursesList(Constants.DEFAULT_CURRENCY_ID, user.UserId) }; if (webStore == null)//create a new store { var jsonToken = new WixSettingsJsonToken { cbIsShowBorder = false, cbIsShowTitleBar = true, cbIsTransparent = false, cpBackgroundColor = "#FFFFFF", cpFontColor = "#000000", cpTabsFontColor = "#006699", InstanceId = wixInstance.instanceId.ToString(), StoreId = null, txtStoreName = "", UniqueId = "", WixSiteUrl = "" }; string error; WebstoreWixService.UpdateWixSettings(ref jsonToken, this.CurrentUser(), out error); settingToken.StoreName = jsonToken.txtStoreName; settingToken.FontColor = jsonToken.cpFontColor; settingToken.TabsFontColor = jsonToken.cpTabsFontColor; settingToken.BackgroundColor = jsonToken.cpBackgroundColor; settingToken.IsTransparent = jsonToken.cbIsTransparent; settingToken.IsShowBorder = jsonToken.cbIsShowBorder; settingToken.IsShowTitleBar = jsonToken.cbIsShowBorder; settingToken.StoreId = jsonToken.StoreId; settingToken.UniqueId = jsonToken.UniqueId; } else { settingToken.StoreName = webStore.WebStoreName; settingToken.FontColor = webStore.FontColor; settingToken.TabsFontColor = webStore.TabsFontColor; settingToken.BackgroundColor = webStore.BackgroundColor; settingToken.IsTransparent = webStore.IsTransParent; settingToken.IsShowBorder = webStore.IsShowBorder; settingToken.IsShowTitleBar = webStore.IsShowTitleBar; settingToken.StoreId = webStore.WebStoreID; settingToken.UniqueId = webStore.UniqueId; // settingToken.StoreCoursesIds = WidgetServices.GetAllStoreCourseIds(webStore.WebStoreID); } return(View(settingToken)); }