public ActionResult Edit([Bind(Include = "Id,EventTypeId,BranchId,StartTime")] BranchEvent branchEvent) { if (ModelState.IsValid) { var bookevents = db.BookEvents.Include(be => be.ApplicationUser).Where(be => be.BranchEvent.Id == branchEvent.Id).ToList(); List <string> emailAdd = new List <string>(); for (int i = 0; i < bookevents.Count; i++) { emailAdd.Add(bookevents[i].ApplicationUser.Email); System.Diagnostics.Debug.Write(bookevents[i].ApplicationUser.Email); } string subject = "Change of event"; string content = "Event change"; EmailSender es = new EmailSender(); es.SendMultiple(emailAdd, subject, content); db.Entry(branchEvent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BranchId = new SelectList(db.Branches, "Id", "Name", branchEvent.BranchId); ViewBag.EventTypeId = new SelectList(db.EventTypes, "Id", "Name", branchEvent.EventTypeId); return(View(branchEvent)); }
public void OnBtn_SendComplexEvent() { BranchEvent e = new BranchEvent("MY_COMPLEX_EVENT"); e.SetAlias("my_alias"); e.SetAffiliation("my_affilation"); e.SetCoupon("my_coupon"); e.SetCurrency(BranchCurrencyType.USD); e.SetTax(10.0f); e.SetRevenue(100.0f); e.SetShipping(1000.0f); e.SetDescription("my_description"); e.SetSearchQuery("my_search_query"); e.AddCustomData("custom_data_key01", "custom_data_value01"); e.AddCustomData("custom_data_key02", "custom_data_value02"); if (universalObject != null) { e.AddContentItem(universalObject); } Branch.sendEvent(e); OnBtn_RefreshRewards(); }
public void CallbackWithBranchUniversalObject(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string error) { if (error != null) { Debug.LogError("Branch Error: " + error); } else { Debug.Log("Branch initialization completed: "); Debug.Log("Universal Object: " + universalObject.ToJsonString()); Debug.Log("Link Properties: " + linkProperties.ToJsonString()); BranchEvent e = new BranchEvent("MY_CUSTOM_EVENT"); // BranchEvent e = new BranchEvent (BranchEventType.COMPLETE_REGISTRATION); e.SetAffiliation("my_affilation"); e.SetCoupon("my_coupon"); e.SetCurrency(BranchCurrencyType.USD); e.SetTax(10.0f); e.SetRevenue(100.0f); e.SetShipping(1000.0f); e.SetDescription("my_description"); e.SetSearchQuery("my_search_query"); e.AddCustomData("custom_data_key01", "custom_data_value01"); e.AddContentItem(universalObject); Branch.sendEvent(e); } }
public ActionResult DeleteConfirmed(int id) { BranchEvent branchEvent = db.BranchEvents.Find(id); db.BranchEvents.Remove(branchEvent); db.SaveChanges(); return(RedirectToAction("Index")); }
private void OnCalleventClicked(object sender, RoutedEventArgs e) { BranchEvent ev = new BranchEvent("test_custom_events") .SetDescription("Test description") .SetTransactionID("322") .AddCustomDataProperty("TestProperty", "TestValue"); ev.LogEvent(); }
public ActionResult Create([Bind(Include = "Id,EventTypeId,BranchId,StartTime")] BranchEvent branchEvent) { if (ModelState.IsValid) { db.BranchEvents.Add(branchEvent); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BranchId = new SelectList(db.Branches, "Id", "Name", branchEvent.BranchId); ViewBag.EventTypeId = new SelectList(db.EventTypes, "Id", "Name", branchEvent.EventTypeId); return(View(branchEvent)); }
// GET: BranchEvents/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchEvent branchEvent = db.BranchEvents.Find(id); if (branchEvent == null) { return(HttpNotFound()); } return(View(branchEvent)); }
// GET: BranchEvents/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchEvent branchEvent = db.BranchEvents.Find(id); if (branchEvent == null) { return(HttpNotFound()); } ViewBag.BranchId = new SelectList(db.Branches, "Id", "Name", branchEvent.BranchId); ViewBag.EventTypeId = new SelectList(db.EventTypes, "Id", "Name", branchEvent.EventTypeId); return(View(branchEvent)); }
public void OnBtn_SendBuyEvent() { BranchEvent e = new BranchEvent(BranchEventType.PURCHASE); e.SetAffiliation("my_affilation"); e.SetCoupon("my_coupon"); e.SetCurrency(BranchCurrencyType.USD); e.SetTax(10.0f); e.SetRevenue(100.0f); e.SetShipping(1000.0f); e.SetDescription("my_description"); e.SetSearchQuery("my_search_query"); Branch.sendEvent(e); OnBtn_RefreshRewards(); }
/// <summary> /// Records a branching event /// </summary> /// <param name="ev">Event information</param> public void RecordBranchEvent(BranchEvent ev) { BranchEvents.Add(ev); }
void GetUrlClicked(object sender, EventArgs e) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.contentIndexMode = 0; universalObject.localIndexMode = 0; universalObject.expirationDate = new DateTime(2020, 12, 30); universalObject.keywords.Add("keyword01"); universalObject.keywords.Add("keyword02"); universalObject.metadata.contentSchema = BranchContentSchema.COMMERCE_BUSINESS; universalObject.metadata.quantity = 100f; universalObject.metadata.price = 1000f; universalObject.metadata.currencyType = BranchCurrencyType.USD; universalObject.metadata.sku = "my_sku"; universalObject.metadata.productName = "my_product_name"; universalObject.metadata.productBrand = "my_product_brand"; universalObject.metadata.productCategory = BranchProductCategory.BUSINESS_AND_INDUSTRIAL; universalObject.metadata.condition = BranchCondition.EXCELLENT; universalObject.metadata.productVariant = "my_product_variant"; universalObject.metadata.setAddress("my_street", "my_city", "my_region", "my_comuntry", "my_postal_code"); universalObject.metadata.setLocation(40.0f, 40.0f); universalObject.metadata.setRating(4.0f, 5.0f, 10); universalObject.metadata.AddImageCaption("https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"); universalObject.metadata.AddCustomMetadata("foo", "bar"); // register a view to add to the index Branch.GetInstance().RegisterView(universalObject); var paramStr = ParamsEntry.Text; if (!String.IsNullOrWhiteSpace(paramStr)) { String[] strs = paramStr.Split(','); int count = 1; foreach (String str in strs) { String key = "param" + count; universalObject.metadata.AddCustomMetadata(key, str.Trim()); count++; } } linkProperties = new BranchLinkProperties(); linkProperties.feature = feature; linkProperties.channel = ChannelEntry.Text; linkProperties.stage = StageEntry.Text; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); linkProperties.tags = new List <string>(); linkProperties.tags.Add("tag01"); linkProperties.tags.Add("tag02"); linkProperties.tags.Add("tag03"); var tags = TagsEntry.Text; if (!String.IsNullOrWhiteSpace(tags)) { String[] tagStrs = tags.Split(','); foreach (String tag in tagStrs) { linkProperties.tags.Add(tag.Trim()); } } Branch.GetInstance().GetShortURL(this, universalObject, linkProperties); BranchEvent branchEvent = new BranchEvent("MY_CUSTOM_EVENT"); branchEvent.SetAffiliation("my_affilation"); branchEvent.SetCoupon("my_coupon"); branchEvent.SetCurrency(BranchCurrencyType.USD); branchEvent.SetTax(10.0f); branchEvent.SetRevenue(100.0f); branchEvent.SetShipping(1000.0f); branchEvent.SetDescription("my_description"); branchEvent.SetSearchQuery("my_search_query"); branchEvent.AddCustomData("custom_data_key01", "custom_data_value01"); branchEvent.AddContentItem(universalObject); Branch.GetInstance().SendEvent(branchEvent); }
public static void SendEvent(BranchEvent e) { Dictionary <string, object> eventDict = e.ToDictionary(); if (eventDict == null) { return; } IOSNativeBranch.BranchEvent branchEvent = null; if (eventDict.ContainsKey("event_name")) { branchEvent = new IOSNativeBranch.BranchEvent(eventDict["event_name"].ToString()); } else { return; } if (eventDict.ContainsKey("transaction_id")) { branchEvent.TransactionID = eventDict ["transaction_id"].ToString(); } if (eventDict.ContainsKey("customer_event_alias")) { branchEvent.Alias = eventDict["customer_event_alias"].ToString(); } if (eventDict.ContainsKey("affiliation")) { branchEvent.Affiliation = eventDict ["affiliation"].ToString(); } if (eventDict.ContainsKey("coupon")) { branchEvent.Coupon = eventDict ["coupon"].ToString(); } if (eventDict.ContainsKey("currency")) { branchEvent.Currency = eventDict ["currency"].ToString(); } if (eventDict.ContainsKey("tax")) { branchEvent.Tax = new NSDecimalNumber(eventDict["tax"].ToString()); } if (eventDict.ContainsKey("revenue")) { branchEvent.Revenue = new NSDecimalNumber(eventDict["revenue"].ToString()); } if (eventDict.ContainsKey("description")) { branchEvent.EventDescription = eventDict ["description"].ToString(); } if (eventDict.ContainsKey("shipping")) { branchEvent.Shipping = new NSDecimalNumber(eventDict["shipping"].ToString()); } if (eventDict.ContainsKey("search_query")) { branchEvent.SearchQuery = eventDict ["search_query"].ToString(); } if (eventDict.ContainsKey("custom_data")) { Dictionary <string, string> dict = eventDict[@"custom_data"] as Dictionary <string, string>; NSMutableDictionary <NSString, NSString> tempDict = new NSMutableDictionary <NSString, NSString>(); foreach (string key in dict.Keys) { tempDict.Add(new NSString(key), new NSString(dict[key])); } branchEvent.CustomData = new NSDictionary <NSString, NSString>(tempDict.Keys, tempDict.Values); } if (eventDict.ContainsKey("content_items")) { List <string> array = eventDict["content_items"] as List <string>; NSMutableDictionary <NSObject, NSObject> tempDict = new NSMutableDictionary <NSObject, NSObject>(); int i = 1; foreach (string buoJson in array) { tempDict.Add(NSObject.FromObject(i), ToNativeUniversalObject(new BranchUniversalObject(buoJson))); ++i; } branchEvent.ContentItems = NSArray.FromNSObjects <NSObject>(tempDict.Values); } branchEvent.LogEvent(); }
/** * Send event **/ public static void sendEvent(BranchEvent branchEvent) { _sendEvent(branchEvent.ToJsonString()); }
public static void SendEvent(BranchEvent e, Context c) { IO.Branch.Referral.Util.BranchEvent branchEvent = null; JSONObject parameters = new JSONObject(e.ToJsonString()); if (parameters.Has("event_name")) { // try to create standart event foreach (IO.Branch.Referral.Util.BRANCH_STANDARD_EVENT type in IO.Branch.Referral.Util.BRANCH_STANDARD_EVENT.Values()) { if (type.Name.Equals(parameters.GetString("event_name"))) { branchEvent = new IO.Branch.Referral.Util.BranchEvent(type); break; } } // if standart event can't be created, let's create custom event if (branchEvent == null) { branchEvent = new IO.Branch.Referral.Util.BranchEvent(parameters.GetString("event_name")); } } else { return; } if (parameters.Has("transaction_id")) { branchEvent.SetTransactionID(parameters.GetString("transaction_id")); } if (parameters.Has("customer_event_alias")) { branchEvent.SetCustomerEventAlias(parameters.GetString("customer_event_alias")); } if (parameters.Has("affiliation")) { branchEvent.SetAffiliation(parameters.GetString("affiliation")); } if (parameters.Has("coupon")) { branchEvent.SetCoupon(parameters.GetString("coupon")); } if (parameters.Has("currency")) { branchEvent.SetCurrency(IO.Branch.Referral.Util.CurrencyType.GetValue(parameters.GetString("currency"))); } if (parameters.Has("tax")) { branchEvent.SetTax(parameters.GetDouble("tax")); } if (parameters.Has("revenue")) { branchEvent.SetRevenue(parameters.GetDouble("revenue")); } if (parameters.Has("description")) { branchEvent.SetDescription(parameters.GetString("description")); } if (parameters.Has("shipping")) { branchEvent.SetRevenue(parameters.GetDouble("shipping")); } if (parameters.Has("search_query")) { branchEvent.SetSearchQuery(parameters.GetString("search_query")); } if (parameters.Has("custom_data")) { JSONObject dict = parameters.GetJSONObject("custom_data"); Java.Util.IIterator keys = dict.Keys(); while (keys.HasNext) { String key = keys.Next().ToString(); branchEvent.AddCustomDataProperty(key, dict.GetString(key)); } } if (parameters.Has("content_items")) { JSONArray array = parameters.GetJSONArray("content_items"); for (int i = 0; i < array.Length(); i++) { branchEvent.AddContentItems(ToNativeBUO(new BranchUniversalObject(array.Get(i).ToString()))); } } // log event branchEvent.LogEvent(c); }