Beispiel #1
0
 public bool DeleteFunding(FundingObject funding)
 {
     try
     {
         Config.Conn.Execute("DELETE FROM dat_Funding WHERE FundingId = @FundingId", funding);
     }
     catch { return(false); }
     return(true);
 }
Beispiel #2
0
 public FundingData(FundingObject fo)
 {
     Year                    = fo.Year;
     FundingTypeId           = fo.FundingTypeId;
     Org                     = fo.Org;
     ContractNumber          = fo.ContractNumber;
     Percent                 = fo.Percent;
     DoeFundingCategoryId    = fo.DoeFundingCategoryId;
     GrantNumber             = fo.GrantNumber;
     TrackingNumber          = fo.TrackingNumber;
     SppCategoryId           = fo.SppCategoryId;
     SppApproved             = fo.SppApproved;
     FederalAgencyId         = fo.FederalAgencyId;
     ApproveNoReason         = fo.ApproveNoReason;
     OtherDescription        = fo.OtherDescription;
     CountryId               = fo.CountryId;
     AdditionalInfo          = fo.AdditionalInfo;
     ProjectArea             = fo.ProjectArea;
     ProjectNumber           = fo.ProjectNumber;
     PrincipalInvEmployeeId  = fo.PrincipalInvEmployeeId;
     MilestoneTrackingNumber = fo.MilestoneTrackingNumber;
 }
Beispiel #3
0
 public FundingObject SaveFunding(FundingObject funding)
 {
     if (funding.FundingId > 0) // Update
     {
         string sql = @"
             UPDATE  dat_Funding
             SET     Year = @Year,
                     FundingTypeId = @FundingTypeId,
                     Org = @Org,
                     ContractNumber = @ContractNumber,
                     [Percent] = @Percent,
                     DoeFundingCategoryId = @DoeFundingCategoryId,
                     GrantNumber = @GrantNumber,
                     TrackingNumber = @TrackingNumber,
                     SppCategoryId = @SppCategoryId,
                     SppApproved = @SppApproved,
                     FederalAgencyId = @FederalAgencyId,
                     ApproveNoReason = @ApproveNoReason,
                     OtherDescription = @OtherDescription,
                     CountryId = @CountryId,
                     AdditionalInfo = @AdditionalInfo,
                     ProjectArea = @ProjectArea,
                     ProjectNumber = @ProjectNumber,
                     PrincipalInvEmployeeId = @PrincipalInvEmployeeId,
                     MilestoneTrackingNumber = @MilestoneTrackingNumber
             WHERE   FundingId = @FundingId";
         Config.Conn.Execute(sql, funding);
     }
     else
     {
         string sql = @"
             INSERT INTO dat_Funding (
                 MainId,
                 Year,
                 FundingTypeId,
                 Org,
                 ContractNumber,
                 [Percent],
                 DoeFundingCategoryId,
                 GrantNumber,
                 TrackingNumber,
                 SppCategoryId,
                 SppApproved,
                 FederalAgencyId,
                 ApproveNoReason,
                 OtherDescription,
                 CountryId,
                 AdditionalInfo,
                 ProjectArea,
                 ProjectNumber,
                 PrincipalInvEmployeeId,
                 MilestoneTrackingNumber
             )
             VALUES (
                 @MainId,
                 @Year,
                 @FundingTypeId,
                 @Org,
                 @ContractNumber,
                 @Percent,
                 @DoeFundingCategoryId,
                 @GrantNumber,
                 @TrackingNumber,
                 @SppCategoryId,
                 @SppApproved,
                 @FederalAgencyId,
                 @ApproveNoReason,
                 @OtherDescription,
                 @CountryId,
                 @AdditionalInfo,
                 @ProjectArea,
                 @ProjectNumber,
                 @PrincipalInvEmployeeId,
                 @MilestoneTrackingNumber
             )
             SELECT CAST(SCOPE_IDENTITY() AS INT)";
         funding.FundingId = Config.Conn.Query <int>(sql, funding).Single();
     }
     return(funding);
 }