protected void UpdatePhoto(object o, EventArgs e) { Photo p = new Photo(int.Parse(this.uiPhotoKLabel.Text)); p.SetAsPhotoOfWeek(uiPhotoOfWeek.Checked, uiPhotoOfWeekUserCaption.Text, false, uiResetDateTime.Checked); p.BlockedFromPhotoOfWeekUser = uiPhotoOfWeekUserBlocked.Checked; p.Update(); }
public void Process() { string[] arr = this.Message.ToLower().Split(' '); if (arr[0].StartsWith("hello")) { Photo p = new Photo(int.Parse(arr[1])); if (p.BlockedFromPhotoOfWeekUser) return; if (p.Status != Photo.StatusEnum.Enabled) return; //send the outgoing premium sms and await the response... this.ServiceType = ServiceTypes.FrontPagePhoto; this.Update(); if (Common.Settings.EnablePremiumRate == Common.Settings.EnablePremiumRateOption.On) { OutgoingSms sms = new OutgoingSms(); sms.DateTime = DateTime.Now; sms.Type = OutgoingSms.Types.FrontPagePhoto; sms.IncomingSmsK = this.K; sms.Message = "Your photo / video will now appear on the front page!"; sms.ChargeType = Vars.DevEnv ? OutgoingSms.ChargeTypes.Premium012p : OutgoingSms.ChargeTypes.Premium150p; sms.MobileK = this.MobileK; sms.ServiceType = ServiceTypes.FrontPagePhoto; sms.Update(); sms.Send(); } else { //enable photo immediatly string caption = ""; if (arr.Length > 2) { for (int i = 2; i < arr.Length; i++) caption += (i > 2 ? " " : "") + arr[i]; caption = Cambro.Web.Helpers.Strip(caption, true, true, true, true); if (caption.Length > 200) caption = caption.Substring(0, 195) + "..."; } p.SetAsPhotoOfWeek(true, caption, false, true); } } #region removed //if (arr[0].StartsWith("tonight")) //{ // #region process TONIGHT texts // Mobile m = new Mobile(number, network, ServiceTypes.Tonight); // this.MobileK = m.K; // this.ServiceType = ServiceTypes.Tonight; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // for (int i = 1; i < arr.Length; i++) // { // if (arr[i].Equals("event") || arr[i].Equals("venue")) // { // for (int j = 1; j < arr.Length; j++) // { // int eventK = 0; // Event ev = null; // Venue v = null; // try // { // eventK = int.Parse(arr[j]); // ev = new Event(eventK); // v = ev.Venue; // } // catch { } // if (arr[i].Equals("event") && ev != null) // { // ProcessTonightEventDetail(ev); // return; // } // else if (arr[i].Equals("venue") && ev != null && v != null) // { // ProcessTonightVenueDetail(v, ev); // return; // } // } // } // else if (arr[i].Equals("help")) // { // ProcessTonightInfo(); // return; // } // else if (arr[i].Equals("end")) // { // ProcessTonightEnd(); // return; // } // } // try // { // ArrayList placeQueryCondition = new ArrayList(); // ArrayList musicQueryCondition = new ArrayList(); // for (int i = 1; i < arr.Length; i++) // { // placeQueryCondition.Add(new Q(Place.Columns.Name, arr[i])); // musicQueryCondition.Add(new Q(MusicType.Columns.SmsCode, arr[i])); // } // Q placeOr = new Or((Q[])placeQueryCondition.ToArray(typeof(Q))); // Q musicOr = new Or((Q[])musicQueryCondition.ToArray(typeof(Q))); // Query placeQ = new Query(); // placeQ.QueryCondition = new And( // placeOr, // new Q(Place.Columns.Enabled, true), // new Q(Place.Columns.CountryK, 224) // ); // PlaceSet ps = new PlaceSet(placeQ); // Query musicQ = new Query(); // musicQ.QueryCondition = musicOr; // MusicTypeSet mts = new MusicTypeSet(musicQ); // if (mts.Count > 0 || ps.Count > 0) // { // ProcessTonightListings(mts, ps); // return; // } // } // catch // { // } // ProcessTonightError(); // return; // #endregion //} // else if (arr[0].StartsWith("pllay")) // { // #region process PLLAY texts // Mobile m = new Mobile(number, network, ServiceTypes.TextGuest, 1); // this.MobileK = m.K; // this.ServiceType=ServiceTypes.TextGuest; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // // if (arr.Length>1 && arr[1].Equals("end")) // { // ProcessGuestEnd(); // return; // } // else // { // GuestPromotionSet gps = new GuestPromotionSet(new Q(GuestPromotion.Columns.Shortcut,"pllay")); // GuestPromotion gp = gps[0]; // ProcessGuest(gp); // return; // } // #endregion // } // else if (arr[0].StartsWith("guest")) // { // #region process GUEST texts // int GuestPromotionK = 0; // if (arr.Length>1) // { // bool numeric = true; // if (arr[1].Equals("end")) // { // try // { // GuestClient c = new GuestClient(int.Parse(arr[2])); // Mobile m = new Mobile(number, network, ServiceTypes.TextGuest, c.K); // this.MobileK = m.K; // this.ServiceType=ServiceTypes.TextGuest; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // ProcessGuestEnd(); // return; // } // catch // { // return; // } // } // else // { // Regex r = new Regex("[^0123456789]"); // try // { // string numbers = r.Replace(arr[1],""); // GuestPromotionK = int.Parse(numbers); // } // catch // { // numeric = false; // } // } // if (!numeric) // { // GuestPromotionSet gps = new GuestPromotionSet(new Q(GuestPromotion.Columns.Shortcut,arr[1].ToLower())); // if (gps.Count>0) // GuestPromotionK = gps[0].K; // } // } // if (GuestPromotionK==0) // { // Mobile m = new Mobile(number, network, ServiceTypes.TextGuest, 0); // this.MobileK = m.K; // this.ServiceType=ServiceTypes.TextGuest; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // // OutgoingSms.CreateOutgoingSmsSet( // "Sorry, you have not entered an event code. This should be a number - it tells us which guestlist to put you on. Send GUEST followed by the code to 83248.", // OutgoingSms.Types.GuestError, // this.Mobile, // this, // ServiceTypes.TextGuest); // return; // } // GuestPromotion gp = null; // try // { // gp = new GuestPromotion(GuestPromotionK); // } // catch // { // Mobile m = new Mobile(number, network, ServiceTypes.TextGuest, 0); // this.MobileK = m.K; // this.ServiceType=ServiceTypes.TextGuest; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // // OutgoingSms.CreateOutgoingSmsSet( // "Sorry, you have entered an invalid event code. This should be a number - it tells us which guestlist to put you on. Send GUEST followed by the code to 83248.", // OutgoingSms.Types.GuestError, // this.Mobile, // this, // ServiceTypes.TextGuest); // return; // } // // Mobile m1 = new Mobile(number, network, ServiceTypes.TextGuest, gp.Event.GuestClientK); // this.MobileK = m1.K; // this.ServiceType=ServiceTypes.TextGuest; // this.Mobile.TotalIncoming++; // this.Mobile.Update(); // this.Update(); // // ProcessGuest(gp); // #endregion // } #endregion }
public void ReceivedDeliveryNote() { if (!this.Delivered) { this.Delivered = true; this.Update(); if (Type == Types.FrontPagePhoto) { string[] arr = IncomingSms.Message.ToLower().Split(' '); Photo p = new Photo(int.Parse(arr[1])); string caption = ""; if (arr.Length > 2) { for (int i = 2; i < arr.Length; i++) caption += (i > 2 ? " " : "") + arr[i]; caption = Cambro.Web.Helpers.Strip(caption, true, true, true, true); if (caption.Length > 200) caption = caption.Substring(0, 195) + "..."; } p.SetAsPhotoOfWeek(true, caption, false, true); } } }