コード例 #1
0
        public IEnumerable <Deliverable> GetDeliverablesAndBlufFromProject(int projectId)
        {
            //Call method to return Deliverable + ProjectList
            IEnumerable <Deliverable> ListDeliverables = GetDeliverablesFromProject(projectId);


            // Decided to go with max(blufId) instead of date to prevent if the bluf is
            // edited more than once in a given day.
            string sql =
                @"SELECT
	                * 
                FROM 
	                DeliverableBluf 
                WHERE 
	                    BlufId = (SELECT MAX(BlufId) FROM DeliverableBluf WHERE DeliverableId = @id)
                    AND
		                DeliverableId = @id"        ;

            //Add bluf to each Deliverables
            foreach (var item in ListDeliverables)
            {
                Bluf bluf = db.Query <Bluf>(sql, new { id = item.DeliverableId }).SingleOrDefault();
                item.Bluf = bluf;
            }

            return(ListDeliverables);
        }
コード例 #2
0
        public void PostBluf(Bluf bluf)
        {
            //By design, the update functions add a new row to the database, therefore not deleting the previous data.

            var sql = @"INSERT INTO[dbo].[DeliverableBluf]
                        ([DeliverableId]
                          ,[Schedule]
                          ,[Budget]
                          ,[Scope]
                          ,[Issues]
                          ,[OtherRisks]
                          ,[Date])
                       VALUES
                            (@DeliverableId,
                            @Schedule,
                            @Budget,
                            @Scope,
                            @Issues,
                            @OtherRisks,
                            @Date)";

            var isSuccess = db.Execute(sql,
                                       new
            {
                @DeliverableId = bluf.DeliverableId,
                @Schedule      = bluf.Schedule,
                @Budget        = bluf.Budget,
                @Scope         = bluf.Scope,
                @Issues        = bluf.Issues,
                @OtherRisks    = bluf.OtherRisks,
                @Date          = bluf.Date
            }
                                       );
        }
コード例 #3
0
 public void Post(Bluf bluf)
 {
     // NB. it's a post because we don't overide the data, we simply add another line
     _blufs.PostBluf(bluf);
 }