public void TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands()
		{
			Caching.Instances.Main.FlushAll();
			Usr u1 = new Usr()
			{
				NickName= Guid.NewGuid().ToString(),
				Email = Guid.NewGuid().ToString()
			};
			u1.Update();
			Usr u2 = new Usr()
			{
				NickName = Guid.NewGuid().ToString(),
				Email = Guid.NewGuid().ToString()
			};
			u1.Update();
			u2.Update();
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			Banner b = new Banner() { UsrK = u1.K };
			b.Update();
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			
			b.UsrK= u2.K;
			b.Update();
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			
			
		}
Пример #2
0
		public void AddAsBuddy(Usr currentUsr, List<int> buddyUsrKs)
		{
			foreach (int buddyUsrK in buddyUsrKs)
			{
				currentUsr.AddBuddy(new Usr(buddyUsrK), Usr.AddBuddySource.BuddyImporter, Buddy.BuddyFindingMethod.EmailAddress, null);
			}
		}
Пример #3
0
		void uiLookupUserButton_Click(object sender, EventArgs e)
		{
			//string PromoterRefNumeric = rNumbers.Replace(PromoterRef.Text.Trim(), "");
			//try
			//{

			Usr u = new Usr(int.Parse(this.uiUserAutoComplete.Value));
			if (u.IsPromoter)
			{
				Response.Redirect(u.UrlApp("promoters"));
			}
			else
			{
				this.uiUserIsNotPromoterPanel.Visible = true;
			}
				//else if (u.IsSkeleton)
				//{
				//    NoPromoterAccounts.Visible = false;
				//    NotFoundLabel.Visible = true;
				//}
				//else
				//{
				//    NotFoundLabel.Visible = false;
				//    NoPromoterAccounts.InnerHtml = u.Link() + " is not in any promoter accounts";
				//    NoPromoterAccounts.Visible = true;
				//}
			//}
			//catch
			//{
			//    NoPromoterAccounts.Visible = false;
			//    NotFoundLabel.Visible = true;
			//}
		}
Пример #4
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Usr.Current.IsAdmin)
				throw new Exception("");

			Usr u = new Usr(ContainerPage.Url["UsrK"]);
			u.DeleteProfilePic();
			Mailer sm = new Mailer();
			sm.UsrRecipient = u;
			sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm.Body = "<p>Your profile photo has been deleted</p>";
			sm.Body += "<p>This could have been for one of several reasons:</p>";
			sm.Body += "<ul>";
			sm.Body += "<li>Profile pictures <b>MUST BE OF YOUR FACE</b>.</li>";
			sm.Body += "<li>Profile pictures must show your face clearly - make sure you <b>ZOOM IN</b>.</li>";
			sm.Body += "<li>The face must match your sex";
			if (u.IsMale || u.IsFemale)
				sm.Body += " (you currently have <b>" + (u.IsMale ? "MALE" : "FEMALE") + "</b> selected as your sex)";
			sm.Body += " - see the <a href=\"[LOGIN(/pages/mydetails)]\">My details</a> page to change your selected sex.</li>";
			sm.Body += "</ul>";
			sm.Body += "<p>You can create a new profile picture on the <a href=\"[LOGIN(/pages/mypicture)]\">Create my picture</a> page.</p>";
			sm.Subject = "Your DontStayIn profile photo has been deleted";
			sm.RedirectUrl = "/pages/mypicture";
			sm.Send();

			Response.Redirect(u.Url());
		}
