protected void Page_Load(object sender, EventArgs e) { Username = User.Identity.Name; Master.ParentModulelbl.Text = "Bounce Settings"; objProfileBase = ProfileBase.Create(Username, true); if (!IsPostBack) { lblMsg.Text = string.Empty; txtHardbounce.Text = objProfileBase.GetPropertyValue("HBounce").ToString(); txtSoftbounce.Text = objProfileBase.GetPropertyValue("SBounce").ToString(); } }
protected void Page_PreInit(object sender, EventArgs e) { System.Web.Profile.ProfileBase perfil = new System.Web.Profile.ProfileBase(); perfil = HttpContext.Current.Profile; Theme = perfil.GetPropertyValue("temaPredeterminado").ToString(); }
protected void Page_Load(object sender, EventArgs e) { Master.ParentModulelbl.Text = "PriceRate Settings"; ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString; try { if (!IsPostBack) { objProfileBase = ProfileBase.Create(User.Identity.Name); txtPrice.Text = objProfileBase.GetPropertyValue("PriceRate").ToString(); txtDiscount.Text = objProfileBase.GetPropertyValue("Discount").ToString(); txtTax.Text = objProfileBase.GetPropertyValue("Tax").ToString(); } } catch (Exception ex) { } }
public static string RenderFullMemberName(string username) { ProfileBase profile = new ProfileBase(); profile.Initialize(username,true); object profilePropertyValue = profile.GetPropertyValue("FullName"); string outputValue = username; if(profilePropertyValue != null) { if(!String.IsNullOrEmpty(profilePropertyValue.ToString())) { outputValue = profilePropertyValue.ToString(); } } return outputValue; }
private void fillUserDetails() { try { //fill user information from membership objMembershipUser = Membership.GetUser(User.Identity.Name); lblUsername.Text = User.Identity.Name; lblEmail.Text = objMembershipUser.Email; lblMsg.Text = string.Empty; if (!User.IsInRole("user")) { //fill user information from profile objProfileBase = ProfileBase.Create(User.Identity.Name, true); lblFirstname.Text = objProfileBase.GetPropertyValue("FName").ToString(); lblLastname.Text = objProfileBase.GetPropertyValue("LName").ToString(); lblPhone.Text = objProfileBase.GetPropertyValue("MobilePhone").ToString(); lblFax.Text = objProfileBase.GetPropertyValue("Fax").ToString(); ttAddress.Text = objProfileBase.GetPropertyValue("Address").ToString(); lbState.Text = objProfileBase.GetPropertyValue("State").ToString(); lblCountry.Text = objProfileBase.GetPropertyValue("Country").ToString(); lblPostalcode.Text = objProfileBase.GetPropertyValue("PostalCode").ToString(); lblHomePhone.Text = objProfileBase.GetPropertyValue("HomePhone").ToString(); lblWorkPhone.Text = objProfileBase.GetPropertyValue("WorkPhone").ToString(); //fill user information from profile in Update div txtUsername.Text = User.Identity.Name; txtEmail.Text = objMembershipUser.Email; txtFirstname.Text = objProfileBase.GetPropertyValue("FName").ToString(); txtLastname.Text = objProfileBase.GetPropertyValue("LName").ToString(); txtMobilePhone.Text = objProfileBase.GetPropertyValue("MobilePhone").ToString(); txtFax.Text = objProfileBase.GetPropertyValue("Fax").ToString(); txtAddress.Text = objProfileBase.GetPropertyValue("Address").ToString(); txtState.Text = objProfileBase.GetPropertyValue("State").ToString(); txtCountry.Text = objProfileBase.GetPropertyValue("Country").ToString(); txtPostalCode.Text = objProfileBase.GetPropertyValue("PostalCode").ToString(); txtHomePhone.Text = objProfileBase.GetPropertyValue("HomePhone").ToString(); txtWorkPhone.Text = objProfileBase.GetPropertyValue("WorkPhone").ToString(); } else { txtUsername.Text = User.Identity.Name; txtEmail.Text = objMembershipUser.Email; //Written by Swaroop Feb 15,2012 UserInfos objUserInfos = UserInfo.SelectByField("UserId", objMembershipUser.ProviderUserKey.ToString(), ConnectionString); if (objUserInfos.Count > 0) { //fill user information from profile lblFirstname.Text = objUserInfos[0].FirstName; lblLastname.Text = objUserInfos[0].LastName; lblPhone.Text = objUserInfos[0].CellPhone; lblFax.Text = objUserInfos[0].Fax; ttAddress.Text = objUserInfos[0].Address1; lbState.Text = objUserInfos[0].State; lblCountry.Text = objUserInfos[0].Country; lblPostalcode.Text = objUserInfos[0].PostalCode; lblHomePhone.Text = objUserInfos[0].HomePhone; lblWorkPhone.Text = objUserInfos[0].WorkPhone; //fill user information from profile in Update div txtUsername.Text = User.Identity.Name; txtEmail.Text = objMembershipUser.Email; txtFirstname.Text = objUserInfos[0].FirstName; txtLastname.Text = objUserInfos[0].LastName; txtMobilePhone.Text = objUserInfos[0].CellPhone; txtFax.Text = objUserInfos[0].Fax; txtAddress.Text = objUserInfos[0].Address1; txtState.Text = objUserInfos[0].State; txtCountry.Text = objUserInfos[0].Country; txtPostalCode.Text = objUserInfos[0].PostalCode; txtHomePhone.Text = objUserInfos[0].HomePhone; txtWorkPhone.Text = objUserInfos[0].WorkPhone; } } } catch (Exception ex) { throw ex; } }
private Contact LoadFromProfile(ProfileBase profile) { Contact contact = new Contact(); if (profile.UserName == null) { contact.Status = false; } else { contact.UserName = profile.UserName; contact.Title = (string)profile.GetPropertyValue("customer_title"); contact.Address1 = (string)profile.GetPropertyValue("customer_address_1"); contact.Address2 = (string)profile.GetPropertyValue("customer_address_2"); contact.Address3 = (string)profile.GetPropertyValue("customer_address_3"); contact.Town = (string)profile.GetPropertyValue("customer_town"); contact.County = (string)profile.GetPropertyValue("customer_county"); contact.Country = (string)profile.GetPropertyValue("customer_country"); if (contact.Country == "United Kingdom") contact.Country = "UK"; if (contact.Country.Length > 5) contact.Country = ""; contact.Postcode = (string)profile.GetPropertyValue("customer_postcode"); contact.FirstName = (string)profile.GetPropertyValue("customer_first_name"); contact.LastName = (string)profile.GetPropertyValue("customer_last_name"); contact.Email = Membership.GetUser(profile.UserName).Email; contact.Mobile = (string)profile.GetPropertyValue("customer_mobile"); contact.Telephone = (string)profile.GetPropertyValue("customer_telephone"); contact.SeparateDeliveryAddress = (profile.GetPropertyValue("customer_separate_delivery_address").ToString() == "1"); contact.DeliveryAddress1 = (string)profile.GetPropertyValue("customer_delivery_address1"); contact.DeliveryAddress2 = (string)profile.GetPropertyValue("customer_delivery_address2"); contact.DeliveryAddress3 = (string)profile.GetPropertyValue("customer_delivery_address3"); contact.DeliveryTown = (string)profile.GetPropertyValue("customer_delivery_town"); contact.DeliveryCounty = (string)profile.GetPropertyValue("customer_delivery_county"); contact.DeliveryPostcode = (string)profile.GetPropertyValue("customer_delivery_postcode"); contact.DeliveryCountry = (string)profile.GetPropertyValue("customer_delivery_country"); if (contact.DeliveryCountry == "United Kingdom") contact.DeliveryCountry = "UK"; if (contact.DeliveryCountry.Length > 5) contact.DeliveryCountry = ""; int externalContactNumber = 0; int.TryParse(profile.GetPropertyValue("care_contact_number").ToString(), out externalContactNumber); int externalAddressNumber = 0; int.TryParse(profile.GetPropertyValue("care_address_number").ToString(), out externalAddressNumber); contact.ExternalContactNumber = externalContactNumber; contact.ExternalAddressNumber = externalAddressNumber; contact.Status = true; //get the contact id //var getMember = Membership.GetUser(contact.UserName); //var m = new umbraco.cms.businesslogic.member.Member((int)getMember.ProviderUserKey); //contact.ContactId = m.Id; } return contact; }
////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// private static SettingsPropertyValue GetPropertyValue(ProfileBase pb, string name) { SettingsProperty prop = ProfileBase.Properties[name]; if (prop == null) { return null; } SettingsPropertyValue p = pb.PropertyValues[name]; if (p == null) { // not fetched from provider pb.GetPropertyValue(name); // to force a fetch from the provider p = pb.PropertyValues[name]; if (p == null) { return null; } } return p; }
public object GetPropertyValue (string propertyName) { return _parent.GetPropertyValue (_name + "." + propertyName); }
/// <summary> /// To fill the users /// </summary> /// <param name="fillflag"></param> private void fillGrid(string fillflag) { try { // create a datatable DataTable datagrid = new DataTable("searchResults"); datagrid.Columns.Add(new DataColumn("UserName")); datagrid.Columns.Add(new DataColumn("Email")); datagrid.Columns.Add(new DataColumn("CreatedDate")); datagrid.Columns.Add(new DataColumn("IsApproved")); datagrid.Columns.Add(new DataColumn("IsLockedOut")); //find the users under client and load in to datatable (Membership.GetAllUsers().Cast<MembershipUser>()).ToList().FindAll(delegate(MembershipUser user) { objProfileBase = ProfileBase.Create(user.UserName.ToString()); return (User.Identity.Name.ToString() == objProfileBase.GetPropertyValue("ParentUserName").ToString()); }).ForEach(delegate(MembershipUser mbr) { DataRow dr = datagrid.NewRow(); dr["UserName"] = mbr.UserName; dr["Email"] = mbr.Email; dr["CreatedDate"] = mbr.CreationDate; dr["IsApproved"] = mbr.IsApproved; dr["IsLockedOut"] = mbr.IsLockedOut; datagrid.Rows.Add(dr); }); datagrid.AcceptChanges(); DataView dv = new DataView(datagrid); dv.Sort = GridSortExpression + " " + (fillflag == "sort" ? GetSortDirection() : GridViewSortDirection); gviewUsers.DataSource = dv; gviewUsers.DataBind(); GridPrevSortExpression = GridSortExpression; } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { try { ConnectionString = Session["Connectionstring"].ToString(); Master.ParentModulelbl.Text = "MAILINGS"; AccountSettingsClass objAccCls; // to get the login name for this session //LoginName LoginName = (LoginName)Master.FindControl("LoginName1"); //UserName = LoginName.Page.User.Identity.Name; #region UnComment when integrate with the billing //Billing objBilling=new Billing(); ////save the No of email limits for the client in hidden field ////the first parameter gives the user name from the login name //NoOfEmailLimitsForClient.Value = // objBilling.SelectEmailCount(((LoginName)Master.FindControl("LoginName1")).Page.User.Identity.Name, BillingConnectionString).ToString(); #endregion txtCurDate.Text = DateTime.Now.ToShortDateString(); ScriptManager1.SetFocus(txtCampaignName); lblMainMsg.Text = string.Empty; if (!IsPostBack) { ListMaster objListMaster = new ListMaster(ConnectionString); dtListNames = objListMaster.SelectAllSuppressLists(ConnectionString, "CreatedDate", "Desc"); if (Session["AccCls"] != null) { objAccCls = (AccountSettingsClass)Session["AccCls"]; if (objAccCls.IsCustomizedAMMForms) { RadComboBoxItem Hwitem = new RadComboBoxItem("Wconnect", " <a href='[!RPLINK:2!]'>Wconnect</a> "); RadComboBoxItem Hgitem = new RadComboBoxItem("GoWidener", " <a href='[!RPLINK:3!]'>GoWidener</a> "); RadComboBoxItem Twitem = new RadComboBoxItem("Wconnect", "[!RPLINK:2!]"); RadComboBoxItem Tgitem = new RadComboBoxItem("GoWidener", "[!RPLINK:3!]"); rcbLinks.Items.Add(Hwitem); rcbLinks.Items.Add(Hgitem); RadLinks.Items.Add(Twitem); RadLinks.Items.Add(Tgitem); } } //Code Added by Pushpesh Suman for From Name and Address Issue string Username = User.Identity.Name; if (Username.ToString().ToLower().Equals("admin"))// || Username.ToString().ToLower().Equals("4virtu")) { LinkButton1.Enabled = false; lbtnScheduleCampaign.Enabled = false; } objMembershipUser = Membership.GetUser(Username); objProfileBase = ProfileBase.Create(Username, true); txtFromName.Text = (objProfileBase.GetPropertyValue("FromName").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("FromName").ToString() : Username; txtReplytoAddress.Text = (objProfileBase.GetPropertyValue("ReplyEmail").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("ReplyEmail").ToString() : string.Empty; string fromAddresses = string.Empty; if (User.IsInRole("user")) { objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); fromAddresses = objUserProfileBase.GetPropertyValue("FromDomain").ToString().Replace(" ", string.Empty); } else { fromAddresses = (objProfileBase.GetPropertyValue("FromDomain").ToString() != string.Empty) ? objProfileBase.GetPropertyValue("FromDomain").ToString().Replace(" ", string.Empty) : Username; } if (fromAddresses.ToString().Trim() != string.Empty && fromAddresses.Contains(',')) { ddlFromAddress.DataSource = fromAddresses.Split(','); ddlFromAddress.DataBind(); } else if (fromAddresses.ToString().Trim() != string.Empty && !fromAddresses.Contains(',')) ddlFromAddress.Items.Add(fromAddresses); //string FromAdd = objProfileBase.GetPropertyValue("FromDomain").ToString(); //if (FromAdd.ToString().Trim() != string.Empty) //{ // txtFromAddress.Text = FromAdd.ToString().Trim(); //} //else //{ // objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); // FromAdd = objUserProfileBase.GetPropertyValue("FromDomain").ToString(); // txtFromAddress.Text = FromAdd.ToString().Trim(); //} if (!User.IsInRole("user")) { CompanyName = objProfileBase.GetPropertyValue("CompanyName").ToString(); domainNames = objProfileBase.GetPropertyValue("FromDomain").ToString(); Address = objProfileBase.GetPropertyValue("Address").ToString(); state = objProfileBase.GetPropertyValue("State").ToString(); postalcode = objProfileBase.GetPropertyValue("PostalCode").ToString(); country = objProfileBase.GetPropertyValue("Country").ToString(); hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } else { string ConnectionString1 = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString; UserInfos objUserInfos = UserInfo.SelectByField("UserId", objMembershipUser.ProviderUserKey.ToString(), ConnectionString1); if (objUserInfos.Count > 0) { //CompanyName = objProfileBase.GetPropertyValue("CompanyName").ToString(); objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); CompanyName = objUserProfileBase.GetPropertyValue("CompanyName").ToString().Replace(" ", string.Empty); Address = objUserInfos[0].Address1; domainNames = objUserInfos[0].EmailAddress; country = objUserInfos[0].Country; state = objUserInfos[0].State; postalcode = objUserInfos[0].PostalCode; hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } } RadComboBoxItem MailingaddHTML = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); rcbLinks.Items.Add(MailingaddHTML); RadComboBoxItem MailingaddText = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); RadLinks.Items.Add(MailingaddText); ViewState["CCSelectedAll"] = null; ViewState["CCSelectedLists"] = null; ViewState["SeedSelectedAll"] = null; ViewState["SeedSelectedLists"] = null; ViewState["SeedSelectAllLists"] = null; ViewState["CCSelectedDomains"] = null; ViewState["CCDomainSelectedAll"] = null; ViewState["SupressLists"] = null; ViewState["dtDomain"] = null; lbtnHtml.Visible = true; lbtnText.Visible = true; divtextHtml.Style.Add("display", "none"); bindCampNames(); ////Up to here if (Request.QueryString["id"] != null) { //set main title for the page. lblMainTitle.Text = "Edit Mailing"; hiddenCampaignID.Value = Request.QueryString["id"].ToString(); bindCampaignDetails(hiddenCampaignID.Value); } else { //set main title for the page. lblMainTitle.Text = "New Mailing"; DivUnsubtext.InnerHtml = "If you no longer wish to receive these emails, simply click on the following link: \n" + DDLinktext.SelectedValue; txtUnsubscribe.Text = "If you no longer wish to receive these emails, simply click on the following link:"; lblunsubinfo.Text = "If you no longer wish to receive these emails, simply click on the following link:"; lblunsublinktext.Text = DDLinktext.SelectedItem.Text.ToString(); } //for subjectpf dropdown fill data ddlSubjectpf.Items.Add(new ListItem("--Select--", "--Select--")); ddlSubjectpf.Items.Add(new ListItem("First Name", "[!FirstName!]")); ddlSubjectpf.Items.Add(new ListItem("Last Name", "[!LastName!]")); ddlSubjectpf.Items.Add(new ListItem("Email Address", "[!EmailAddress!]")); DataTable dt = ManageFieldsBase.SelectCustomFields(ConnectionString); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["PersonalizedField"].ToString() == "True") { if (dt.Rows[i]["FieldType"].ToString() == "Text Box" || dt.Rows[i]["FieldType"].ToString() == "Date" || dt.Rows[i]["FieldType"].ToString() == "Check Box") { ddlSubjectpf.Items.Add(new ListItem(dt.Rows[i]["FieldName"].ToString(), "[!" + dt.Rows[i]["FieldName"].ToString() + "!]")); } } } } this.Form.DefaultFocus = txtCampaignName.ClientID; if (rdoSendLater.Checked == true) { LinkButton1.Visible = true; lbtnScheduleCampaign.Visible = false; } else { LinkButton1.Visible = false; lbtnScheduleCampaign.Visible = true; } } catch (Exception ex) { lblMainMsg.Text = "Error: " + ex.Message; } }
protected void Login1_LoggedIn(object sender, EventArgs e) { try { Login1.UserName = txtUserName.Text; if (Roles.GetRolesForUser(Login1.UserName).ToList().Contains("superadmin")) { Response.Redirect("~/adminpages/updateclient.aspx", true); } else { txtUserName = (TextBox)Login1.FindControl("UserName"); objProfileBase = ProfileBase.Create(txtUserName.Text, true); string dbName = objProfileBase.GetPropertyValue("DBName").ToString(); string dbUserID = objProfileBase.GetPropertyValue("DBUserID").ToString(); string dbPassword = objProfileBase.GetPropertyValue("DBPassword").ToString(); string dbServerName = objProfileBase.GetPropertyValue("DBServerName").ToString(); string parentUser = objProfileBase.GetPropertyValue("ParentUserName").ToString(); Session["parentUser"] = parentUser; string ConnectionString = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};Pooling=True", dbServerName, dbName, dbUserID, dbPassword); Session["Connectionstring"] = ConnectionString; MainConn = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString; generateAccCls(txtUserName.Text.ToString(), MainConn); } } catch (Exception ex) { //lblFailText = (Label)Login1.FindControl("lblFailText"); //lblFailText.Text = ex.Message; throw ex; } }
public static ConfigurationModel Initialize(ProfileBase profile) { ConfigurationModel model = new ConfigurationModel(); model.PhoneNumber = (string)profile.GetPropertyValue("PhoneNumber"); model.ReplyToMailbox = (bool)profile.GetPropertyValue("ReplyToMailbox"); model.SmtpServerName = (string)profile.GetPropertyValue("SmtpServerName"); model.SmtpServerPort = (int?)profile.GetPropertyValue("SmtpServerPort"); model.SmtpUserName = (string)profile.GetPropertyValue("SmtpUserName"); model.SmtpPassword = (string)profile.GetPropertyValue("SmtpPassword"); model.UseSmtpSsl = (bool)profile.GetPropertyValue("UseSmtpSsl"); model.AccountSid = (string)profile.GetPropertyValue("AccountSid"); model.AuthToken = (string)profile.GetPropertyValue("AuthToken"); return model; }
private void SendNewsletter(object data) { object[] parameters = (object[])data; // get parameters from the data object passed in Newsletter newsletter = (Newsletter)parameters[0]; TheBeerHouseDataContext dc = (TheBeerHouseDataContext)parameters[1]; MembershipUserCollection membershipUserCollection = Membership.GetAllUsers(); ProfileBase profileBase = new ProfileBase(); NewslettersElement config = Configuration.TheBeerHouseSection.Current.Newsletters; // create the message MailMessage mailMessage = new MailMessage(); mailMessage.Body = newsletter.HtmlBody; mailMessage.From = new MailAddress(config.FromEmail, config.FromDisplayName); mailMessage.Subject = newsletter.Subject; // add members to the BCC foreach (MembershipUser membershipUser in membershipUserCollection) { profileBase = ProfileBase.Create(membershipUser.UserName); if (profileBase.GetPropertyValue("Subscription").ToString() != "None") mailMessage.Bcc.Add(membershipUser.Email); } // send the e-mail SmtpClient smtpClient = new SmtpClient(); try { smtpClient.Send(mailMessage); newsletter.Status = "Sent"; newsletter.DateSent = DateTime.Now; dc.SubmitChanges(); } catch (Exception ex) { newsletter.Status = "Failed: " + ex.Message; dc.SubmitChanges(); } }
protected void Page_Load(object sender, EventArgs e) { ConnectionString = Session["ConnectionString"].ToString(); AccountSettingsClass objAccCls; Master.ParentModulelbl.Text = "TEMPLATES"; divHtml.Style.Add("display", "block"); divtextHtml.Style.Add("display", "none"); this.Form.DefaultFocus = txtTemplateName.ClientID; lblMessage.Visible = false; //Querystring passing from this save and new method if (Request.QueryString["Status"] != null) { lblMessage.Visible = true; if (Convert.ToBoolean(Request.QueryString["Status"]) == true) lblMessage.Text = "Template created successfully"; else lblMessage.Text = "Template updated successfully"; } if (Request.QueryString["edit"].ToString() == "true") { lblTitle.Text = "Edit Template"; } else { lblTitle.Text = "Build Template"; } if (Request.QueryString["id"] != null) { templateID = Convert.ToInt32(Request.QueryString["id"].ToString()); } if (!IsPostBack) { if (Session["AccCls"] != null) { objAccCls = (AccountSettingsClass)Session["AccCls"]; if (objAccCls.IsCustomizedAMMForms) { RadComboBoxItem Hwitem = new RadComboBoxItem("Wconnect", " <a href='[!RPLINK:2!]'>Wconnect</a> "); RadComboBoxItem Hgitem = new RadComboBoxItem("GoWidener", " <a href='[!RPLINK:3!]'>GoWidener</a> "); RadComboBoxItem Twitem = new RadComboBoxItem("Wconnect", "[!RPLINK:2!]"); RadComboBoxItem Tgitem = new RadComboBoxItem("GoWidener", "[!RPLINK:3!]"); rcbLinks.Items.Add(Hwitem); rcbLinks.Items.Add(Hgitem); RadLinks.Items.Add(Twitem); RadLinks.Items.Add(Tgitem); } } if (templateID > 0) { fillTemplateDetails(); } if (!User.IsInRole("user")) { objProfileBase = ProfileBase.Create(User.Identity.Name, true); CompanyName = objProfileBase.GetPropertyValue("CompanyName").ToString(); domainNames = objProfileBase.GetPropertyValue("FromDomain").ToString(); Address = objProfileBase.GetPropertyValue("Address").ToString(); state = objProfileBase.GetPropertyValue("State").ToString(); postalcode = objProfileBase.GetPropertyValue("PostalCode").ToString(); country = objProfileBase.GetPropertyValue("Country").ToString(); hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } else { string ConnectionString1 = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConstr"].ConnectionString; UserInfos objUserInfos = UserInfo.SelectByField("UserId", objMembershipUser.ProviderUserKey.ToString(), ConnectionString1); if (objUserInfos.Count > 0) { objUserProfileBase = ProfileBase.Create(objProfileBase.GetPropertyValue("ParentUserName").ToString(), true); CompanyName = objUserProfileBase.GetPropertyValue("CompanyName").ToString().Replace(" ", string.Empty); Address = objUserInfos[0].Address1; domainNames = objUserInfos[0].EmailAddress; country = objUserInfos[0].Country; state = objUserInfos[0].State; postalcode = objUserInfos[0].PostalCode; hdUserAddress.Value = "<span style='font-size :small'>Our mailing address is:<br />" + CompanyName + "," + Address + "," + state + "," + postalcode + "," + country + "</span>"; } } RadComboBoxItem MailingaddHTML = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); rcbLinks.Items.Add(MailingaddHTML); RadComboBoxItem MailingaddText = new RadComboBoxItem("Mailing Address", hdUserAddress.Value); RadLinks.Items.Add(MailingaddText); } }
//this event is used to remove the client protected void lbtnYes_Click(object sender, EventArgs e) { try { for (int i = 0; i < gviewClients.Rows.Count; i++) { CheckBox grdaddchkSelectUser = (CheckBox)gviewClients.Rows[i].FindControl("grdaddchkSelectUser"); if (grdaddchkSelectUser != null && grdaddchkSelectUser.Checked == true) { LinkButton lblUsername = (LinkButton)gviewClients.Rows[i].FindControl("lblUsername"); Clientnames.Append(lblUsername.Text + ", "); } } Clientnames.Remove(Clientnames.Length - 2, 1); string[] uNames = Clientnames.ToString().Split(','); foreach (string User in uNames) { #region Bellow code used to Before Delete the user we are take the backup for that Db and drop that DataBase Also SqlCommand comBak, comDel = null; SqlConnection conn = null; string path = ConfigurationManager.AppSettings["RPbackupFile"].ToString(); objProfileBase = ProfileBase.Create(User, true); string dbName = objProfileBase.GetPropertyValue("DBName").ToString(); string dbServerName = objProfileBase.GetPropertyValue("DBServerName").ToString(); string dbUserName = objProfileBase.GetPropertyValue("DBUserID").ToString(); string dbPwd = objProfileBase.GetPropertyValue("DBPassword").ToString(); string conString = "Data Source= " + dbServerName.ToString() + ";Initial Catalog= master;User ID=" + dbUserName.ToString() + ";Password="******"_" + DateTime.Now.Day + DateTime.Now.ToString("MMM") + DateTime.Now.ToString("yyyy") + ".bak"; string strBakCommandText, strDelCommandText; strBakCommandText = "BACKUP DATABASE " + dbName; strBakCommandText += @" TO DISK=N'" + path + "'"; comBak = new SqlCommand(strBakCommandText, conn); comBak.CommandType = System.Data.CommandType.Text; int resBak = comBak.ExecuteNonQuery(); strDelCommandText = "ALTER DATABASE " + dbName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE DROP DATABASE " + dbName; comDel = new SqlCommand(strDelCommandText, conn); comDel.CommandType = System.Data.CommandType.Text; int resDel = comDel.ExecuteNonQuery(); conn.Close(); #endregion //Delete that particular user in UserPermissions Table also objMembershipUser = Membership.GetUser(User.ToString()); UserPermissionPrimaryKey objUserPermissionPrimaryKey = new UserPermissionPrimaryKey(objMembershipUser.ProviderUserKey.ToString()); UserPermission objUserPermission = UserPermission.SelectOne(objUserPermissionPrimaryKey, ConnectionString); objUserPermission.Delete(); //Delete User in Membership bool isSuccess = Membership.DeleteUser(User, true); ProfileManager.DeleteProfile(User); if (isSuccess == true) delClients.Append(User + ", "); else unDelClients.Append(User + ", "); } if (delClients.Length != 0) delClients.Remove(delClients.Length - 2, 1); if (unDelClients.Length != 0) unDelClients.Remove(unDelClients.Length - 2, 1); DeleteModalPopup.Hide(); FillGrid(string.Empty); if (delClients.Length != 0) { lblMsg.Style.Add("color", "Green"); lblMsg.Text = string.Format("Clients: " + delClients + " deleted successfully"); Session["SelectedContacts"] = null; upClientData.Update(); } else { lblMsg.Style.Add("color", "Red"); lblMsg.Text = "Unable to delete the Clients"; upClientData.Update(); } } catch (Exception ex) { throw ex; } }
protected void gviewClients_RowCommand(object sender, GridViewCommandEventArgs e) { try { HiddenUserName.Value = e.CommandArgument.ToString(); if (e.CommandName == "Edit") { UpdateClientModalPopupExtender.Show(); objMembershipUser = Membership.GetUser(HiddenUserName.Value); txtUsername.Text = HiddenUserName.Value; txtEmail.Text = objMembershipUser.Email.ToString(); chkStatus.Checked = objMembershipUser.IsApproved; txtPassword.Text = objMembershipUser.GetPassword(); //fill user information from profile objProfileBase = ProfileBase.Create(HiddenUserName.Value, true); txtFirstname.Text = objProfileBase.GetPropertyValue("FName").ToString(); txtLastname.Text = objProfileBase.GetPropertyValue("LName").ToString(); txtMobilePhone.Text = objProfileBase.GetPropertyValue("MobilePhone").ToString(); txtHomePhone.Text = objProfileBase.GetPropertyValue("HomePhone").ToString(); txtPostalCode.Text = objProfileBase.GetPropertyValue("PostalCode").ToString(); txtCompanyName.Text = objProfileBase.GetPropertyValue("CompanyName").ToString(); txtState.Text = objProfileBase.GetPropertyValue("State").ToString(); txtCountry.Text = objProfileBase.GetPropertyValue("Country").ToString(); txtWorkPhone.Text = objProfileBase.GetPropertyValue("WorkPhone").ToString(); txtFax.Text = objProfileBase.GetPropertyValue("Fax").ToString(); txtAddress.Text = objProfileBase.GetPropertyValue("Address").ToString(); txtDBServerName.Text = objProfileBase.GetPropertyValue("DBServerName").ToString(); txtDBName.Text = objProfileBase.GetPropertyValue("DBName").ToString(); txtDBUserID.Text = objProfileBase.GetPropertyValue("DBUserID").ToString(); txtDBPassword.Text = objProfileBase.GetPropertyValue("DBPassword").ToString(); txtFromDomain.Text = objProfileBase.GetPropertyValue("FromDomain").ToString(); txtEVMTAName.Text = objProfileBase.GetPropertyValue("MtaName").ToString(); txtEFromName.Text = objProfileBase.GetPropertyValue("FromName").ToString(); txtEReplyEmail.Text = objProfileBase.GetPropertyValue("ReplyEmail").ToString(); if (objProfileBase.GetPropertyValue("AccType").ToString() != string.Empty) ddlEAdminAccType.Text = objProfileBase.GetPropertyValue("AccType").ToString(); upEditClient.Update(); } //swaraj on 2nd march 2010 //to reset password if (e.CommandName == "Reset Password") { MembershipProvider Mp = Membership.Providers["MPforResetPwd"]; MembershipUser Mu = Mp.GetUser(e.CommandArgument.ToString(), true); string password = Mu.ResetPassword(); //message body StringBuilder body = new StringBuilder(); body.Append("<HTML><BODY>"); body.Append("<table width=\"100%\"><tr><td align=\"left\" colspan=\"3\" style=\"height:4px; color:green;\"><h3></h3> <td></tr><tr><td colspan=\"3\"> </td></tr>"); body.Append("<tr><td colspan=\"3\"> Hi " + Mu.UserName.ToString() + ",</td></tr><tr><td colspan=\"3\"> </td></tr>"); body.Append("<tr><td colspan=\"3\">Welcome to 1Point</td></tr><tr><td colspan=\"3\"> </td></tr>"); body.Append("<tr><td colspan=\"3\">You can login in to your account at:</td></tr>"); body.Append("<tr><td colspan=\"3\"><a href=\"" + ConfigurationManager.AppSettings["LoginUrl"] + "\">Login</a></td></tr>"); body.Append("<tr><td colspan=\"3\"></td></tr><tr><td colspan=\"3\"> </td></tr>"); body.Append("\n<tr><td >Your new Pasword : " + password + "</td></tr> <tr><td colspan=\"3\"> </td></tr>"); body.Append("<tr><td colspan=\"3\">If there's anything we can do to help, please get in touch.</td></tr><tr><td colspan=\"3\"> </td></tr>"); body.Append("<tr><td colspan=\"3\">Regards,</td></tr>"); body.Append("<tr><td colspan=\"3\">1Point team</td></tr>"); body.Append("<tr><td colspan=\"3\">" + ConfigurationManager.AppSettings["SuperAdminEmail"].ToString().Split(',').GetValue(0) + "</td></tr>"); MailMessage SendMessageToUser = new MailMessage(); SendMessageToUser.To.Add(Mu.Email.ToString()); SendMessageToUser.Body = body.ToString(); SendMessageToUser.Subject = "Your new password"; SendMessageToUser.IsBodyHtml = true; //add cc of superadmin emails ConfigurationManager.AppSettings["SuperAdminEmail"].ToString().Split(',').ToList().ForEach(delegate(string mail) { SendMessageToUser.CC.Add(mail); }); SmtpClient SmtpMail = new SmtpClient(); SmtpMail.Send(SendMessageToUser); lblMsg.Style.Add("color", "Green"); lblMsg.Text = "Your new password has been emailed to " + Mu.Email.ToString(); } if (e.CommandName == "Unlock") { objMembershipUser = Membership.GetUser(HiddenUserName.Value); objMembershipUser.UnlockUser(); FillGrid(string.Empty); lblMsg.Style.Add("color", "Green"); lblMsg.Text = string.Format("Client : {0} account is successfully unlocked!!!", HiddenUserName.Value.ToString()); } if (e.CommandName.ToLower() == "delete") { hdfield.Value = e.CommandArgument.ToString(); DeleteModalPopup.Show(); } } catch (Exception ex) { throw ex; } }
private string GetProfileValue(string profileValue, ProfileBase profileBase) { string subsType = null; if (profileBase.GetPropertyValue(profileValue) != null) subsType = profileBase.GetPropertyValue(profileValue).ToString(); return subsType; }
protected void lbtnSave_Click(object sender, EventArgs e) { try { lblMsg.ForeColor = Color.Green; UserPermissions UserPermissions = UserPermission.SelectByField("UserName", ddlClients.SelectedItem.Text.ToString(), ConnectionString); if (UserPermissions.Count > 0) { //Updated lblMsg.Text = (generateAccCls(ddlClients.SelectedItem.Text.ToString(), "Update")) ? "Successfully Applied Settings!" : "Not Applied Settings!"; //where ever we are update any Client permissions, update Users permissions of that particular Client also //Get all the users of Particular Client IEnumerable<MembershipUser> users = (Membership.GetAllUsers().Cast<MembershipUser>()).ToList().FindAll(delegate(MembershipUser user) { objProfileBase = ProfileBase.Create(user.UserName.ToString()); return (ddlClients.SelectedItem.Text.ToString() == objProfileBase.GetPropertyValue("ParentUserName").ToString()); }); foreach (object user in users) { lblUserMsg.Text = (updateAllUserPermissions(user.ToString().Trim())) ? updatedUserNames.Append(string.Format("{0},", user)).ToString() : faildUserNames.Append(string.Format("{0},", user)).ToString(); } if (lblUserMsg.Text.ToString().EndsWith(",")) lblUserMsg.Text = "Updated Users :" + lblUserMsg.Text.ToString().Remove(lblUserMsg.Text.ToString().Length - 1, 1); } else { //Inserted lblMsg.Text = (generateAccCls(ddlClients.SelectedItem.Text.ToString(), "Insert")) ? "Successfully Applied Settings!" : "Not Applied Settings!"; } } catch (Exception ex) { lblMsg.ForeColor = Color.Red; lblMsg.Text = ex.Message; } }
protected void lbtnNext_Click(object sender, EventArgs e) { mvAuthorize.ActiveViewIndex = mvAuthorize.ActiveViewIndex + 1; if (mvAuthorize.ActiveViewIndex == 1) { objProfileBase = ProfileBase.Create(User.Identity.Name, true); objMembershipUser = Membership.GetUser(User.Identity.Name); txtaddress.Text = objProfileBase.GetPropertyValue("Address").ToString(); ; txtfirstname.Text = objProfileBase.GetPropertyValue("FName").ToString(); ; txtlastname.Text = objProfileBase.GetPropertyValue("LName").ToString(); ; txtemail.Text = objMembershipUser.Email; txtstate.Text = objProfileBase.GetPropertyValue("State").ToString(); txtphone.Text = objProfileBase.GetPropertyValue("WorkPhone").ToString(); txtzip.Text = objProfileBase.GetPropertyValue("PostalCode").ToString(); lblAmount.Text = "$"+amount.ToString(); } }
public ActionResult ViewSchedule(FormCollection form) { string viewuserkey = form["ddUsersList"].ToString(); MembershipUserCollection userList = Membership.GetAllUsers(); List<SelectListItem> itemsUser = new List<SelectListItem>(); string ediusernamedisplay = ""; foreach (MembershipUser user in userList) { if (!Roles.IsUserInRole(user.UserName, "Admin")) { var userprofile = new ProfileBase(); userprofile.Initialize(user.UserName, true); string fname = userprofile.GetPropertyValue("FirstName").ToString(); string lname = userprofile.GetPropertyValue("LastName").ToString(); string userkey = user.ProviderUserKey.ToString(); if (viewuserkey == userkey) { ediusernamedisplay = fname + " " + lname; } SelectListItem item = new SelectListItem(); item.Text = fname + " " + lname; item.Value = userkey; itemsUser.Add(item); } } SelectList ddUserlist = new SelectList(itemsUser, "Value", "Text"); ViewData["Userlist"] = ddUserlist; ViewData["ViewUser"] = ediusernamedisplay; ViewData["UserProjectList"] = SynergyService.getUserProjects(viewuserkey); return View("Schedule"); }
private void fillUserDetails(string userName) { try { //fill user information from membership objMembershipUser = Membership.GetUser(userName); txtUsername.Text = User.Identity.Name; txtEmail.Text = objMembershipUser.Email; //fill user information from profile objProfileBase = ProfileBase.Create(userName, true); txtFirstname.Text = objProfileBase.GetPropertyValue("FName").ToString(); txtLastname.Text = objProfileBase.GetPropertyValue("LName").ToString(); txtMobilePhone.Text = objProfileBase.GetPropertyValue("MobilePhone").ToString(); txtFax.Text = objProfileBase.GetPropertyValue("Fax").ToString(); txtAddress.Text = objProfileBase.GetPropertyValue("Address").ToString(); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { Master.ParentModulelbl.Text = "Campaign Summary"; ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); scriptManager.RegisterPostBackControl(this.lbtnDownload); Session["AdvCampId"] = null; Session["AdvCampName"] = null; if (Request.QueryString["Client"] != null && Session["AdvanceTabCon"] == null) { userName = Request.QueryString["Client"].ToString(); Session["ClientName"] = userName.ToString(); objProfileBase = ProfileBase.Create(userName, true); string dbName = objProfileBase.GetPropertyValue("DBName").ToString(); string dbUserID = objProfileBase.GetPropertyValue("DBUserID").ToString(); string dbPassword = objProfileBase.GetPropertyValue("DBPassword").ToString(); string dbServerName = objProfileBase.GetPropertyValue("DBServerName").ToString(); Connectionstring = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};Pooling=True", dbServerName, dbName, dbUserID, dbPassword); Session["AdvanceTabCon"] = Connectionstring; //userName = "******";// Request.QueryString["Client"].ToString(); // //Session["ClientName"] = userName.ToString(); //objProfileBase = ProfileBase.Create(userName, true); //string dbName = "amm_Latest";// objProfileBase.GetPropertyValue("DBName").ToString(); //string dbUserID = objProfileBase.GetPropertyValue("DBUserID").ToString(); //string dbPassword = objProfileBase.GetPropertyValue("DBPassword").ToString(); //string dbServerName = objProfileBase.GetPropertyValue("DBServerName").ToString(); //Connectionstring = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};Pooling=True", dbServerName, dbName, dbUserID, dbPassword); //Session["AdvanceTabCon"] = Connectionstring; } Master.ClientName.Text = (Session["ClientName"] != null) ? Session["ClientName"].ToString() : userName; if (Session["AdvanceTabCon"] != null) { Connectionstring = Session["AdvanceTabCon"].ToString(); } if (!IsPostBack) { if (Connectionstring != string.Empty) bindGrid("", 0); } }
/// <summary> /// To fill Select User dropdown /// </summary> protected void FillDll() { IEnumerable<MembershipUser> users = (Membership.GetAllUsers().Cast<MembershipUser>()).ToList().FindAll(delegate(MembershipUser user) { objProfileBase = ProfileBase.Create(user.UserName.ToString()); return (User.Identity.Name.ToString() == objProfileBase.GetPropertyValue("ParentUserName").ToString()); }); ddlUsers.DataSource = users; ddlUsers.DataBind(); }
/// <summary> /// 获取用户ProfileItem /// </summary> private string GetUserProfileItem(ProfileBase objProfile, string key, string defaultvalue = "") { string value = objProfile.GetPropertyValue(key).ToString(); return string.IsNullOrEmpty(value) ? defaultvalue : value; }
public ActionResult Schedule() { MembershipUserCollection userList = Membership.GetAllUsers(); List<SelectListItem> itemsUser = new List<SelectListItem>(); foreach (MembershipUser user in userList) { if (!Roles.IsUserInRole(user.UserName, "Admin")) { var userprofile = new ProfileBase(); userprofile.Initialize(user.UserName, true); string fname = userprofile.GetPropertyValue("FirstName").ToString(); string lname = userprofile.GetPropertyValue("LastName").ToString(); string userkey = user.ProviderUserKey.ToString(); SelectListItem item = new SelectListItem(); item.Text = fname + " " + lname; item.Value = userkey; itemsUser.Add(item); } } SelectList ddUserlist = new SelectList(itemsUser, "Value", "Text"); ViewData["Userlist"] = ddUserlist; return View(); }