Example #1
0
		public void Template(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting xxx...", 1);
			Query q = new Query();
			//q.QueryCondition=???
			CommentSet bs = new CommentSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Comment c = bs[count];

				try
				{
					// Do work here!
					c.Update();

					if (count % 10 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Example #2
0
		public static void Template(string[] args)
		{

			Console.WriteLine("============");
			Console.WriteLine("Template");
			Console.WriteLine("============");
			
			if (args.Length == 0)
			{
				Console.WriteLine("Press any key...");
				Console.ReadLine();
			}

			Q loadBalancer = args.Length == 2 ? new StringQueryCondition(" ([Photo].[K] % " + int.Parse(args[1]).ToString() + " = " + ((int)(int.Parse(args[0]) - 1)).ToString() + ") ") : new Q(true);

			Console.WriteLine("Selecting...", 1);
			Query q = new Query();
			q.QueryCondition = new And(
				loadBalancer
			);
			CommentSet bs = new CommentSet(q);
			Console.WriteLine("Found " + bs.Count.ToString("#,##0") + " item(s)...", 1);
			for (int count = 0; count < bs.Count; count++)
			{
				Comment c = bs[count];

				try
				{
					// Do work here!
					c.Update();

					if (count % 10 == 0)
						Console.WriteLine("Done " + count + "/" + bs.Count, 2);

				}
				catch (Exception ex)
				{
					Console.WriteLine("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Console.WriteLine("All done!");
			Console.ReadLine();
		}