Пример #5
0
		public void DaveIgnore(object o, System.EventArgs e)
		{
			Usr Dave = new Usr(4);
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting...", 1);
			Query q = new Query();
			if (Vars.DevEnv)
				q.TopRecords = 50;
			PromoterSet bs = new PromoterSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Promoter p = bs[count];

				// Do work here!
				try
				{
					Thread t = new Thread(p.QuestionsThreadK);

					ThreadUsr tu = t.GetThreadUsr(Dave);
					tu.ChangeStatus(ThreadUsr.StatusEnum.Ignore, DateTime.Now, true, true);
					if (count % 100 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - " + p.UrlName, 2);
				}
				catch
				{
					Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - EXCEPTION! " + p.UrlName, 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 4);
			Cambro.Web.Helpers.WriteAlertFooter("/admin/promoterpm");
		}
Пример #6
0
		public void InviteContacts(Usr currentUsr, List<Contact> contacts)
		{
			foreach (Contact c in contacts)
			{
				Usr u = Usr.GetOrCreateSkeletonUser(currentUsr, c.Email, "", null, "", true, true);
				currentUsr.AddBuddy(u, true, true, Usr.AddBuddySource.BuddyImporter, Buddy.BuddyFindingMethod.EmailAddress, c.Name);
			}
		}
		public void AddUsr(Usr u)
		{
			if (u != null)
			{
				Items.Add(new ListItem(u.NickName, u.K.ToString()));
				ItemsPlain.Add(new ListItem(u.NickName, u.K + "$" + u.Pic.ToString().ToUpper()));
			}
		}
Пример #8
0
		public static Tag AddTag(string tagText, Tagging.ITaggable objectToTag, Usr usrAddingTag)
		{
			try
			{
				Transaction t = new Transaction();
				try
				{
					Tag tag = Tag.GetTag(tagText);
					if (tag.Blocked)
					{
						throw new InvalidTagException();
					}
					TagPhoto tagPhoto = TagPhoto.GetTagPhoto(tag.K, objectToTag.K);
					TagPhotoHistory.TagPhotoHistoryAction action = TagPhotoHistory.TagPhotoHistoryAction.Created;
					if (tagPhoto == null)
					{
						tagPhoto = new TagPhoto()
						{
							TagK = tag.K,
							PhotoK = objectToTag.K,
							Disabled = false
						};
						tagPhoto.Update(t);
						action = TagPhotoHistory.TagPhotoHistoryAction.Created;
					}
					if (tagPhoto.Disabled)
					{
						if (!usrAddingTag.IsJunior)
						{
							throw new Exception("You do not have rights to re-enable that tag");
						}
						tagPhoto.Disabled = false;
						tagPhoto.Update(t);
						action = TagPhotoHistory.TagPhotoHistoryAction.Enabled;
					}
					TagPhotoHistory history = new TagPhotoHistory()
					{
						DateTime = DateTime.Now,
						Action = action,
						UsrK = usrAddingTag.K,
						TagPhotoK = tagPhoto.K
					};
					history.Update(t);
					t.Commit();

					return tag;
				}
				catch (Exception ex)
				{
					t.Rollback();
					throw ex;
				}
			}
			catch (InvalidTagException)
			{
				return null;
			}
		}
		public static IPagedDataService<Photo> GetUsrPhotosPagedDataService(Usr usr)
		{
			var orderBy = new []
			{
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.DateTime, OrderBy.OrderDirection.Descending),
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.K, OrderBy.OrderDirection.Descending)
			};
			return usr.ChildFavouritePhotos(orderBy);
		}
Пример #10
0
		public void TestDeletesRemoveBobsFromCache()
		{
			Usr usr = new Usr();
			usr.Update();
			UsrTableDef def = new UsrTableDef();
			Caching.Instances.Main.Set(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey), Guid.NewGuid().ToString());
			Assert.IsNotNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
			usr.Delete();
			Assert.IsNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
		}
Пример #11
0
		public void DeleteNow(object o, System.EventArgs e)
		{
			Usr c = new Usr(int.Parse(ObjectKTextBox.Text));
			if (!c.Banned)
				throw new DsiUserFriendlyException("User should be banned first!");

			c.StripAll();

			DoneLabel.Visible = true;
		}
Пример #12
0
		public void Delete_RemoveUsr1ThenLoadUsr1_BobNotFoundThrown()
		{
			SetupCacheForTesting();

			Usr usr = new Usr();
			usr.Update();
			int k = usr.K;
			usr.Delete();

			usr = new Usr(k);
		}
Пример #13
0
		protected void Change(object sender, EventArgs e)
		{
			Usr u = new Usr(int.Parse(UsrK.Text));
			if (!u.IsAdmin)
			{
				u.SetPassword(UsrPassword.Text, true);
				OutLabel.Text = "Done.";
			}
			else
				OutLabel.Text = "Can't change an admin password on this page.";
		}
