public bool InsertandReturnID(ref int JobId) { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); // Pass the value of '_importJobID' as parameter 'ImportJobID' of the stored procedure. oDatabaseHelper.AddParameter("@ImportJobID", ImportJobID); // Pass the value of '_staus' as parameter 'Staus' of the stored procedure. oDatabaseHelper.AddParameter("@Staus", Staus); // Pass the value of '_statusMessage' as parameter 'StatusMessage' of the stored procedure. oDatabaseHelper.AddParameter("@StatusMessage", StatusMessage); // Pass the value of '_updatedCount' as parameter 'UpdatedCount' of the stored procedure. oDatabaseHelper.AddParameter("@UpdatedCount", UpdatedCount); // Pass the value of '_insertedCount' as parameter 'InsertedCount' of the stored procedure. oDatabaseHelper.AddParameter("@InsertedCount", InsertedCount); // Pass the value of '_duplicateCount' as parameter 'DuplicateCount' of the stored procedure. oDatabaseHelper.AddParameter("@DuplicateCount", DuplicateCount); // Pass the value of '_invalidCount' as parameter 'InvalidCount' of the stored procedure. oDatabaseHelper.AddParameter("@InvalidCount", InvalidCount); // Pass the value of '_startTime' as parameter 'StartTime' of the stored procedure. oDatabaseHelper.AddParameter("@StartTime", StartTime); // Pass the value of '_endTime' as parameter 'EndTime' of the stored procedure. oDatabaseHelper.AddParameter("@EndTime", EndTime); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.AddParameter("@Id", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_ImportHistory_Insert_ReturnId", ref ExecutionState); JobId = Convert.ToInt32(oDatabaseHelper.GetParameterValue("@Id")); oDatabaseHelper.Dispose(); return ExecutionState; }
//prashanth //Insertion of Links and returning the PK after insertion. public int InsertandReturnPrimaryKey() { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); // Pass the value of '_linkURL' as parameter 'LinkURL' of the stored procedure. oDatabaseHelper.AddParameter("@LinkURL", this.LinkURL); // Pass the value of '_linkName' as parameter 'LinkName' of the stored procedure. oDatabaseHelper.AddParameter("@LinkName", this.LinkName); // Pass the value of '_recordClicks' as parameter 'RecordClicks' of the stored procedure. oDatabaseHelper.AddParameter("@RecordClicks", this.RecordClicks); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); // The parameter '@LinkDetailID' will contain the LinkDetailID after execution of the stored procedure. oDatabaseHelper.AddParameter("@LinkDetailID", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_LinkDetails_InsertandReturnPrimarykey", ref ExecutionState);//ExecuteNonQuery("sp_ContactMaster_InsertandReturnPrimarykey", ref ExecutionState); int intLinkDetailID = (int)oDatabaseHelper.GetParameterValue("@LinkDetailID"); oDatabaseHelper.Dispose(); return intLinkDetailID; }
public void insertCustomLabel(CustomLabel objCustomLabel) { try { using (DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString)) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@CampaignId", objCustomLabel.CampaignId); oDatabaseHelper.AddParameter("@TemplateId", objCustomLabel.TemplateId); oDatabaseHelper.AddParameter("@LinkURL", objCustomLabel.LinkURL); oDatabaseHelper.AddParameter("@CustomLabel", objCustomLabel.CustomLabel); oDatabaseHelper.ExecuteScalar("sp_CustomLabel", ref ExecutionState); int CampaignID = (int)oDatabaseHelper.GetParameterValue("@CampaignID"); oDatabaseHelper.Dispose(); } } catch (Exception ex) { throw ex; } }
//Ganesh on 30nov09 //This method will insert a new job in CampaignMaster table. public int insertCampainMaster(CampaignMaster objCampaignMaster) { try { using (DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString)) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@CampaignName", objCampaignMaster.CampaignName); oDatabaseHelper.AddParameter("@CampaignDescription", objCampaignMaster.CampaignDescription); oDatabaseHelper.AddParameter("@FromAddress", objCampaignMaster.FromAddress); oDatabaseHelper.AddParameter("@FromName", objCampaignMaster.FromName); oDatabaseHelper.AddParameter("@ReplytoAddress", objCampaignMaster.ReplytoAddress); oDatabaseHelper.AddParameter("@ReplaytoName", objCampaignMaster.ReplaytoName); oDatabaseHelper.AddParameter("@TemplateId", objCampaignMaster.TemplateId); oDatabaseHelper.AddParameter("@Subject", objCampaignMaster.Subject); oDatabaseHelper.AddParameter("@TrackReads", objCampaignMaster.TrackReads); oDatabaseHelper.AddParameter("@SelectCondition", objCampaignMaster.SelectCondition); oDatabaseHelper.AddParameter("@HTMLContent", objCampaignMaster.HTMLContent); oDatabaseHelper.AddParameter("@TextContent", objCampaignMaster.TextContent); oDatabaseHelper.AddParameter("@SuppressDomain", objCampaignMaster.SuppressDomain); oDatabaseHelper.AddParameter("@UnsubscribeText", objCampaignMaster.UnsubscribeText); oDatabaseHelper.AddParameter("@UnsubscribeLinkText", objCampaignMaster.UnsubscribeLinkText); oDatabaseHelper.AddParameter("@SuppressLists", objCampaignMaster.SuppressSelection); oDatabaseHelper.AddParameter("@AssignedCampaignID", objCampaignMaster.AssignedCampaignID); oDatabaseHelper.AddParameter("@CampaignID", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_CampaignMaster_Insert_CustomProc", ref ExecutionState); int CampaignID = (int)oDatabaseHelper.GetParameterValue("@CampaignID"); oDatabaseHelper.Dispose(); return CampaignID; } } catch (Exception ex) { throw ex; } }
//Ganesh on 19nov09 //This method will insert a new job in ImportJob table. public int InsertImportJob(string fileName, string fileDelimiterType, string fileContent, bool sendNotification, string listIDs, string notificationEmailIDs, string status, string guidFilename, bool isFileHasHeader) { try { using (DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString)) { bool ExecutionState = false; oDatabaseHelper.AddParameter("@Filename", fileName); oDatabaseHelper.AddParameter("@Filetype", fileDelimiterType); oDatabaseHelper.AddParameter("@FileContent", fileContent); oDatabaseHelper.AddParameter("@Notification", sendNotification); oDatabaseHelper.AddParameter("@ListID", listIDs); oDatabaseHelper.AddParameter("@NotificationEmailIDs", notificationEmailIDs); oDatabaseHelper.AddParameter("@Status", status); oDatabaseHelper.AddParameter("@GuidFilename", guidFilename); oDatabaseHelper.AddParameter("@IsFileHasHeader", isFileHasHeader); oDatabaseHelper.AddParameter("@ImportJobID", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_ImportJob_Insert_CustomProc", ref ExecutionState); int importJobID = (int)oDatabaseHelper.GetParameterValue("@ImportJobID"); oDatabaseHelper.Dispose(); return importJobID; } } catch (Exception ex) { throw ex; } }
//prashanth //Insertion of contacts and returning the PK after insertion. public int InsertandReturnPrimaryKey() { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(); // Pass the value of '_clientId' as parameter 'ClientId' of the stored procedure. oDatabaseHelper.AddParameter("@ClientId", this.ClientId); // Pass the value of '_emailAddress' as parameter 'EmailAddress' of the stored procedure. oDatabaseHelper.AddParameter("@EmailAddress", this.EmailAddress); // Pass the value of '_firstName' as parameter 'FirstName' of the stored procedure. oDatabaseHelper.AddParameter("@FirstName", this.FirstName); // Pass the value of '_lastName' as parameter 'LastName' of the stored procedure. oDatabaseHelper.AddParameter("@LastName", this.LastName); // Pass the value of '_address1' as parameter 'Address1' of the stored procedure. oDatabaseHelper.AddParameter("@Address1", this.Address1); // Pass the value of '_address3' as parameter 'Address3' of the stored procedure. oDatabaseHelper.AddParameter("@Address2", this.Address2); // Pass the value of '_createdDate' as parameter 'CreatedDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedDate", this.CreatedDate); // Pass the value of '_modifiedDate' as parameter 'ModifiedDate' of the stored procedure. oDatabaseHelper.AddParameter("@ModifiedDate", this.ModifiedDate); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", this.CreatedBy); // Pass the value of '_modifiedBy' as parameter 'ModifiedBy' of the stored procedure. oDatabaseHelper.AddParameter("@ModifiedBy", this.ModifiedBy); // Pass the value of '_active' as parameter 'Active' of the stored procedure. oDatabaseHelper.AddParameter("@IsActive", this.IsActive); // Pass the value of '_makeVerified' as parameter 'MakeVerified' of the stored procedure. oDatabaseHelper.AddParameter("@IsVerified", this.IsVerified); // Pass the value of '_makeVerified' as parameter 'MakeVerified' of the stored procedure. oDatabaseHelper.AddParameter("@IsDeleted", this.IsDeleted); // Pass the value of '_makeVerified' as parameter 'MakeVerified' of the stored procedure. oDatabaseHelper.AddParameter("@IsOptedOut", this.IsOptedOut); // Pass the value of '_newRecptTag' as parameter 'NewRecptTag' of the stored procedure. oDatabaseHelper.AddParameter("@NewRecptTag", this.NewRecptTag); oDatabaseHelper.AddParameter("@SoftBounceCount", this.SoftBounceCount); // Pass the value of '_customField1' as parameter 'CustomField1' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField1", this.CustomField1); // Pass the value of '_customField2' as parameter 'CustomField2' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField2", this.CustomField2); // Pass the value of '_customField3' as parameter 'CustomField3' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField3", this.CustomField3); // Pass the value of '_customField4' as parameter 'CustomField4' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField4", this.CustomField4); // Pass the value of '_customField5' as parameter 'CustomField5' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField5", this.CustomField5); // Pass the value of '_customField6' as parameter 'CustomField6' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField6", this.CustomField6); // Pass the value of '_customField7' as parameter 'CustomField7' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField7", this.CustomField7); // Pass the value of '_customField8' as parameter 'CustomField8' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField8", this.CustomField8); // Pass the value of '_customField9' as parameter 'CustomField9' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField9", this.CustomField9); // Pass the value of '_customField10' as parameter 'CustomField10' of the stored procedure. oDatabaseHelper.AddParameter("@CustomField10", this.CustomField10); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); // The parameter '@ContactID' will contain the contactID after execution of the stored procedure. oDatabaseHelper.AddParameter("@ContactID", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_ContactMaster_InsertandReturnPrimarykey", ref ExecutionState);//ExecuteNonQuery("sp_ContactMaster_InsertandReturnPrimarykey", ref ExecutionState); int intcontactID = (int)oDatabaseHelper.GetParameterValue("@ContactID"); oDatabaseHelper.Dispose(); return intcontactID; }
public int InsertReturnID() { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); // Pass the value of '_templateName' as parameter 'TemplateName' of the stored procedure. oDatabaseHelper.AddParameter("@TemplateName", TemplateName); // Pass the value of '_templateDescription' as parameter 'TemplateDescription' of the stored procedure. oDatabaseHelper.AddParameter("@TemplateDescription", TemplateDescription); // Pass the value of '_clientId' as parameter 'ClientId' of the stored procedure. oDatabaseHelper.AddParameter("@ClientId", ClientId); // Pass the value of '_hTMLContent' as parameter 'HTMLContent' of the stored procedure. oDatabaseHelper.AddParameter("@HTMLContent", HTMLContent); // Pass the value of '_textContent' as parameter 'TextContent' of the stored procedure. oDatabaseHelper.AddParameter("@TextContent", TextContent); // Pass the value of '_modifiedBy' as parameter 'ModifiedBy' of the stored procedure. oDatabaseHelper.AddParameter("@ModifiedBy", ModifiedBy); // Pass the value of '_modifiedDate' as parameter 'ModifiedDate' of the stored procedure. oDatabaseHelper.AddParameter("@ModifiedDate", ModifiedDate); // Pass the value of '_createdDate' as parameter 'CreatedDate' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedDate", CreatedDate); // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure. oDatabaseHelper.AddParameter("@CreatedBy", CreatedBy); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.AddParameter("@Id", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteNonQuery("sp_TemplateMaster_Insert_ReturnId", ref ExecutionState); int id = (int)oDatabaseHelper.GetParameterValue("@Id"); oDatabaseHelper.Dispose(); return id; }
public int Insert(string ConectionString) { bool ExecutionState = false; DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); oDatabaseHelper.AddParameter("@FieldName", _FieldName); oDatabaseHelper.AddParameter("@FieldType", _FieldType); oDatabaseHelper.AddParameter("@DefaultValue", _DefaultValue); oDatabaseHelper.AddParameter("@InputDataType", _InputDataType); oDatabaseHelper.AddParameter("@TextTransformation", _TextTransformation); oDatabaseHelper.AddParameter("@RequiredField", _RequiredField); oDatabaseHelper.AddParameter("@PrimaryField", _PrimaryField); oDatabaseHelper.AddParameter("@PersonalizedField", _PersonalizedField); oDatabaseHelper.AddParameter("@DisplayPosition", _DisplayPosition); oDatabaseHelper.AddParameter("@MaxLength", _MaxLength); oDatabaseHelper.AddParameter("@ContactFieldName", _ContactFieldName); oDatabaseHelper.AddParameter("@Id", -1, System.Data.ParameterDirection.Output); // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); oDatabaseHelper.ExecuteScalar("sp_ManageFields_Insert", ref ExecutionState); oDatabaseHelper.Dispose(); int id = (Int32)oDatabaseHelper.GetParameterValue("@Id"); return id; }