/// <summary> /// Updates the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Update(Sample entity) { var sample = entity; Debug.Assert(sample != null, "sample != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaSampleUpdatebyId", connection)) { var sqlParams = new List <SqlParameter>(); SqlHelper.AddReturnPara("@return_value", sqlParams); if (sample.Id > 0) { SqlHelper.AddIntPara(sample.Id, "@Id", sqlParams); } SqlHelper.AddVarcharPara(sample.UpdatedBy, "@UpdatedBy", sqlParams); SqlHelper.AddBitPara(sample.Selected, "@Selected", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); } } }
/// <summary> /// Adds the specified Project. /// </summary> /// <param name="entity">The entity.</param> public void Add(Project entity) { var project = entity; Debug.Assert(project != null, "project != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaProjectInsert", connection)) { var sqlParams = new List <SqlParameter>(); SqlHelper.AddReturnPara("@return_value", sqlParams); if (project.ProjectId > 0) { SqlHelper.AddIntPara(project.ProjectId, "@ProjectId", sqlParams); } SqlHelper.AddVarcharPara(project.ProjectType, "@ProjectType", sqlParams); SqlHelper.AddVarcharPara(project.OrgCode, "@OrgCode", sqlParams); SqlHelper.AddVarcharPara(project.ProjectName, "@ProjectName", sqlParams); SqlHelper.AddVarcharPara(project.Coordinator, "@Coordinator", sqlParams); SqlHelper.AddVarcharPara(project.Comments, "@Comments", sqlParams); SqlHelper.AddDatePara(DateTime.Now, "@CreatedOn", sqlParams); SqlHelper.AddVarcharPara(project.CreatedBy, "@CreatedBy", sqlParams); SqlHelper.AddBitPara(project.Resource_NO, "@Resource_NO", sqlParams); SqlHelper.AddBitPara(project.Resource_NSW_ACT, "@Resource_NSW_ACT", sqlParams); SqlHelper.AddBitPara(project.Resource_QLD, "@Resource_QLD", sqlParams); SqlHelper.AddBitPara(project.Resource_NT, "@Resource_NT", sqlParams); SqlHelper.AddBitPara(project.Resource_WA, "@Resource_WA", sqlParams); SqlHelper.AddBitPara(project.Resource_SA, "@Resource_SA", sqlParams); SqlHelper.AddBitPara(project.Resource_TAS, "@Resource_TAS", sqlParams); SqlHelper.AddBitPara(project.Resource_VIC, "@Resource_VIC", sqlParams); // Output parameters var paramId = new SqlParameter("@ProjectId", SqlDbType.Int) { Direction = ParameterDirection.InputOutput, Value = 0 }; sqlParams.Add(paramId); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); if (((Int32)command.Parameters["@return_value"].Value) != 0) { return; } project.ProjectId = (int)paramId.Value; } } }
/// <summary> /// Updates the specified upload object. /// </summary> /// <param name="entity">The upload.</param> public void Update(Upload entity) { var upload = entity; Debug.Assert(upload != null, "upload != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaUploadUpdate", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); SqlHelper.AddIntPara(upload.UploadId, "@Id", sqlParams); SqlHelper.AddIntPara(upload.ProjectId, "@ProjectId", sqlParams); SqlHelper.AddDatePara(upload.DateUploaded, "@DateUploaded", sqlParams); SqlHelper.AddVarcharPara(upload.SourceFile, "@SourceFile", sqlParams); SqlHelper.AddIntPara(upload.Rows, "@Rows", sqlParams); SqlHelper.AddVarcharPara(upload.Status, "@Status", sqlParams); SqlHelper.AddVarcharPara(upload.Name, "@Name", sqlParams); SqlHelper.AddVarcharPara(upload.UploadedBy, "@UploadedBy", sqlParams); SqlHelper.AddBitPara(upload.IncludesOutcomes, "@IncludesOutcomes", sqlParams); SqlHelper.AddBitPara(upload.AdditionalReview, "@AdditionalReview", sqlParams); SqlHelper.AddBitPara(upload.InScope, "@InScope", sqlParams); SqlHelper.AddBitPara(upload.AcceptedFlag, "@AcceptedFlag", sqlParams); SqlHelper.AddBitPara(upload.RandomFlag, "@RandomFlag", sqlParams); SqlHelper.AddBitPara(upload.NationalFlag, "@NationalFlag", sqlParams); SqlHelper.AddVarcharPara(upload.ServerFile, "@ServerFile", sqlParams); SqlHelper.AddNullableDateParameter(upload.DueDate, "@DueDate", sqlParams); SqlHelper.AddVarcharPara(upload.UpdatedBy, "@UpdatedBy", sqlParams); SqlHelper.AddDatePara(DateTime.Now, "@UpdatedOn", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); } } }
/// <summary> /// Updates the Control record /// </summary> /// <param name="entity">The entity.</param> public void Update(PatControl entity) { var patControl = entity; Debug.Assert(patControl != null, "control != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaControlUpdate", connection)) { var sqlParams = new List <SqlParameter>(); SqlHelper.AddReturnPara("@return_value", sqlParams); if (patControl.ControlId > 0) { SqlHelper.AddIntPara(patControl.ControlId, "@Id", sqlParams); } SqlHelper.AddIntPara(patControl.ProjectCount, "@ProjectCount", sqlParams); SqlHelper.AddIntPara(patControl.SampleCount, "@SampleCount", sqlParams); SqlHelper.AddIntPara(patControl.ReviewCount, "@ReviewCount", sqlParams); SqlHelper.AddDecimalPara(patControl.ProjectCompletion, 3, "@ProjectCompletion", sqlParams); SqlHelper.AddDecimalPara(patControl.TotalComplianceIndicator, 3, "@TotalComplianceIndicator", sqlParams); SqlHelper.AddBitPara(patControl.SystemAvailable, "@SystemAvailable", sqlParams); if (patControl.LastBatchRun != new DateTime(1, 1, 1)) { SqlHelper.AddDatePara(patControl.LastBatchRun, "@LastBatchRun", sqlParams); } if (patControl.LastComplianceRun != new DateTime(1, 1, 1)) { SqlHelper.AddDatePara(patControl.LastComplianceRun, "@LastComplianceRun", sqlParams); } SqlHelper.AddVarcharPara(patControl.UpdatedBy, "@UpdatedBy", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); } } }
/// <summary> /// Updates the specified Project. /// </summary> /// <param name="entity">The entity.</param> public void Update(Project entity) { var project = entity; Debug.Assert(project != null, "project != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaProjectUpdate", connection)) { var sqlParams = new List <SqlParameter>(); SqlHelper.AddReturnPara("@return_value", sqlParams); if (project.ProjectId > 0) { SqlHelper.AddIntPara(project.ProjectId, "@ProjectId", sqlParams); } SqlHelper.AddVarcharPara(project.ProjectType, "@ProjectType", sqlParams); SqlHelper.AddVarcharPara(project.ProjectName, "@ProjectName", sqlParams); SqlHelper.AddVarcharPara(project.OrgCode, "@OrgCode", sqlParams); SqlHelper.AddVarcharPara(project.Coordinator, "@Coordinator", sqlParams); SqlHelper.AddVarcharPara(project.Comments, "@Comments", sqlParams); SqlHelper.AddBitPara(project.Resource_NO, "@Resource_NO", sqlParams); SqlHelper.AddBitPara(project.Resource_NSW_ACT, "@Resource_NSW_ACT", sqlParams); SqlHelper.AddBitPara(project.Resource_QLD, "@Resource_QLD", sqlParams); SqlHelper.AddBitPara(project.Resource_NT, "@Resource_NT", sqlParams); SqlHelper.AddBitPara(project.Resource_WA, "@Resource_WA", sqlParams); SqlHelper.AddBitPara(project.Resource_SA, "@Resource_SA", sqlParams); SqlHelper.AddBitPara(project.Resource_TAS, "@Resource_TAS", sqlParams); SqlHelper.AddBitPara(project.Resource_VIC, "@Resource_VIC", sqlParams); SqlHelper.AddVarcharPara(project.UpdatedBy, "@UpdatedBy", sqlParams); SqlHelper.AddDatePara(DateTime.Now, "@UpdatedOn", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); } } }
/// <summary> /// Gets all by upload identifier. /// </summary> /// <param name="uploadId">The upload identifier.</param> /// <param name="gridSettings">The grid settings.</param> /// <param name="projectStatus">The project status.</param> /// <returns></returns> public List <Review> GetAllByUploadId(int uploadId, Models.GridSettings gridSettings, string projectStatus) { if (string.IsNullOrEmpty(gridSettings.SortColumn)) { gridSettings.SortColumn = "ReviewId"; } const string sprocName = "PaReviewsGetAllByUpload"; var reviewList = new List <Review>(); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand(sprocName, connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); SqlHelper.AddIntPara(uploadId, "@UploadId", sqlParams); SqlHelper.AddVarcharPara(gridSettings.SortColumn, "@sortColumnName", sqlParams); SqlHelper.AddVarcharPara(gridSettings.SortOrder, "@sortOrder", sqlParams); if (gridSettings.PageSize > 0) { SqlHelper.AddIntPara(gridSettings.PageSize, "@pageSize", sqlParams); } if (gridSettings.PageIndex > 0) { SqlHelper.AddIntPara(gridSettings.PageIndex, "@pageIndex", sqlParams); } if (gridSettings.IsSearch && gridSettings.Where != null) { foreach (var rule in gridSettings.Where.rules) { if (!rule.field.Equals("ReviewStatus")) { // convert rule into a parameter if (rule.field.IndexOf("Date", StringComparison.Ordinal) > -1) { SqlHelper.AddDatePara(DateTime.Parse(rule.data), "@" + rule.field, sqlParams); } else { if ((rule.field.IndexOf("Id", StringComparison.Ordinal) > -1) || (rule.field.IndexOf("Number", StringComparison.Ordinal) > -1)) { SqlHelper.AddBigIntPara(Int64.Parse(rule.data), "@" + rule.field, sqlParams); } else { switch (rule.field) { case "ReferredToFraud": case "IsAdditionalReview": case "IsOutOfScope": SqlHelper.AddBitPara(ConvertStringToBool(rule.data), "@" + rule.field, sqlParams); break; default: SqlHelper.AddVarcharPara(rule.data, "@" + rule.field, sqlParams); if (!rule.field.Equals("AssignedTo")) { var opValue = rule.op.Equals("eq") ? 1 : 0; SqlHelper.AddIntPara(opValue, "@" + rule.field + "Op", sqlParams); } break; } // add the Op parameter } } } } } command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); LoadList(reviewList, command, sprocName); } } return(reviewList); }
/// <summary> /// Updates the specified review. /// </summary> /// <param name="entity">The entity.</param> public void Update(Review entity) { var review = entity; Debug.Assert(review != null, "review != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaReviewUpdate", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); SqlHelper.AddIntPara(review.ReviewId, "@ReviewId", sqlParams); SqlHelper.AddIntPara(review.ProjectId, "@ProjectId", sqlParams); SqlHelper.AddIntPara(review.UploadId, "@UploadId", sqlParams); SqlHelper.AddIntPara(review.ClaimSequenceNumber, "@ClaimSequenceNumber", sqlParams); SqlHelper.AddNullableBigIntPara(review.JobseekerId, "@JobseekerId", sqlParams); SqlHelper.AddNullableBigIntPara(review.ClaimId, "@ClaimId", sqlParams); SqlHelper.AddNullableBigIntPara(review.ActivityId, "@ActivityId", sqlParams); SqlHelper.AddVarcharPara(review.SiteCode, "@SiteCode", sqlParams); SqlHelper.AddVarcharPara(review.SiteName, "@SiteName", sqlParams); SqlHelper.AddVarcharPara(review.OrgName, "@OrgName", sqlParams); SqlHelper.AddVarcharPara(review.OrgCode, "@OrgCode", sqlParams); SqlHelper.AddVarcharPara(review.ESACode, "@ESACode", sqlParams); SqlHelper.AddVarcharPara(review.StateCode, "@StateCode", sqlParams); SqlHelper.AddVarcharPara(review.ManagedBy, "@ManagedBy", sqlParams); SqlHelper.AddNullableVarcharPara(review.OutcomeCode, "@OutcomeCode", sqlParams); SqlHelper.AddNullableVarcharPara(review.AssessmentCode, "@AssessmentCode", sqlParams); SqlHelper.AddNullableVarcharPara(review.RecoveryReason, "@RecoveryReason", sqlParams); SqlHelper.AddNullableVarcharPara(review.AssessmentAction, "@AssessmentAction", sqlParams); SqlHelper.AddVarcharPara(review.JobSeekerGivenName, "@JobSeekerGivenName", sqlParams); SqlHelper.AddVarcharPara(review.JobSeekerSurname, "@JobSeekerSurname", sqlParams); SqlHelper.AddVarcharPara(review.ClaimType, "@ClaimType", sqlParams); SqlHelper.AddVarcharPara(review.Comments, "@Comments", sqlParams); SqlHelper.AddBitPara(review.IsAdditionalReview, "@IsAdditionalReview", sqlParams); SqlHelper.AddBitPara(review.IsOutOfScope, "@IsOutOfScope", sqlParams); SqlHelper.AddBitPara(review.AutoSpecialClaim, "@AutoSpecialClaim", sqlParams); SqlHelper.AddBitPara(review.ManualSpecialClaim, "@ManualSpecialClaim", sqlParams); SqlHelper.AddMoneyPara(review.ClaimAmount, "@ClaimAmount", sqlParams); SqlHelper.AddMoneyPara(review.ClaimRecoveryAmount, "@ClaimRecoveryAmount", sqlParams); SqlHelper.AddNullableDateParameter(review.AssessmentDate, "@AssessmentDate", sqlParams); SqlHelper.AddNullableDateParameter(review.AssessmentActionDate, "@AssessmentActionDate", sqlParams); SqlHelper.AddNullableDateParameter(review.RecoveryReasonDate, "@RecoveryReasonDate", sqlParams); SqlHelper.AddNullableDateParameter(review.FinalOutcomeDate, "@FinalOutcomeDate", sqlParams); SqlHelper.AddNullableDateParameter(review.ClaimCreationDate, "@ClaimCreationDate", sqlParams); SqlHelper.AddVarcharPara(review.UpdatedBy, "@UpdatedBy", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); } } }
/// <summary> /// Adds the specified review. /// </summary> /// <param name="review">The review.</param> /// <returns> /// id of the new review /// </returns> public int Add(Review review) { var reviewId = review.ReviewId; if (reviewId == 0) { using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaReviewInsert", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); var paramId = new SqlParameter("@ReviewId", SqlDbType.Int) { Direction = ParameterDirection.InputOutput, Value = 0 }; sqlParams.Add(paramId); SqlHelper.AddIntPara(review.ProjectId, "@ProjectId", sqlParams); SqlHelper.AddIntPara(review.UploadId, "@UploadId", sqlParams); SqlHelper.AddIntPara(review.ClaimSequenceNumber, "@ClaimSequenceNumber", sqlParams); SqlHelper.AddNullableBigIntPara(review.JobseekerId, "@JobseekerId", sqlParams); SqlHelper.AddNullableBigIntPara(review.ClaimId, "@ClaimId", sqlParams); SqlHelper.AddNullableBigIntPara(review.ActivityId, "@ActivityId", sqlParams); SqlHelper.AddVarcharPara(review.JobSeekerGivenName, "@JobSeekerGivenName", sqlParams); SqlHelper.AddVarcharPara(review.JobSeekerSurname, "@JobSeekerSurname", sqlParams); SqlHelper.AddVarcharPara(review.SiteCode, "@SiteCode", sqlParams); SqlHelper.AddVarcharPara(review.SiteName, "@SiteName", sqlParams); SqlHelper.AddVarcharPara(review.OrgName, "@OrgName", sqlParams); SqlHelper.AddVarcharPara(review.OrgCode, "@OrgCode", sqlParams); SqlHelper.AddVarcharPara(review.ESACode, "@ESACode", sqlParams); SqlHelper.AddVarcharPara(review.StateCode, "@StateCode", sqlParams); SqlHelper.AddVarcharPara(review.ManagedBy, "@ManagedBy", sqlParams); SqlHelper.AddVarcharPara(review.ContractType, "@ContractType", sqlParams); SqlHelper.AddVarcharPara(review.ClaimType, "@ClaimType", sqlParams); SqlHelper.AddVarcharPara(review.Comments, "@Comments", sqlParams); SqlHelper.AddVarcharPara(review.AssessmentCode, "@AssessmentCode", sqlParams); SqlHelper.AddVarcharPara(review.RecoveryReason, "@RecoveryReason", sqlParams); SqlHelper.AddVarcharPara(review.AssessmentAction, "@AssessmentAction", sqlParams); SqlHelper.AddVarcharPara(review.OutcomeCode, "@OutcomeCode", sqlParams); SqlHelper.AddBitPara(review.IsAdditionalReview, "@IsAdditionalReview", sqlParams); SqlHelper.AddBitPara(review.IsOutOfScope, "@IsOutOfScope", sqlParams); SqlHelper.AddBitPara(review.AutoSpecialClaim, "@AutoSpecialClaim", sqlParams); SqlHelper.AddBitPara(review.ManualSpecialClaim, "@ManualSpecialClaim", sqlParams); SqlHelper.AddNullableDateParameter(review.ClaimCreationDate, "@ClaimCreationDate", sqlParams); SqlHelper.AddMoneyPara(review.ClaimAmount, "@ClaimAmount", sqlParams); SqlHelper.AddMoneyPara(review.ClaimRecoveryAmount, "@ClaimRecoveryAmount", sqlParams); SqlHelper.AddVarcharPara(review.CreatedBy, "@CreatedBy", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); if (((Int32)command.Parameters["@return_value"].Value) == 0) { reviewId = (int)paramId.Value; } } } } return(reviewId); }
/// <summary> /// To get all bulletin data based on its type and admin privilage and grid setting /// </summary> /// <param name="gridSettings">The grid settings.</param> /// <param name="bulletinType">Type of the bulletin.</param> /// <param name="isAdmin">if set to <c>true</c> [is admin].</param> /// <returns> /// a list of bulletin /// </returns> public List <Bulletin> GetAll(MvcJqGrid.GridSettings gridSettings, string bulletinType, bool isAdmin) { if (string.IsNullOrEmpty(gridSettings.SortColumn)) { gridSettings.SortColumn = "EndDate"; gridSettings.SortOrder = DataConstants.Descending; } if (string.IsNullOrEmpty(gridSettings.SortOrder)) { gridSettings.SortOrder = DataConstants.Descending; } var bulletinList = new List <Bulletin>(); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaBulletinGetAll", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); SqlHelper.AddVarcharPara(gridSettings.SortColumn, "@sortColumnName", sqlParams); SqlHelper.AddVarcharPara(gridSettings.SortOrder, "@sortOrder", sqlParams); SqlHelper.AddIntPara(gridSettings.PageIndex, "@pageIndex", sqlParams); SqlHelper.AddIntPara(gridSettings.PageSize, "@pageSize", sqlParams); SqlHelper.AddVarcharPara(bulletinType, "@bulletinType ", sqlParams); SqlHelper.AddBitPara(isAdmin, "@isAdmin", sqlParams); if (gridSettings.IsSearch && gridSettings.Where != null) { foreach (var rule in gridSettings.Where.rules) { // convert rule into a parameter if (rule.field.IndexOf("Date", StringComparison.Ordinal) > -1) { DateTime theDate; var isValid = AppHelper.ToDbDateTime(rule.data, out theDate); if (isValid) { SqlHelper.AddDatePara(theDate, "@" + rule.field, sqlParams); } else { return(bulletinList); } } else { SqlHelper.AddVarcharPara(rule.data, "@" + rule.field, sqlParams); } } } command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); LoadBulletinList(bulletinList, command); } } return(bulletinList); }
public void Add(Upload upload) { Debug.Assert(upload != null, "upload != null"); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaUploadInsert", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); //also get the Id back var paramUploadId = new SqlParameter("@UploadId", SqlDbType.Int) { Direction = ParameterDirection.InputOutput, Value = 0 }; sqlParams.Add(paramUploadId); SqlHelper.AddIntPara(upload.ProjectId, "@ProjectId", sqlParams); SqlHelper.AddDatePara(upload.DateUploaded, "@DateUploaded", sqlParams); SqlHelper.AddVarcharPara(upload.SourceFile, "@SourceFile", sqlParams); SqlHelper.AddVarcharPara(upload.Name, "@Name", sqlParams); SqlHelper.AddVarcharPara(upload.UploadedBy, "@UploadedBy", sqlParams); SqlHelper.AddBitPara(upload.IncludesOutcomes, "@IncludesOutcomes", sqlParams); SqlHelper.AddBitPara(upload.AdditionalReview, "@AdditionalReview", sqlParams); SqlHelper.AddBitPara(upload.InScope, "@InScope", sqlParams); SqlHelper.AddBitPara(upload.AcceptedFlag, "@AcceptedFlag", sqlParams); SqlHelper.AddBitPara(upload.RandomFlag, "@RandomFlag", sqlParams); SqlHelper.AddBitPara(upload.NationalFlag, "@NationalFlag", sqlParams); SqlHelper.AddNullableDateParameter(upload.DueDate, "@DueDate", sqlParams); SqlHelper.AddVarcharPara(upload.ServerFile, "@ServerFile", sqlParams); SqlHelper.AddVarcharPara(upload.CreatedBy, "@CreatedBy", sqlParams); SqlHelper.AddVarcharPara(upload.UpdatedBy, "@UpdatedBy", sqlParams); SqlHelper.AddDatePara(upload.CreatedOn, "@CreatedOn", sqlParams); SqlHelper.AddDatePara(upload.UpdatedOn, "@UpdatedOn", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); command.ExecuteNonQuery(); if (((Int32)command.Parameters["@return_value"].Value) != 0) { return; } upload.UploadId = (int)paramUploadId.Value; } } }