Profiles.Edit.Utilities.DataIO.AddUpdateFunding C# (CSharp) Méthode

AddUpdateFunding() public méthode

public AddUpdateFunding ( FundingState fs ) : void
fs FundingState
Résultat void
        public void AddUpdateFunding(FundingState fs)
        {
            if (!fs.hasData) return;
            string connstr = this.GetConnectionString();
            SqlConnection dbconnection = new SqlConnection(connstr);

            System.Text.StringBuilder sbSQL = new StringBuilder();

            SqlParameter[] param = new SqlParameter[13];

            if (fs.StartDate == "?")
                fs.StartDate = string.Empty;

            if (fs.EndDate == "?")
                fs.EndDate = string.Empty;

            try
            {
                dbconnection.Open();
                param[0] = new SqlParameter("@FundingRoleID", fs.FundingRoleID);
                param[1] = new SqlParameter("@PersonID", fs.PersonID);
                param[2] = new SqlParameter("@FundingID", fs.FullFundingID); //this will use the full funding id but can be loaded with the core or fill depending on if its a sub grant or not.
                param[3] = new SqlParameter("@FundingID2", fs.CoreProjectNum); //This will always be the core number
                param[4] = new SqlParameter("@RoleLabel", fs.RoleLabel);
                param[5] = new SqlParameter("@RoleDescription", fs.RoleDescription);
                param[6] = new SqlParameter("@AgreementLabel", fs.AgreementLabel);
                param[7] = new SqlParameter("@GrantAwardedBy", fs.GrantAwardedBy);
                param[8] = new SqlParameter("@StartDate", fs.StartDate == "?" ? "" : fs.StartDate);
                param[9] = new SqlParameter("@EndDate", fs.EndDate == "?" ? "" : fs.EndDate);
                param[10] = new SqlParameter("@PrincipalInvestigatorName", fs.PrincipalInvestigatorName);
                param[11] = new SqlParameter("@Abstract", fs.Abstract);
                param[12] = new SqlParameter("@Source", fs.Source);

                //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value.
                ExecuteSQLDataCommand(GetDBCommand(dbconnection, "[Profile.Data].[Funding.AddUpdateFunding]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param));

                dbconnection.Close();

                EditActivityLog(fs.SubjectID, "http://vivoweb.org/ontology/core#ResearcherRole", (string) null, fs.FundingRoleID.ToString(), (string) null);

            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }
        }