Exemplo n.º 1
0
        /// <summary>
        /// Adds the list values.
        /// </summary>
        /// <param name="values">The values.</param>
        protected void AddListValues(string[] values)
        {
            SharePointListItem     listItem = new SharePointListItem(0, values);
            SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);

            provider.AddListItem(listName, listItem);
        }
        private void ProcessTotal(SharePointListItem sharepointListItem, ProjectCost projectCost, int[] months)
        {
            twelvtxtcavalue.Text    = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CA);
            twelvtxtcrvalue.Text    = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CR);
            twelvtxtrgvalue.Text    = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_RG);
            twelvtxtcivalue.Text    = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_CI);
            twelvtxttatalvalue.Text = string.Format("{0:n0}", sharepointListItem.SavedOver12Months_Total);

            yeartxtca.Text       = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CA);
            yeartxtcr.Text       = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CR);
            yeartxtrg.Text       = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_RG);
            yeartxtci.Text       = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_CI);
            yearlbltotalval.Text = string.Format("{0:n0}", sharepointListItem.SavedYearToDate_Total);

            esttxtca.Text       = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CA);
            esttxtcr.Text       = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CR);
            esttxtrg.Text       = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_RG);
            esttxtci.Text       = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_CI);
            estlbltotalval.Text = string.Format("{0:n0}", sharepointListItem.EstimatedSaving_Total);

            var targets = new[] { target1total, target2total, target3total, target4total, target5total, target6total, target7total, target8total, target9total, target10total, target11total, target12total };

            this.ProcessFooter(targets, months, projectCost.GetTargetTotal);

            var actuals = new[] { actual1total, actual2total, actual3total, actual4total, actual5total, actual6total, actual7total, actual8total, actual9total, actual10total, actual11total, actual12total };

            this.ProcessFooter(actuals, months, projectCost.GetActualTotal);
        }
Exemplo n.º 3
0
		public int SavePermissions(int groupId, int forumId, Permission permission)
		{
			string[] fieldNames = {"GroupID", "ForumID"};
			string[] fieldValues = {groupId.ToString(), forumId.ToString()};
			SharePointListItem listItem = Provider.GetListItemByField(ForumConstants.Lists_ForumAccess, fieldNames, fieldValues);

			int rc = 0;
			if (listItem == null)
			{
				string[] values = {
									  "Title", permission.ToString(),
									  "GroupID", groupId.ToString(),
									  "ForumID", forumId.ToString(),
				};

				listItem = new SharePointListItem(0, values);
				rc = Provider.AddListItem(ForumConstants.Lists_ForumAccess, listItem);
			}
			else
			{
				listItem["Title"] = permission.ToString();
				rc = Provider.UpdateListItem(ForumConstants.Lists_ForumAccess, listItem);
			}

			return rc;
		}
