示例#1
0
		public static string GetEmailBookOfUser(Guid userGuid, bool showEmailCount, bool showCheckBox)
		{
			Business.EmailBook emailBookController = new Business.EmailBook();
			string tree = string.Empty;
			Common.User user = Facade.User.LoadUser(userGuid);
			bool isAdmin = Helper.GetBool(user.IsAdmin.ToString());
			DataTable dataTableEmailBookUser = emailBookController.GetEmailBookUser(isAdmin, user.UserGuid, user.ParentGuid);

			DataTable dataTableRoot = emailBookController.GetRoot();

			if (dataTableRoot.Rows.Count == 0)
				return string.Empty;

			Guid rootGuid = Helper.GetGuid(dataTableRoot.Rows[0]["Guid"].ToString());

			tree += "<div class='myList'><ul class='browser filetree'>";
			tree += string.Format("<li><span class='root folder' guid='{0}'>{1}{2}</span><ul id='child'>",
																																Guid.Empty,
																																showCheckBox ? "<input onclick='checkBoxControlChecked(this);' type='checkbox'/>" : string.Empty,
																																dataTableRoot.Rows[0]["Name"].ToString());

			GenerateTree(dataTableEmailBookUser, rootGuid, showEmailCount, showCheckBox, ref tree);

			tree += "</ul></li></ul></div>";

			return tree;
		}
示例#2
0
		public static bool ChangeParent(Guid emailBookGuid, Guid parentGuid)
		{
			Business.EmailBook emailBookController = new Business.EmailBook();
			if (parentGuid == Guid.Empty)
				parentGuid = Helper.GetGuid(emailBookController.GetRoot().Rows[0]["Guid"]);

			return emailBookController.UpdateParent(emailBookGuid, parentGuid);
		}
示例#3
0
		public static Guid InsertItemInEmailBook(Common.EmailBook emailBook)
		{
			Business.EmailBook emailBookController = new Business.EmailBook();
			if (emailBook.ParentGuid == Guid.Empty)
				emailBook.ParentGuid = Helper.GetGuid(emailBookController.GetRoot().Rows[0]["Guid"]);

			if (!emailBookController.CheckingName(emailBook.Name, emailBook.UserGuid))
				return Guid.Empty;
			else
			{
				Business.User userController = new Business.User();

				if (userController.IsAdminUser(emailBook.UserGuid))
					emailBook.AdminGuid = emailBook.UserGuid;
				else
					emailBook.AdminGuid = userController.GetParentGuid(emailBook.UserGuid);

				emailBook.CreateDate = DateTime.Now;
				emailBook.UserGuid = emailBook.UserGuid;
				return emailBookController.Insert(emailBook);
			}
		}