Пример #14
0
		public void DeleteNow(object o, System.EventArgs e)
		{
			if (ObjectTypeDropDown.SelectedValue.Equals("Photo"))
			{
				Photo c = new Photo(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Gallery"))
			{
				Gallery c = new Gallery(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Venue"))
			{
				Venue c = new Venue(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Event"))
			{
				Event c = new Event(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Comment"))
			{
				Comment c = new Comment(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Thread"))
			{
				Thread c = new Thread(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Usr"))
			{
				Usr c = new Usr(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			else if (ObjectTypeDropDown.SelectedValue.Equals("Article"))
			{
				Article c = new Article(int.Parse(ObjectKTextBox.Text));
				SendEmail(c);
				Delete.DeleteAll(c);
			}
			DoneLabel.Visible = true;
		}
Пример #15
0
		public void MakePayment(List<InvoiceDataHolder> invoices, decimal amount, Usr usr, int promoterK, int actionUsrK, string cardFullName, string cardAddressStreet, string cardAddressArea, string cardAddressTown, string cardAddressCounty, int cardAddressCountryK, string cardAddressPostCode, string cardAddressCountry, string cardNumber, DateTime cardExpiryDate, string cardCV2, Transfer.FraudCheckEnum fraudCheckEnum, bool saveCard, Guid duplicateGuid, DateTime cardStartDate, string cardIssueNumber)
		{
			this.amount = Math.Round(amount, 2);
			if (this.amount <= 0)
			{
				throw new Exception("Cannot make a payment for " + this.amount.ToString("c") + ". It must be a positive amount.");
			}
			else
			{
				this.cardNumber = cardNumber.Trim().Replace(" ", "");
				this.cardAddressCountry = cardAddressCountry.Trim();
				this.fraudCheckEnum = fraudCheckEnum;
				this.invoiceDataHolders = invoices;
				this.transfer.Guid = Guid.NewGuid();
				this.transfer.DuplicateGuid = duplicateGuid;
				this.transfer.Amount = this.amount;
				this.transfer.Type = Transfer.TransferTypes.Payment;
				this.transfer.Method = Transfer.Methods.Card;
				this.transfer.Company = Model.Entities.Transfer.CompanyEnum.DH;
				this.transfer.CardAddress1 = cardAddressStreet.Trim();
				this.transfer.CardAddressArea = cardAddressArea;
				this.transfer.CardAddressCounty = cardAddressCounty;
				this.transfer.CardAddressTown = cardAddressTown;
				this.transfer.CardAddressCountryK = cardAddressCountryK;
				this.transfer.CardPostcode = cardAddressPostCode.Trim();
				this.transfer.CardName = cardFullName.Trim();
				this.transfer.CardCV2 = cardCV2.Trim();
				this.transfer.CardExpires = cardExpiryDate;
				this.transfer.CardStart = cardStartDate;
				if (cardIssueNumber.Length > 0)
					this.transfer.CardIssue = Convert.ToInt32(cardIssueNumber);
				this.transfer.SetUsrAndActionUsr(usr);
				this.transfer.DateTimeCreated = DateTime.Now;
				this.transfer.PromoterK = promoterK;
				this.usr = usr;

				this.transfer.StoreCardEndAndHashAndCardType(this.cardNumber);

				ValidateMinimumDetails();

				try
				{
					response = secVpnService.validateCardFull(
									userName,
									password,
									transfer.Guid.ToString(),				// DSI created SecPay Transaction Id "tran0001"
                                    ipAddress,								// Credit Card user IP address "127.0.0.1"
									cardFullName,							// User Name "Mr Cardholder"
									cardNumber,								// User card number "4444333322221111"
Пример #16
0
		public Usr User(int k)
		{
			if (userK == null)
				userK = new Dictionary<int, Usr>();
			try
			{
				if (!userK.ContainsKey(k))
					userK[k] = new Usr(k);
			}
			catch
			{
				return new Usr(4);
			}
			return userK[k];
		}
Пример #17
0
		public static IPagedDataService<Photo> GetUsrPhotosPagedDataService(Usr usr, int spottedByUsrK)
		{
			var orderBy = new []
			{
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.DateTime, OrderBy.OrderDirection.Descending)	,
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.K, OrderBy.OrderDirection.Descending)	
			};
			if (spottedByUsrK > 0)
			{
				return usr.ChildPhotosOfMe(new Q(Photo.Columns.UsrK, spottedByUsrK), orderBy);
			}
			else
			{
				return usr.ChildPhotosOfMe(orderBy);
			}
		}
Пример #18
0
		public void NickNameCachingIsWorking()
		{
			SetupCacheForTesting();
			Usr usr1 = new Usr(1);
			UnitTestUtilities.Sql.SqlTrace trace = new UnitTestUtilities.Sql.SqlTrace(Common.Properties.ConnectionString);
			trace.Start();
			Usr usrGotWithoutCachedNickname = Usr.GetFromNickName(usr1.NickName);
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads);
			trace.ClearData();
			trace.Start();
			Usr usrGotWithCachedNickname = Usr.GetFromNickName(usr1.NickName);
			trace.Stop();
			Assert.AreEqual(0, trace.TotalReads);

		}
Пример #19
0
		private void Page_Init(object sender, System.EventArgs e)
		{
			if (Usr.Current == null)
			{
				Usr u = new Usr(ContainerPage.Url["UsrK"]);
				if (u.LoginString.ToLower() != ContainerPage.Url["LoginString"].ToString().ToLower())
				{
					Usr.KickUserIfNotLoggedIn("You must be logged in to view your user preferences.");
				}
				else
				{
					CurrentUsr = u;
				}
			}
			else
				CurrentUsr = Usr.Current;
		}
Пример #20
0
		public void CountUsrs_PlaceConditions_NotIncludingIfUsrHasBeenToEventInTown()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();

			Random r = new Random();
			List<int> placeKs = new List<int>() { 1, 2, 3, 4 };
			List<int> notPlaceKs = new List<int>() { 5, 6, 7, 8, 9, 10, 11 };

			int usrsToCreate = 15;
			int usrs = 0;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();

				int i = r.Next(placeKs.Count + notPlaceKs.Count);
				int placeK;
				if (i < placeKs.Count)
				{
					usrs++;
					placeK = placeKs[i];
				}
				else
				{
					placeK = notPlaceKs[i - placeKs.Count];
				}
				UsrPlaceVisit up = new UsrPlaceVisit()
				{
					UsrK = u.K,
					PlaceK = placeK
				};
				up.Update();
			});

			Assert.AreEqual(usrs, Flyer.CountUsrs(placeKs, new List<int>(), false));
		}
Пример #21
0
		public static void DbTester(int key)
		{
			//Testing bob cache
			Random r = new Random();
			//Guid key = Guid.NewGuid();

			while (true)
			{
				try
				{
					//System.Threading.Thread.Sleep(50);

					Guid data = Guid.NewGuid();

					
					Usr u;
					try
					{
						u = new Usr(key);
					}
					catch (BobNotFound b)
					{
						u = new Usr(4);
					}
					catch (Exception e)
					{
						throw e;
					}

					//Caching.Instances.Main.Store(key.ToString("N"), data);

					System.Threading.Thread.Sleep(r.Next(500, 1500));
					//Caching.Instances.Main.Delete(key);

					string s = u.LoginString;

					Console.Write(".");
				}
				catch (Exception exception) { Console.Write("!"); } //exception.Message); }
			}
		}
Пример #22
0
		public void BobsCachingIsWorking()
		{
			SetupCacheForTesting();
			
			UnitTestUtilities.Sql.SqlTrace trace = new UnitTestUtilities.Sql.SqlTrace(Common.Properties.ConnectionString);
			trace.Start();
			Usr usr = new Usr();
			usr.Update();
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "First read was zero");
			trace.ClearData();
			trace.Start();
			Usr selectedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "Second read was zero");

			trace.ClearData();
			trace.Start();
			Usr cachedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreEqual(0, trace.TotalReads, "Third read was not zero");
		}
Пример #23
0
		public static void Enable(Usr CurrentUsr, int ParentObjectK, Model.Entities.ObjectType ParentObjectType)
		{
			if (ParentObjectType.Equals(Model.Entities.ObjectType.Thread))
			{
				Thread t = new Thread(ParentObjectK);
				bool changed = false;
				if (t.CheckPermissionRead(CurrentUsr))
				{
					ThreadUsr tu = t.GetThreadUsr(CurrentUsr);

					if (!tu.IsWatching)
					{
						tu.ChangeStatus(ThreadUsr.StatusEnum.Archived, true);
						changed = true;
					}

					if (changed)
					{
						UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob();
						job.ExecuteAsynchronously();
					}
				}
				return;
			}

			try
			{
				CommentAlert c = new CommentAlert(CurrentUsr.K, ParentObjectType, ParentObjectK);
			}
			catch
			{
				CommentAlert c = new CommentAlert();
				c.UsrK = CurrentUsr.K;
				c.ParentObjectK = ParentObjectK;
				c.ParentObjectType = ParentObjectType;
				c.Update();
			}
		}
Пример #24
0
		public void CountUsrs_NoConditions()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();
			int usrsToCreate = 15;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();
			});

			Query q = new Query();
			q.QueryCondition = new And(new Q(Usr.Columns.IsSkeleton, false), new Q(Usr.Columns.SendFlyers, true));
			q.ReturnCountOnly = true;

			int totalUsrs = new UsrSet(q).Count;
			Assert.AreEqual(usrsToCreate, totalUsrs);
			Assert.AreEqual(totalUsrs, Flyer.CountUsrs(new List<int>(), new List<int>(), false));
		}
Пример #25
0
		public void Test()
		{
			BuddyImporterService service = new BuddyImporterService();
			string email = "*****@*****.**";

			Usr u = new Usr();
			u.Update();

			Usr u2 = new Usr()
			{
				Email = email
			};
			u2.Update();

			Buddy b = new Buddy()
			{
				UsrK = u.K,
				BuddyUsrK = u2.K
			};
			b.Update();

			List<Contact> cList;
			List<Usr> uList;

			List<Contact> list = new List<Contact>()
			{
				new Contact("Bob", email)
			};

			int alreadyBuddies;
			service.SplitOutEmailContacts(list, u.K, out alreadyBuddies, out uList, out cList);

			Assert.AreEqual(1, uList.Count);
			Assert.IsTrue((bool)uList[0].ExtraSelectElements["BuddyRequested"]);
			Assert.AreEqual(0, cList.Count);
		}
Пример #26
0
		public void DoInvites(List<int> usrKs, Usr currentUsr)
		{
			try
			{
				CurrentThread.Invite(
					usrKs,
					currentUsr,
					DateTime.Now,
					new List<int>(),
					false,
					null,
					true);
			}
			catch (Exception ex) { Bobs.Global.Log("36bcfd0e-f9ec-4e91-85eb-df36fac2ffc4 Usr.Current.K=" + currentUsr.K + " ThreadK=" + CurrentThread.K, ex); }

			try
			{
				UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob(CurrentThread);
				job.ExecuteSynchronously();
			}
			catch (Exception ex) { Bobs.Global.Log("6165c2ba-d60f-4850-871f-002befecb0c6", ex); }
		}
Пример #27
0
		private string[] SerUsrSpottedInPhoto(Usr spottedUsr, int photoK, bool isInPhoto)
		{
			Photo p = new Photo(photoK);
			spottedUsr.SetSpottedInPhoto(p, Usr.Current, isInPhoto);
			return new string[] { p.UsrsInPhotoHtml, p.RolloverMouseOverText };
		}
Пример #28
0
		protected void MemberInvite(object sender, System.EventArgs e)
		{
			if (HasMemberAdmin)
			{
				if (this.uiMemberAdminInviteAutoComplete.Value.Length > 0)
				{
					int usrK = int.Parse(this.uiMemberAdminInviteAutoComplete.Value);
					Usr targetUsr = new Usr(usrK);
					GroupUsr targetGroupUsr = CurrentGroup.GetGroupUsr(targetUsr);
					Return r = CurrentGroup.Invite(targetUsr, targetGroupUsr, Usr.Current, CurrentGroupUsr, "", false);
					MemberInviteLabel.Text = (r.Success ? "Success: " : "Error: ") + r.MessageHtml;
				}
				else
					MemberInviteLabel.Text = "Please choose someone from the drop-down above!";
			}
		}
Пример #29
0
		void StoreSpotter()
		{

			bool NewSpotter = !Usr.Current.IsSpotter;

			Country c = new Country(int.Parse(AddressCountry.SelectedValue));

			#region update AdminNote when edited
			if (!NewSpotter)
			{
				Usr.Current.AdminNote += "\n\n******Spotter changed details on " + DateTime.Now.ToString() + " - old details: *****\n";
				if (!Usr.Current.FirstName.Equals(Cambro.Web.Helpers.StripHtml(FirstName.Text))
					|| !Usr.Current.LastName.Equals(Cambro.Web.Helpers.StripHtml(LastName.Text)))
					Usr.Current.AdminNote += "Name: " + Usr.Current.FirstName + " " + Usr.Current.LastName + "\n";
				if (!Usr.Current.AddressStreet.Equals(Cambro.Web.Helpers.StripHtml(AddressStreet.Text)))
					Usr.Current.AdminNote += "Street: " + Usr.Current.AddressStreet + "\n";
				if (!Usr.Current.AddressArea.Equals(Cambro.Web.Helpers.StripHtml(AddressArea.Text)))
					Usr.Current.AdminNote += "Area: " + Usr.Current.AddressArea + "\n";
				if (!Usr.Current.AddressTown.Equals(Cambro.Web.Helpers.StripHtml(AddressTown.Text)))
					Usr.Current.AdminNote += "Town: " + Usr.Current.AddressTown + "\n";
				if (!Usr.Current.AddressCounty.Equals(Cambro.Web.Helpers.StripHtml(AddressCounty.Text)))
					Usr.Current.AdminNote += "County: " + Usr.Current.AddressCounty + "\n";
				if (!Usr.Current.AddressPostcode.Equals(Cambro.Web.Helpers.StripHtml(AddressPostcode.Text)))
					Usr.Current.AdminNote += "Postcode: " + Usr.Current.AddressPostcode + "\n";
				if (!Usr.Current.DateOfBirth.Equals(new DateTime(int.Parse(DateOfBirthYear.Text), int.Parse(DateOfBirthMonth.Text), int.Parse(DateOfBirthDay.Text))))
					Usr.Current.AdminNote += "Date of birth: " + Usr.Current.DateOfBirth.ToString() + "\n";
				if (Usr.Current.AddressCountryK != c.K)
					Usr.Current.AdminNote += "Country: " + c.K + " (" + c.Name + ")\n";
			}
			#endregion

			Usr.Current.IsSpotter = true;
			Usr.Current.FirstName = Cambro.Web.Helpers.StripHtml(FirstName.Text);
			Usr.Current.LastName = Cambro.Web.Helpers.StripHtml(LastName.Text);
			StoreMobileNumber();
			Usr.Current.AddressStreet = Cambro.Web.Helpers.StripHtml(AddressStreet.Text);
			Usr.Current.AddressArea = Cambro.Web.Helpers.StripHtml(AddressArea.Text);
			Usr.Current.AddressTown = Cambro.Web.Helpers.StripHtml(AddressTown.Text);
			Usr.Current.AddressCounty = Cambro.Web.Helpers.StripHtml(AddressCounty.Text);
			Usr.Current.AddressPostcode = Cambro.Web.Helpers.StripHtml(AddressPostcode.Text);
			Usr.Current.DateOfBirth = new DateTime(int.Parse(DateOfBirthYear.Text), int.Parse(DateOfBirthMonth.Text), int.Parse(DateOfBirthDay.Text));
			Usr.Current.AddressCountryK = c.K;

			if (PhotoUsageDoNotUse.Checked)
				Usr.Current.PhotoUsage = Model.Entities.Usr.PhotoUsageEnum.DoNotUse;
			else if (PhotoUsageContact.Checked)
				Usr.Current.PhotoUsage = Model.Entities.Usr.PhotoUsageEnum.Contact;
			else
				Usr.Current.PhotoUsage = Model.Entities.Usr.PhotoUsageEnum.Use;

			if (NewSpotter)
			{
				Usr.Current.CardStatus = Usr.CardStatusEnum.New;

				
				Usr dsiUsr = new Usr(8);

				if (true)
				{
					Bobs.Group spottersGroup = new Bobs.Group(3480);
					GroupUsr guTarget = spottersGroup.GetGroupUsr(Usr.Current);
					GroupUsr guDsi = spottersGroup.GetGroupUsr(dsiUsr);

					spottersGroup.Invite(Usr.Current, guTarget, dsiUsr, guDsi, "Chat about being a Spotter and all things Spotting in the DontStayIn Spotters group!", false);

				}


				if (Usr.Current.AddressCountryK == 225)
				{
					Bobs.Group spottersGroup = new Bobs.Group(4537);
					GroupUsr guTarget = spottersGroup.GetGroupUsr(Usr.Current);
					GroupUsr guDsi = spottersGroup.GetGroupUsr(dsiUsr);

					spottersGroup.Invite(Usr.Current, guTarget, dsiUsr, guDsi, "Chat about being a USA based DontStayIn Spotter in the USA Spotters group!", false);
				}

				
			}

			Usr.Current.Update();

			if (CurrentEvent != null)
				Response.Redirect(CurrentEvent.SpotterSignUpUrl);
			else
				Response.Redirect("/pages/spotters");

		}
Пример #30
0
		protected void OwnerModeratorsAdd(object sender, System.EventArgs e)
		{
			if (HasOwner)
			{
				if (this.uiOwnerModeratorsAutoComplete.Value.Length > 0)
				{
					int usrK = int.Parse(this.uiOwnerModeratorsAutoComplete.Value);
					Usr u = new Usr(usrK);
					GroupUsr gu = CurrentGroup.GetGroupUsr(u);
					if (gu != null && gu.IsMember && !gu.Moderator)
					{
						gu.ChangeModeratorPermission(true, false, false, false);
						CurrentGroup.UpdateTotalMembers();
						BindModeratorsDataGrid();
					}
				}
			}
		}