Exemplo n.º 4
0
        public int SavePermissions(int groupId, int forumId, Permission permission)
        {
            string[]           fieldNames  = { "GroupID", "ForumID" };
            string[]           fieldValues = { groupId.ToString(), forumId.ToString() };
            SharePointListItem listItem    = Provider.GetListItemByField(ForumConstants.Lists_ForumAccess, fieldNames, fieldValues);

            int rc = 0;

            if (listItem == null)
            {
                string[] values =
                {
                    "Title",   permission.ToString(),
                    "GroupID", groupId.ToString(),
                    "ForumID", forumId.ToString(),
                };

                listItem = new SharePointListItem(0, values);
                rc       = Provider.AddListItem(ForumConstants.Lists_ForumAccess, listItem);
            }
            else
            {
                listItem["Title"] = permission.ToString();
                rc = Provider.UpdateListItem(ForumConstants.Lists_ForumAccess, listItem);
            }

            return(rc);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the last user in the system.
        /// </summary>
        /// <returns></returns>
        public ForumUser GetLast()
        {
            SharePointListDescriptor descriptor = Provider.GetAllListItems(ForumConstants.Lists_Users);
            SharePointListItem       item       = descriptor.SharePointListItems[descriptor.SharePointListItems.Length - 1];

            return(UserMapper.CreateDomainObject(item));
        }
Exemplo n.º 6
0
        public void SharePointReflectionUtils_GetSharePointReferencesDictionary_ReferencesRetrievedWithSuccess()
        {
            // Arrange
            var item = new SharePointListItem
            {
                LookupField = new SharePointAggregatingListItem
                {
                    Id = 1
                }
            };

            var expectedReferencesDictionary = new Dictionary <string, object>();

            expectedReferencesDictionary.Add("LookupField", new SharePointAggregatingListItem {
                Id = 1
            });

            // Act
            var referencesDictionary = SharePointReflectionUtils.GetSharePointReferencesDictionary(item);

            // Assert
            expectedReferencesDictionary.Count.Should().Be(referencesDictionary.Count);

            referencesDictionary.Keys.ToList().ForEach(key =>
            {
                ((SharePointAggregatingListItem)expectedReferencesDictionary[key])
                .Id.Should().Be(((SharePointAggregatingListItem)referencesDictionary[key]).Id);
            });
        }
        public void SharePointExtensions_ConfigureReferences_ConfiguresAggregatingFromOriginalFields()
        {
            // Arrange
            var aggregatingListItem = new SharePointAggregatingListItem
            {
                Id         = 1,
                TitleField = "Aggregating Item"
            };
            var listItem = new SharePointListItem
            {
                TitleField  = "List Item",
                LookupField = aggregatingListItem
            };

            var tracking                    = new SharePointListItemTracking();
            var itemListTracking            = new SharePointItemTracking(null);
            var aggregatingListItemTracking = new SharePointItemTracking(null);

            itemListTracking.LoadOriginalItem(listItem);
            aggregatingListItemTracking.LoadOriginalItem(aggregatingListItem);

            tracking.Add(itemListTracking);
            tracking.Add(aggregatingListItemTracking);

            // Act
            itemListTracking.OriginalFields["LookupField"].Should().BeNull();
            itemListTracking.ConfigureReferences(tracking, true);

            // Assert
            itemListTracking.OriginalFields["LookupField"].Should().Be(aggregatingListItem.Id);
        }
        public void SharePointExtensions_GetReferences_AllReferencesFromObject()
        {
            // Arrange
            var item = new SharePointListItem
            {
                LookupField = new SharePointAggregatingListItem
                {
                    Id = 1
                }
            };

            var expectedReferencesDictionary = new Dictionary <string, object>();

            expectedReferencesDictionary.Add("LookupField", new SharePointAggregatingListItem {
                Id = 1
            });

            // Act
            var referencesDictionary = item.GetReferences();

            // Assert
            expectedReferencesDictionary.Count.Should().Be(referencesDictionary.Count);

            referencesDictionary.Keys.ToList().ForEach(key =>
            {
                ((SharePointAggregatingListItem)expectedReferencesDictionary[key])
                .Id.Should().Be(((SharePointAggregatingListItem)referencesDictionary[key]).Id);
            });
        }
Exemplo n.º 9
0
        /// <summary>
        /// Creates the domain object.
        /// </summary>
        /// <param name="listItem">The list item.</param>
        /// <returns></returns>
        public static Forum CreateDomainObject(SharePointListItem listItem)
        {
            int   categoryId = Convert.ToInt32(listItem["CategoryID"]);
            Forum forum      = new Forum(listItem.Id, categoryId, listItem["Title"]);

            forum.Description = listItem["Description"];
            if (listItem["TopicCount"] == null || listItem["TopicCount"] == string.Empty)
            {
                forum.TopicCount = 0;
            }
            else
            {
                forum.TopicCount = Convert.ToInt32(listItem["TopicCount"]);
            }

            if (listItem["PostCount"] == null || listItem["PostCount"] == string.Empty)
            {
                forum.PostCount = 0;
            }
            else
            {
                forum.PostCount = Convert.ToInt32(listItem["PostCount"]);
            }

            // TODO I think this is wrong. The last post should be set when
            // a topic is added, not modified
            forum.LastPost = Convert.ToDateTime(listItem["Modified"]);

            return(forum);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates the domain object.
        /// </summary>
        /// <param name="listItem">The list item.</param>
        /// <returns></returns>
        public static Category CreateDomainObject(SharePointListItem listItem)
        {
            Category category = new Category(listItem.Id, listItem["Title"]);

            category.SortOrder = Convert.ToInt32(listItem["SortOrder"]);

            return(category);
        }
Exemplo n.º 11
0
		/// <summary>
		/// Creates the domain object.
		/// </summary>
		/// <param name="listItem">The list item.</param>
		/// <returns></returns>
		public static Category CreateDomainObject(SharePointListItem listItem)
		{
			Category category = new Category(listItem.Id, listItem["Title"]);

			category.SortOrder = Convert.ToInt32(listItem["SortOrder"]);

			return category;
		}
Exemplo n.º 12
0
        public ForumUser GetLast()
        {
            SharePointListProvider   provider   = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListDescriptor descriptor = provider.GetAllListItems(ForumConstants.Lists_Users);
            SharePointListItem       item       = descriptor.SharePointListItems[descriptor.SharePointListItems.Length - 1];

            return(UserMapper.CreateDomainObject(item));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Finds the by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public Group FindById(int id)
        {
            SharePointListItem listItem = Provider.GetListItembyID(ForumConstants.Lists_Groups, id);
            Group group = new Group();

            group.Id   = listItem.Id;
            group.Name = listItem["Title"];
            return(group);
        }
Exemplo n.º 14
0
        public Group FindById(int id)
        {
            SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListItem     listItem = provider.GetListItembyID(ForumConstants.Lists_Groups, id);
            Group group = new Group();

            group.Id   = listItem.Id;
            group.Name = listItem["Title"];
            return(group);
        }
Exemplo n.º 15
0
        public Forum GetById(int id)
        {
            SharePointListItem currentItem = Provider.GetListItemByField(ForumConstants.Lists_Forums, "ID", id.ToString());

            if (currentItem == null)
            {
                return(new Forum(id, 1, "Default Forum"));
            }

            return(ForumMapper.CreateDomainObject(currentItem));
        }
Exemplo n.º 16
0
		/// <summary>
		/// Saves the specified group.
		/// </summary>
		/// <param name="group">The group.</param>
		/// <returns></returns>
		public int Save(Group group)
		{
			string[] values = {
				"Title", group.Name,
			};
			SharePointListItem listItem = new SharePointListItem(group.Id, values);

			if (group.Id == 0)
				return Provider.AddListItem(ForumConstants.Lists_Groups, listItem);
			else
				return Provider.UpdateListItem(ForumConstants.Lists_Groups, listItem);
		}
Exemplo n.º 17
0
        public Topic GetById(int id)
        {
            SharePointListItem currentItem = Provider.GetListItemByField(ForumConstants.Lists_Topics, "ID", id.ToString());

            // FIXME bit of a hack
            if (currentItem == null)
            {
                return(new Topic(id, 1, "Unknown Topic"));
            }

            return(TopicMapper.CreateDomainObject(currentItem));
        }
Exemplo n.º 18
0
        /// <summary>
        /// Gets the by share point id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public ForumUser GetBySharePointId(int id)
        {
            SharePointListItem listItem = Provider.GetListItemByField(ForumConstants.Lists_Users, "UserID", id.ToString());

            if (null == listItem)
            {
                CreateUserFromSharePointId(id);
                listItem = Provider.GetListItemByField(ForumConstants.Lists_Users, "UserID", id.ToString());
            }

            return(UserMapper.CreateDomainObject(listItem));
        }
Exemplo n.º 19
0
		public int Save(Group group)
		{
			SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
			string[] values = {
				"Title", group.Name,
			};
			SharePointListItem listItem = new SharePointListItem(group.Id, values);
			if (group.Id == 0)
				return provider.AddListItem(ForumConstants.Lists_Groups, listItem);
			else
				return provider.UpdateListItem(ForumConstants.Lists_Groups, listItem);
		}
Exemplo n.º 20
0
		public static Message CreateDomainObject(SharePointListItem listItem)
		{
			Message message = new Message(Convert.ToInt32(listItem["TopicID"]));

			message.Name = listItem["Title"];
			message.UserId = Convert.ToInt32(listItem["UserID"]);
			message.Author = RepositoryRegistry.ForumUserRepository.GetBySharePointId(message.UserId);
			message.Created = Convert.ToDateTime(listItem["Created"]);
			message.Body = listItem["Body"];
			message.Id = listItem.Id;

			return message;
		}
Exemplo n.º 21
0
		/// <summary>
		/// Loads the groups for user.
		/// </summary>
		/// <param name="listItem">The list item.</param>
		/// <param name="user">The user.</param>
		private static void LoadGroupsForUser(SharePointListItem listItem, ForumUser user)
		{
			string groupIds = listItem["Groups"];
			string delim = ";";
			char[] delimArray = delim.ToCharArray();
			string[] groupArray = groupIds.Split(delimArray);
			foreach (string s in groupArray)
			{
				int groupId = Convert.ToInt32(s);
				Group group = RepositoryRegistry.GroupRepository.FindById(groupId);
				user.Groups.Add(group);
			}
		}
Exemplo n.º 22
0
        public static Message CreateDomainObject(SharePointListItem listItem)
        {
            Message message = new Message(Convert.ToInt32(listItem["TopicID"]));

            message.Name    = listItem["Title"];
            message.UserId  = Convert.ToInt32(listItem["UserID"]);
            message.Author  = RepositoryRegistry.ForumUserRepository.GetBySharePointId(message.UserId);
            message.Created = Convert.ToDateTime(listItem["Created"]);
            message.Body    = listItem["Body"];
            message.Id      = listItem.Id;

            return(message);
        }
Exemplo n.º 23
0
        public ForumUser GetById(int id)
        {
            SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListItem     listItem = provider.GetListItemByField(ForumConstants.Lists_Users, "ID", id.ToString());

            if (null == listItem)
            {
                CreateUser(id);
                listItem = provider.GetListItemByField(ForumConstants.Lists_Users, "UserID", id.ToString());
            }

            return(UserMapper.CreateDomainObject(listItem));
        }
Exemplo n.º 24
0
		/// <summary>
		/// Loads the specified list item.
		/// </summary>
		/// <param name="listItem">The list item.</param>
		/// <returns></returns>
		public static Forum CreateDomainObject(SharePointListItem listItem)
		{
			int categoryId = Convert.ToInt32(listItem["CategoryID"]);
			Forum forum = new Forum(listItem.Id, categoryId, listItem["Title"]);

			forum.Description = listItem["Description"];

			// TODO I think this is wrong. The last post should be set when
			// a topic is added, not modified
			forum.LastPost = Convert.ToDateTime(listItem["Modified"]);

			return forum;
		}
Exemplo n.º 25
0
        public void Save(Message message)
        {
            SharePointListItem listItem = MessageMapper.CreateDto(message);

            if (message.Id == 0)
            {
                Provider.AddListItem(ForumConstants.Lists_Posts, listItem);
//				TopicRepository.IncreasePostCount(message.TopicId);
            }
            else
            {
                Provider.UpdateListItem(ForumConstants.Lists_Posts, listItem);
            }
        }
Exemplo n.º 26
0
        private static void LoadGroupsForUser(SharePointListItem listItem, ForumUser user)
        {
            string groupIds = listItem["Groups"];
            string delim    = ";";

            char[]   delimArray = delim.ToCharArray();
            string[] groupArray = groupIds.Split(delimArray);
            foreach (string s in groupArray)
            {
                int   groupId = Convert.ToInt32(s);
                Group group   = RepositoryRegistry.GroupRepository.FindById(groupId);
                user.Groups.Add(group);
            }
        }
Exemplo n.º 27
0
		public static Topic CreateDomainObject(SharePointListItem item)
		{
			Topic topic = new Topic(item.Id, Convert.ToInt32(item["ForumID"]), item["Title"]);

			topic.Views = Convert.ToInt32(item["Views"]);
			topic.TopicStarterId = Convert.ToInt32(item["TopicStarterID"]);
			topic.Author = RepositoryRegistry.ForumUserRepository.GetBySharePointId(topic.TopicStarterId);

			// Built in values from SharePoint list
			// TODO might be the wrong value
			topic.LastPost = Convert.ToDateTime(item["Modified"]);

			return topic;
		}
Exemplo n.º 28
0
        public static Topic CreateDomainObject(SharePointListItem item)
        {
            Topic topic = new Topic(item.Id, Convert.ToInt32(item["ForumID"]), item["Title"]);

            topic.Views          = Convert.ToInt32(item["Views"]);
            topic.TopicStarterId = Convert.ToInt32(item["TopicStarterID"]);
            topic.Author         = RepositoryRegistry.ForumUserRepository.GetBySharePointId(topic.TopicStarterId);

            // Built in values from SharePoint list
            // TODO might be the wrong value
            topic.LastPost = Convert.ToDateTime(item["Modified"]);

            return(topic);
        }
        public void SharePointExtensions_ToDictionary_ConvertsObjectToDictionaryWithSuccess()
        {
            // Arrange
            var item = new SharePointListItem
            {
                IntegerField       = 1,
                ChoiceField        = true,
                TitleField         = "Title",
                DecimalField       = 22.00M,
                CurrencyField      = 1000M,
                OptionField        = "Option 2",
                TextField          = "Single Line",
                TextArea           = "Multiple Lines",
                DateField          = DateTime.Now.Date,
                PersonOrGroupField = "Username",
                LinkField          = "https://www.microsoft.com",
                ImageField         = "https://www.microsoft.com"
            };

            var expectedFieldsDictionary = new Dictionary <string, object>();

            expectedFieldsDictionary.Add("Title", "Title");
            expectedFieldsDictionary.Add("IntegerField", 1);
            expectedFieldsDictionary.Add("ChoiceField", true);
            expectedFieldsDictionary.Add("LookupField", null);
            expectedFieldsDictionary.Add("DecimalField", 22.00M);
            expectedFieldsDictionary.Add("CurrencyField", 1000M);
            expectedFieldsDictionary.Add("OptionField", "Option 2");
            expectedFieldsDictionary.Add("TextField", "Single Line");
            expectedFieldsDictionary.Add("DateField", item.DateField);
            expectedFieldsDictionary.Add("TextArea", "Multiple Lines");
            expectedFieldsDictionary.Add("Created", DateTime.MinValue);
            expectedFieldsDictionary.Add("Modified", DateTime.MinValue);
            expectedFieldsDictionary.Add("PersonOrGroupField", "Username");
            expectedFieldsDictionary.Add("LinkField", "https://www.microsoft.com");
            expectedFieldsDictionary.Add("ImageField", "https://www.microsoft.com");

            // Act
            var fieldsDictionary = item.ToDictionary();

            // Assert
            expectedFieldsDictionary.Count.Should().Be(fieldsDictionary.Count);

            fieldsDictionary.Keys.ToList().ForEach(key =>
            {
                expectedFieldsDictionary[key].Should().Be(fieldsDictionary[key]);
            });
        }
Exemplo n.º 30
0
		/// <summary>
		/// Creates the domain object.
		/// </summary>
		/// <param name="listItem">The list item.</param>
		/// <returns></returns>
		public static ForumUser CreateDomainObject(SharePointListItem listItem)
		{
			ForumUser user = new ForumUser();

			user.Id = Convert.ToInt32(listItem.Id);
			user.LastVisit = Convert.ToDateTime(listItem["LastVisit"]);
			user.UserId = Convert.ToInt32(listItem["UserID"]);
			user.NumPosts = Convert.ToInt32(listItem["NumPosts"]);
			user.Joined = Convert.ToDateTime(listItem["Created"]);
			user.IsAdmin = Convert.ToBoolean(listItem["IsAdmin"]);

			LoadGroupsForUser(listItem, user);
			LoadSharePointInfoForUser(user);

			return user;
		}
Exemplo n.º 31
0
        /// <summary>
        /// Saves the specified category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        public int Save(Category category)
        {
            SharePointListItem listItem = CategoryMapper.CreateDto(category);
            int categoryId;

            if (listItem.Id == 0)
            {
                categoryId = Provider.AddListItem(ForumConstants.Lists_Category, listItem);
            }
            else
            {
                categoryId = Provider.UpdateListItem(ForumConstants.Lists_Category, listItem);
            }

            return(categoryId);
        }
Exemplo n.º 32
0
        public static ForumUser CreateDomainObject(SharePointListItem listItem)
        {
            ForumUser user = new ForumUser();

            user.Id        = Convert.ToInt32(listItem.Id);
            user.LastVisit = Convert.ToDateTime(listItem["LastVisit"]);
            user.UserId    = Convert.ToInt32(listItem["UserID"]);
            user.NumPosts  = Convert.ToInt32(listItem["NumPosts"]);
            user.Joined    = Convert.ToDateTime(listItem["Created"]);
            user.IsAdmin   = Convert.ToBoolean(listItem["IsAdmin"]);

            LoadGroupsForUser(listItem, user);
            LoadSharePointInfoForUser(user);

            return(user);
        }
Exemplo n.º 33
0
        public int Save(Topic topic)
        {
            SharePointListItem listItem = TopicMapper.CreateDto(topic);
            int newTopicId = 0;

            if (topic.Id == 0)
            {
                newTopicId = Provider.AddListItem(ForumConstants.Lists_Topics, listItem);
                RepositoryRegistry.ForumRepository.IncreaseCount(topic.ForumId);
            }
            else
            {
                newTopicId = Provider.UpdateListItem(ForumConstants.Lists_Topics, listItem);
            }

            return(newTopicId);
        }
Exemplo n.º 34
0
        public int Save(ForumUser user)
        {
            int userId;

            SharePointListItem listItem = UserMapper.CreateDto(user);

            if (user.Id == 0)
            {
                userId = Provider.AddListItem(ForumConstants.Lists_Users, listItem);
            }
            else
            {
                userId = Provider.UpdateListItem(ForumConstants.Lists_Users, listItem);
            }

            return(userId);
        }
Exemplo n.º 35
0
        public int Save(Forum forum)
        {
            SharePointListItem listItem = ForumMapper.CreateDto(forum);
            int newId = 0;

            if (forum.Id == 0)
            {
                newId = Provider.AddListItem(ForumConstants.Lists_Forums, listItem);
                SetupDefaultPermissions(newId);
            }
            else
            {
                newId = Provider.UpdateListItem(ForumConstants.Lists_Forums, listItem);
            }

            return(newId);
        }
Exemplo n.º 36
0
        /// <summary>
        /// Saves the specified group.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        public int Save(Group group)
        {
            string[] values =
            {
                "Title", group.Name,
            };
            SharePointListItem listItem = new SharePointListItem(group.Id, values);

            if (group.Id == 0)
            {
                return(Provider.AddListItem(ForumConstants.Lists_Groups, listItem));
            }
            else
            {
                return(Provider.UpdateListItem(ForumConstants.Lists_Groups, listItem));
            }
        }
Exemplo n.º 37
0
        public int Save(ForumUser user)
        {
            int userId;

            SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
            SharePointListItem     listItem = UserMapper.CreateDto(user);

            if (user.Id == 0)
            {
                userId = provider.AddListItem(ForumConstants.Lists_Users, listItem);
            }
            else
            {
                userId = provider.UpdateListItem(ForumConstants.Lists_Users, listItem);
            }

            return(userId);
        }
        private ProjectCost ProcessCost(int[] months)
        {
            var period      = int.Parse(ddlPeriod.SelectedValue);
            var projectCost = new ProjectCost(period);

            projectCost.CapExAmount        = this.GetProcessedCost(txtcapExp.Text.Trim());
            projectCost.ImplementationCost = this.GetProcessedCost(txtimplcost.Text.Trim());
            hdntotal.Value = string.Format("{0:n0}", projectCost.TotalCost);
            this.ProcessCheckBoxes(projectCost, chkCostAvoidance, ProjectType.CostAvoidance, this.TargetTextBoxesForCA, this.ActualTextBoxesForCA, months);
            this.ProcessCheckBoxes(projectCost, chkCostReduction, ProjectType.CostReduction, this.TargetTextBoxesForCR, this.ActualTextBoxesForCR, months);
            this.ProcessCheckBoxes(projectCost, chkRevenueGrowth, ProjectType.RevenueGrowth, this.TargetTextBoxesForRG, this.ActualTextBoxesForRG, months);
            this.ProcessCheckBoxes(projectCost, chkCapacityIncrease, ProjectType.CapacityIncrease, this.TargetTextBoxesForCI, this.ActualTextBoxesForCI, months);

            var sharepointListItem = SharePointListItem.Convert(projectCost, int.Parse(lblmnth1.Text));

            this.ProcessTotal(sharepointListItem, projectCost, months);
            return(projectCost);
        }
Exemplo n.º 39
0
		/// <summary>
		/// Creates the domain object.
		/// </summary>
		/// <param name="item">The item.</param>
		/// <returns></returns>
		public static Topic CreateDomainObject(SharePointListItem item)
		{
			Topic topic = new Topic(item.Id, Convert.ToInt32(item["ForumID"]), item["Title"]);

			topic.Views = Convert.ToInt32(item["Views"]);
			topic.TopicStarterId = Convert.ToInt32(item["TopicStarterID"]);
			topic.Author = RepositoryRegistry.ForumUserRepository.GetBySharePointId(topic.TopicStarterId);
			
			if(item["NumPosts"] == null || item["NumPosts"] == string.Empty)
				topic.NumPosts = 0;
			else
				topic.NumPosts = Convert.ToInt32(item["NumPosts"]);

			MessageCollection messages = topic.Messages;
			messages.Sort("Modified", SortDirection.Descending);
			topic.LastPost = Convert.ToDateTime(messages[messages.Count-1].Modified);

			return topic;
		}
Exemplo n.º 40
0
        public int Save(Group group)
        {
            SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);

            string[] values =
            {
                "Title", group.Name,
            };
            SharePointListItem listItem = new SharePointListItem(group.Id, values);

            if (group.Id == 0)
            {
                return(provider.AddListItem(ForumConstants.Lists_Groups, listItem));
            }
            else
            {
                return(provider.UpdateListItem(ForumConstants.Lists_Groups, listItem));
            }
        }
Exemplo n.º 41
0
 public static ProjectCost Convert(SharePointListItem item, int period)
 {
     var projectCost = new ProjectCost(period);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 1, item.CA_Actual_Jan);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 2, item.CA_Actual_Feb);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 3, item.CA_Actual_Mar);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 4, item.CA_Actual_Apr);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 5, item.CA_Actual_May);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 6, item.CA_Actual_Jun);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 7, item.CA_Actual_Jul);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 8, item.CA_Actual_Aug);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 9, item.CA_Actual_Sep);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 10, item.CA_Actual_Oct);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 11, item.CA_Actual_Nov);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 12, item.CA_Actual_Dec);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 1, item.CA_Target_Jan);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 2, item.CA_Target_Feb);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 3, item.CA_Target_Mar);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 4, item.CA_Target_Apr);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 5, item.CA_Target_May);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 6, item.CA_Target_Jun);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 7, item.CA_Target_Jul);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 8, item.CA_Target_Aug);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 9, item.CA_Target_Sep);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 10, item.CA_Target_Oct);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 11, item.CA_Target_Nov);
     projectCost.SetCostEntry(ProjectType.CostAvoidance, CostType.Target, 12, item.CA_Target_Dec);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 1, item.CR_Actual_Jan);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 2, item.CR_Actual_Feb);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 3, item.CR_Actual_Mar);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 4, item.CR_Actual_Apr);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 5, item.CR_Actual_May);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 6, item.CR_Actual_Jun);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 7, item.CR_Actual_Jul);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 8, item.CR_Actual_Aug);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 9, item.CR_Actual_Sep);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 10, item.CR_Actual_Oct);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 11, item.CR_Actual_Nov);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Actual, 12, item.CR_Actual_Dec);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 1, item.CR_Target_Jan);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 2, item.CR_Target_Feb);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 3, item.CR_Target_Mar);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 4, item.CR_Target_Apr);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 5, item.CR_Target_May);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 6, item.CR_Target_Jun);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 7, item.CR_Target_Jul);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 8, item.CR_Target_Aug);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 9, item.CR_Target_Sep);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 10, item.CR_Target_Oct);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 11, item.CR_Target_Nov);
     projectCost.SetCostEntry(ProjectType.CostReduction, CostType.Target, 12, item.CR_Target_Dec);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 1, item.RG_Actual_Jan);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 2, item.RG_Actual_Feb);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 3, item.RG_Actual_Mar);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 4, item.RG_Actual_Apr);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 5, item.RG_Actual_May);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 6, item.RG_Actual_Jun);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 7, item.RG_Actual_Jul);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 8, item.RG_Actual_Aug);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 9, item.RG_Actual_Sep);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 10, item.RG_Actual_Oct);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 11, item.RG_Actual_Nov);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 12, item.RG_Actual_Dec);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 1, item.RG_Target_Jan);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 2, item.RG_Target_Feb);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 3, item.RG_Target_Mar);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 4, item.RG_Target_Apr);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 5, item.RG_Target_May);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 6, item.RG_Target_Jun);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 7, item.RG_Target_Jul);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 8, item.RG_Target_Aug);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 9, item.RG_Target_Sep);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 10, item.RG_Target_Oct);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 11, item.RG_Target_Nov);
     projectCost.SetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 12, item.RG_Target_Dec);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 1, item.CI_Actual_Jan);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 2, item.CI_Actual_Feb);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 3, item.CI_Actual_Mar);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 4, item.CI_Actual_Apr);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 5, item.CI_Actual_May);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 6, item.CI_Actual_Jun);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 7, item.CI_Actual_Jul);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 8, item.CI_Actual_Aug);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 9, item.CI_Actual_Sep);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 10, item.CI_Actual_Oct);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 11, item.CI_Actual_Nov);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 12, item.CI_Actual_Dec);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 1, item.CI_Target_Jan);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 2, item.CI_Target_Feb);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 3, item.CI_Target_Mar);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 4, item.CI_Target_Apr);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 5, item.CI_Target_May);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 6, item.CI_Target_Jun);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 7, item.CI_Target_Jul);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 8, item.CI_Target_Aug);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 9, item.CI_Target_Sep);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 10, item.CI_Target_Oct);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 11, item.CI_Target_Nov);
     projectCost.SetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 12, item.CI_Target_Dec);
     return projectCost;
 }
