Ejemplo n.º 1
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        /// <param name="entity">The project mailbox to save.</param>
        /// <returns></returns>
        public static bool SaveOrUpdate(ProjectMailbox entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (entity.ProjectId <= Globals.NEW_ID)
            {
                throw (new ArgumentException("Cannot save milestone, the project id is invalid"));
            }
            if (string.IsNullOrEmpty(entity.Mailbox))
            {
                throw (new ArgumentException("The mailbox cannot be empty or null"));
            }

            if (entity.Id > Globals.NEW_ID)
            {
                return(DataProviderManager.Provider.UpdateProjectMailbox(entity));
            }

            var tempId = DataProviderManager.Provider.CreateProjectMailbox(entity);

            if (tempId <= 0)
            {
                return(false);
            }

            entity.Id = tempId;
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the btnAdd control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var mailbox = new ProjectMailbox
            {
                AssignToDisplayName = string.Empty,
                AssignToId          = Guid.Empty,
                AssignToUserName    = IssueAssignedUser.SelectedValue,
                IssueTypeId         = IssueAssignedType.SelectedValue,
                Mailbox             = txtMailbox.Text,
                ProjectId           = ProjectId
            };

            if (ProjectMailboxManager.SaveOrUpdate(mailbox))
            {
                BindMailboxes();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Ts the generate project mailbox list from reader.
 /// </summary>
 /// <param name="returnData">The return data.</param>
 /// <param name="projectMailboxList">The project mailbox list.</param>
 private static void GenerateProjectMailboxListFromReader(IDataReader returnData,
                                                          ref List <ProjectMailbox> projectMailboxList)
 {
     while (returnData.Read())
     {
         var mailbox = new ProjectMailbox
         {
             AssignToDisplayName = returnData.GetString(returnData.GetOrdinal("AssignToDisplayName")),
             AssignToId          = returnData["AssignToUserId"] as Guid? ?? Guid.Empty,
             AssignToUserName    = DefaultIfNull(returnData["AssignToUserName"], string.Empty),
             Id            = returnData.GetInt32(returnData.GetOrdinal("ProjectMailboxId")),
             IssueTypeId   = returnData.GetInt32(returnData.GetOrdinal("IssueTypeId")),
             IssueTypeName = returnData.GetString(returnData.GetOrdinal("IssueTypeName")),
             Mailbox       = returnData.GetString(returnData.GetOrdinal("Mailbox")),
             ProjectId     = returnData.GetInt32(returnData.GetOrdinal("ProjectId"))
         };
         projectMailboxList.Add(mailbox);
     }
 }
Ejemplo n.º 4
0
 public abstract bool UpdateProjectMailbox(ProjectMailbox mailboxToUpdate);
Ejemplo n.º 5
0
 public abstract int CreateProjectMailbox(ProjectMailbox mailboxToUpdate);