protected StoreCloud GetStoreCloud() { try { int idCamp = 0; if (Request.QueryString["IDCampaign"] != null) { idCamp = int.Parse(Request.QueryString["IDCampaign"].Trim()); Session["IDCampaign"] = idCamp; } else { idCamp = int.Parse(Session["IDCampaign"].ToString()); } Campaign camp = GetCampagne(idCamp); StoreCloud retour = storeCloudProvider.GetStoreCloud(camp.idStoreCloud, true); // possibilité d'utiliser Session comme cache plustard if (retour == null) { throw new Exception("StoreCloud not found"); } ViewBag.StoreCloud = retour; return(retour); } catch (Exception ex) { throw new Exception("GetStoreCloud " + ex.Message, ex); } }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { this.StoreCloudAssociation = GetStoreCloud(); if (this.StoreCloudAssociation == null) // si non dispo on affiche pas { this.PageInfo.CreateAlert("La gestion de document n'est pas installé pour cette copropriété", 3); RedirectResult redir = new RedirectResult(this.Url.Action("index", "association")); filterContext.Result = redir; } else { base.OnActionExecuting(filterContext); } }
public Campaign UpdateCampagne(Campaign campaign) { try { if (campaign.idStoreCloud == 0) { StoreCloudProvider SCPrv = new StoreCloudProvider(this.Connector); StoreCloud sc = SCPrv.CreateStoreCloud(campaign.Title); campaign.idStoreCloud = sc.IDStore; } base.SaveBubble(campaign); return(campaign); } catch (Exception ex) { throw new Exception("CreateCampagne " + ex.Message, ex); } }
public Campaign UpdateCampagne(int idCampaign, CampaignApiPoco campaign) { try { Campaign oldCampaign = this.getCampagne(idCampaign); oldCampaign.FromObject(campaign); if (oldCampaign.idStoreCloud == 0) { StoreCloudProvider SCPrv = new StoreCloudProvider(this.Connector); StoreCloud sc = SCPrv.CreateStoreCloud(oldCampaign.Title); oldCampaign.idStoreCloud = sc.IDStore; } base.SaveBubble(oldCampaign); return(oldCampaign); } catch (Exception ex) { throw new Exception("CreateCampagne " + ex.Message, ex); } }
public Campaign CreateCampagne(Account account, string CampaignTitle) { try { Campaign nouveau = new Campaign(); nouveau.Title = CampaignTitle; nouveau.IDAccount = account.IDAccount; nouveau.DateCreate = DateTime.Now; nouveau.Enabled = true; nouveau["IDCampaign"] = DBNull.Value; StoreCloudProvider SCPrv = new StoreCloudProvider(this.Connector); StoreCloud sc = SCPrv.CreateStoreCloud(nouveau.Title); nouveau.idStoreCloud = sc.IDStore; // Insert base.InsertBubble(nouveau, false, true); return(nouveau); } catch (Exception ex) { throw new Exception("CreateCampagne " + ex.Message, ex); } }