Exemplo n.º 42
0
        public static SharePointListItem Convert(ProjectCost projectCost, int monthToStart)
        {
            var item = new SharePointListItem();
            item.CA_Actual_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 1));
            item.CA_Actual_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 2));
            item.CA_Actual_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 3));
            item.CA_Actual_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 4));
            item.CA_Actual_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 5));
            item.CA_Actual_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 6));
            item.CA_Actual_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 7));
            item.CA_Actual_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 8));
            item.CA_Actual_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 9));
            item.CA_Actual_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 10));
            item.CA_Actual_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 11));
            item.CA_Actual_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Actual, 12));
            item.CA_Target_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 1));
            item.CA_Target_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 2));
            item.CA_Target_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 3));
            item.CA_Target_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 4));
            item.CA_Target_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 5));
            item.CA_Target_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 6));
            item.CA_Target_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 7));
            item.CA_Target_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 8));
            item.CA_Target_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 9));
            item.CA_Target_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 10));
            item.CA_Target_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 11));
            item.CA_Target_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostAvoidance, CostType.Target, 12));
            item.CR_Actual_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 1));
            item.CR_Actual_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 2));
            item.CR_Actual_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 3));
            item.CR_Actual_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 4));
            item.CR_Actual_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 5));
            item.CR_Actual_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 6));
            item.CR_Actual_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 7));
            item.CR_Actual_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 8));
            item.CR_Actual_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 9));
            item.CR_Actual_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 10));
            item.CR_Actual_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 11));
            item.CR_Actual_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Actual, 12));
            item.CR_Target_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 1));
            item.CR_Target_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 2));
            item.CR_Target_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 3));
            item.CR_Target_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 4));
            item.CR_Target_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 5));
            item.CR_Target_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 6));
            item.CR_Target_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 7));
            item.CR_Target_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 8));
            item.CR_Target_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 9));
            item.CR_Target_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 10));
            item.CR_Target_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 11));
            item.CR_Target_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CostReduction, CostType.Target, 12));
            item.RG_Actual_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 1));
            item.RG_Actual_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 2));
            item.RG_Actual_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 3));
            item.RG_Actual_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 4));
            item.RG_Actual_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 5));
            item.RG_Actual_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 6));
            item.RG_Actual_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 7));
            item.RG_Actual_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 8));
            item.RG_Actual_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 9));
            item.RG_Actual_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 10));
            item.RG_Actual_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 11));
            item.RG_Actual_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Actual, 12));
            item.RG_Target_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 1));
            item.RG_Target_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 2));
            item.RG_Target_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 3));
            item.RG_Target_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 4));
            item.RG_Target_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 5));
            item.RG_Target_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 6));
            item.RG_Target_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 7));
            item.RG_Target_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 8));
            item.RG_Target_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 9));
            item.RG_Target_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 10));
            item.RG_Target_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 11));
            item.RG_Target_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.RevenueGrowth, CostType.Target, 12));
            item.CI_Actual_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 1));
            item.CI_Actual_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 2));
            item.CI_Actual_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 3));
            item.CI_Actual_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 4));
            item.CI_Actual_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 5));
            item.CI_Actual_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 6));
            item.CI_Actual_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 7));
            item.CI_Actual_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 8));
            item.CI_Actual_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 9));
            item.CI_Actual_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 10));
            item.CI_Actual_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 11));
            item.CI_Actual_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Actual, 12));
            item.CI_Target_Jan = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 1));
            item.CI_Target_Feb = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 2));
            item.CI_Target_Mar = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 3));
            item.CI_Target_Apr = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 4));
            item.CI_Target_May = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 5));
            item.CI_Target_Jun = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 6));
            item.CI_Target_Jul = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 7));
            item.CI_Target_Aug = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 8));
            item.CI_Target_Sep = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 9));
            item.CI_Target_Oct = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 10));
            item.CI_Target_Nov = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 11));
            item.CI_Target_Dec = ToProcessedString(projectCost.GetCostEntry(ProjectType.CapacityIncrease, CostType.Target, 12));
            item.Total_Actual_Jan = ToActualString(projectCost.GetActualTotal(1));
            item.Total_Actual_Feb = ToActualString(projectCost.GetActualTotal(2));
            item.Total_Actual_Mar = ToActualString(projectCost.GetActualTotal(3));
            item.Total_Actual_Apr = ToActualString(projectCost.GetActualTotal(4));
            item.Total_Actual_May = ToActualString(projectCost.GetActualTotal(5));
            item.Total_Actual_Jun = ToActualString(projectCost.GetActualTotal(6));
            item.Total_Actual_Jul = ToActualString(projectCost.GetActualTotal(7));
            item.Total_Actual_Aug = ToActualString(projectCost.GetActualTotal(8));
            item.Total_Actual_Sep = ToActualString(projectCost.GetActualTotal(9));
            item.Total_Actual_Oct = ToActualString(projectCost.GetActualTotal(10));
            item.Total_Actual_Nov = ToActualString(projectCost.GetActualTotal(11));
            item.Total_Actual_Dec = ToActualString(projectCost.GetActualTotal(12));
            item.Total_Target_Jan = ToActualString(projectCost.GetTargetTotal(1));
            item.Total_Target_Feb = ToActualString(projectCost.GetTargetTotal(2));
            item.Total_Target_Mar = ToActualString(projectCost.GetTargetTotal(3));
            item.Total_Target_Apr = ToActualString(projectCost.GetTargetTotal(4));
            item.Total_Target_May = ToActualString(projectCost.GetTargetTotal(5));
            item.Total_Target_Jun = ToActualString(projectCost.GetTargetTotal(6));
            item.Total_Target_Jul = ToActualString(projectCost.GetTargetTotal(7));
            item.Total_Target_Aug = ToActualString(projectCost.GetTargetTotal(8));
            item.Total_Target_Sep = ToActualString(projectCost.GetTargetTotal(9));
            item.Total_Target_Oct = ToActualString(projectCost.GetTargetTotal(10));
            item.Total_Target_Nov = ToActualString(projectCost.GetTargetTotal(11));
            item.Total_Target_Dec = ToActualString(projectCost.GetTargetTotal(12));

            var savedOver12Months_CA = projectCost.GetSavedOver12Months(ProjectType.CostAvoidance, monthToStart);
            var savedOver12Months_CR = projectCost.GetSavedOver12Months(ProjectType.CostReduction, monthToStart);
            var savedOver12Months_RG = projectCost.GetSavedOver12Months(ProjectType.RevenueGrowth, monthToStart);
            var savedOver12Months_CI = projectCost.GetSavedOver12Months(ProjectType.CapacityIncrease, monthToStart);

            item.SavedOver12Months_CA = ToActualString(savedOver12Months_CA);
            item.SavedOver12Months_CR = ToActualString(savedOver12Months_CR);
            item.SavedOver12Months_RG = ToActualString(savedOver12Months_RG);
            item.SavedOver12Months_CI = ToActualString(savedOver12Months_CI);
            item.SavedOver12Months_Total = ToActualString(savedOver12Months_CA + savedOver12Months_CR + savedOver12Months_RG + savedOver12Months_CI);

            var savedYearToDate_CA = projectCost.GetSavedYearToDate(ProjectType.CostAvoidance, monthToStart);
            var savedYearToDate_CR = projectCost.GetSavedYearToDate(ProjectType.CostReduction, monthToStart);
            var savedYearToDate_RG = projectCost.GetSavedYearToDate(ProjectType.RevenueGrowth, monthToStart);
            var savedYearToDate_CI = projectCost.GetSavedYearToDate(ProjectType.CapacityIncrease, monthToStart);
            item.SavedYearToDate_CA = ToActualString(savedYearToDate_CA);
            item.SavedYearToDate_CR = ToActualString(savedYearToDate_CR);
            item.SavedYearToDate_RG = ToActualString(savedYearToDate_RG);
            item.SavedYearToDate_CI = ToActualString(savedYearToDate_CI);
            item.SavedYearToDate_Total = ToActualString(savedYearToDate_CA + savedYearToDate_CR + savedYearToDate_RG + savedYearToDate_CI);

            var estimatedSaving_CA = projectCost.GetEstimatedSavingsToBeRealized(ProjectType.CostAvoidance, monthToStart);
            var estimatedSaving_CR = projectCost.GetEstimatedSavingsToBeRealized(ProjectType.CostReduction, monthToStart);
            var estimatedSaving_RG = projectCost.GetEstimatedSavingsToBeRealized(ProjectType.RevenueGrowth, monthToStart);
            var estimatedSaving_CI = projectCost.GetEstimatedSavingsToBeRealized(ProjectType.CapacityIncrease, monthToStart);
            item.EstimatedSaving_CA = ToActualString(estimatedSaving_CA);
            item.EstimatedSaving_CR = ToActualString(estimatedSaving_CR);
            item.EstimatedSaving_RG = ToActualString(estimatedSaving_RG);
            item.EstimatedSaving_CI = ToActualString(estimatedSaving_CI);
            item.EstimatedSaving_Total = ToActualString(estimatedSaving_CA + estimatedSaving_CR + estimatedSaving_RG + estimatedSaving_CI);
            return item;
        }
Exemplo n.º 43
0
		/// <summary>
		/// Adds the list values.
		/// </summary>
		/// <param name="values">The values.</param>
		protected void AddListValues(string[] values)
		{
			SharePointListItem listItem = new SharePointListItem(0, values);
			SharePointListProvider provider = new SharePointListProvider(ForumApplication.Instance.SpWeb);
			provider.AddListItem(listName, listItem);
		}