public void update() { try { contactBase.ContactId = Convert.ToInt64(contMasters[0].ContactId); //status = contactBase.AMMFormUpdate(); status = contactBase.Wheelock_Widener_FormsUpdate(); GetValuesOfCustomControls(); //contactID = Convert.ToInt32(contMasters[0].ContactId); statusmessage.Append(string.Format("Contact has been updated successfully")); lbMsg.ForeColor = System.Drawing.Color.Green; lbMsg.Text = statusmessage.ToString(); if (hddIntendedMajor.Value.ToString() == "--Select--") hddIntendedMajor.Value = string.Empty; if (hddSports.Value.ToString() == "--Select--") hddSports.Value = string.Empty; //Get the AssignCampaignId for Mailing CampaignMasterPrimaryKey pk = new CampaignMasterPrimaryKey(Convert.ToInt64(Request.QueryString["CampaignID"].ToString())); CampaignMaster objCampMaster = CampaignMaster.SelectOneWithCampaignJobUsingCampaignMasterID(pk, connectionString); string CampId= objCampMaster.AssignedCampaignID.ToString().Trim(); string WheelockLink = ConfigurationManager.AppSettings["WheelockLink"].ToString(); string RedirectUrl = ConfigurationManager.AppSettings["WheelockSubmitLink"].ToString(); string parameters = "FirstName=" + txtFirstName.Text.ToString().Trim() + "&LastName=" + txtLastName.Text.ToString().Trim() + "&Address1=" + txtAddress1.Text.ToString().Trim() + "&IntendedMajor=" + hddIntendedMajor.Value.ToString().Trim() + "&Sport=" + hddSports.Value.ToString().Trim() + "&Facebook=False&WNews=False&StudentBlogs=False&ScholarshipInfo=False&MajorInfo=False&StudentVideos=False&Email=" + txtEmailAddress.Text + "&InstName=Wheelock" + "&UniqueIdentifier=" + txtFirstName.Text.ToString().Trim() + txtLastName.Text.ToString().Trim() + contactID.ToString().Trim() + "&LetterCode=" + hdLetterCode.Value.ToString().Trim() + "&Rep=" + hdRep.Value.ToString().Trim() + "&EID=" + hdEID.Value.ToString().Trim() + "&PURL=" + purlValue.ToString().Trim(); string qStrValues = "?ContactID=" + Request.QueryString["ContactID"].ToString() + "&CampaignID=" + Request.QueryString["CampaignID"].ToString() + "&CampID=" + CampId.ToString() + "&Username="******"Username"].ToString() + "&direct=no"; string Rstr = RedirectUrl + parameters + "&URL=" + WheelockLink.ToString().Trim() + qStrValues;//CampaignID //Insert formsubmit details in FormSubmitClicks FormSubmitClick objFormSubmitClick = new FormSubmitClick(connectionString); objFormSubmitClick.ContactID =Convert.ToInt64( Request.QueryString["ContactID"].ToString()); objFormSubmitClick.MailingID = Convert.ToInt64(Request.QueryString["CampaignID"].ToString()); objFormSubmitClick.DirectMail = false; objFormSubmitClick.LinkID = 2; objFormSubmitClick.SubmitDate = DateTime.Now; objFormSubmitClick.Insert(); Response.Redirect(Rstr); } catch (Exception ex) { throw ex; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of FormSubmitClicks</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/29/2012 12:32:23 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static FormSubmitClicks PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper, string ConnectionString) { FormSubmitClicks list = new FormSubmitClicks(); if (rdr.Read()) { FormSubmitClick obj = new FormSubmitClick(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new FormSubmitClick(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return list; } else { oDatabaseHelper.Dispose(); return null; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of FormSubmitClicks</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/29/2012 12:32:23 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static FormSubmitClicks PopulateObjectsFromReader(IDataReader rdr, string ConnectionString) { FormSubmitClicks list = new FormSubmitClicks(); while (rdr.Read()) { FormSubmitClick obj = new FormSubmitClick(ConnectionString); PopulateObjectFromReader(obj,rdr); list.Add(obj); } return list; }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="FormSubmitClickPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class FormSubmitClick</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 11/29/2012 12:32:23 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static FormSubmitClick SelectOne(FormSubmitClickPrimaryKey pk,String ConnectionString) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(ConnectionString); bool ExecutionState = false; // Pass the values of all key parameters to the stored procedure. System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues(); foreach (string key in nvc.Keys) { oDatabaseHelper.AddParameter("@" + key,nvc[key] ); } // The parameter '@ErrorCode' will contain the status after execution of the stored procedure. oDatabaseHelper.AddParameter("@ErrorCode", -1, System.Data.ParameterDirection.Output); IDataReader dr=oDatabaseHelper.ExecuteReader("sp_FormSubmitClicks_SelectbyPrimaryKey", ref ExecutionState); if (dr.Read()) { FormSubmitClick obj = new FormSubmitClick(ConnectionString); PopulateObjectFromReader(obj,dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
private void updateContactInDirectMail() { RecipientBase.ContactId = Convert.ToInt64(objRecipientMasters[0].ContactId); status =RecipientBase.Wheelock_Widener_FormsUpdateDirectMail(); //GetValuesOfCustomControls(); //contactID = Convert.ToInt32(contMasters[0].ContactId); statusmessage.Append(string.Format("Contact has been updated successfully")); lbMsg.ForeColor = System.Drawing.Color.Green; lbMsg.Text = statusmessage.ToString(); if (hddIntendedMajor.Value.ToString() == "--Select--") hddIntendedMajor.Value = string.Empty; else hddIntendedMajor.Value = ddlMajor.SelectedValue; if (hddSports.Value.ToString() == "--Select--") hddSports.Value = string.Empty; else hddSports.Value = ddlSports.SelectedValue; if (RecipientBase.LetterCode != null) hdLetterCode.Value = RecipientBase.LetterCode; string WheelockLink = ConfigurationManager.AppSettings["WheelockLink"].ToString(); string RedirectUrl = ConfigurationManager.AppSettings["WheelockSubmitLink"].ToString(); string parameters = "FirstName=" + txtFirstName.Text.ToString().Trim() + "&LastName=" + txtLastName.Text.ToString().Trim() + "&Address1=" + txtAddress1.Text.ToString().Trim() + "&IntendedMajor=" + hddIntendedMajor.Value.ToString().Trim() + "&Sport=" + hddSports.Value.ToString().Trim() + "&Facebook=False&WNews=False&StudentBlogs=False&ScholarshipInfo=False&MajorInfo=False&StudentVideos=False&Email=" + txtEmailAddress.Text + "&InstName=Wheelock" + "&UniqueIdentifier=" + txtFirstName.Text.ToString().Trim() + txtLastName.Text.ToString().Trim() + contactID.ToString().Trim() + "&LetterCode=" + hdLetterCode.Value.ToString().Trim() + "&Rep=" + hdRep.Value.ToString().Trim() + "&EID=" + hdEID.Value.ToString().Trim() + "&PURL=" + purlValue.ToString().Trim(); string CamId = (Request.QueryString["CampID"] != null) ? Request.QueryString["CampID"].ToString() : string.Empty; string mailingId = (Request.QueryString["CampaignID"] != null) ? Request.QueryString["CampaignID"].ToString() : string.Empty; string qStrValues = "?ContactID=" + Request.QueryString["ContactID"].ToString() + "&CampaignID=" + mailingId + "&CampID=" + CamId + "&Username="******"Username"].ToString() + "&direct=yes"; string Rstr = RedirectUrl + parameters + "&URL=" + WheelockLink.ToString().Trim() + qStrValues;//CampaignID FormSubmitClick objFormSubmitClick = new FormSubmitClick(connectionString); objFormSubmitClick.ContactID = Convert.ToInt64(Request.QueryString["ContactID"].ToString()); objFormSubmitClick.DirectMail = true; objFormSubmitClick.MailingID = Convert.ToInt64(Request.QueryString["CampaignID"].ToString()); objFormSubmitClick.LinkID = 2; objFormSubmitClick.SubmitDate = DateTime.Now; objFormSubmitClick.Insert(); Response.Redirect(Rstr); }