private void BindCompanyDetails() { oCompanyInfo = new Entity.CompanyInfo(); oCompanyManager = new BLL.CompanyManager(); oCompanyInfo = oCompanyManager.GetCompanyDetailsById(Convert.ToInt32(Request.QueryString["id"])); if (oCompanyInfo != null) { rblStatus.SelectedValue = oCompanyInfo.ChrIsActive.ToString(); txtAddress.Text = oCompanyInfo.StrCompanyAddress.Trim(); txtCity.Text = oCompanyInfo.StrCity.Trim(); lblEmailId.Text = oCompanyInfo.StrCompanyEmail.Trim(); txtCompanyName.Text = oCompanyInfo.StrCompanyName.Trim(); txtFax.Text = oCompanyInfo.StrCompanyFax.Trim(); txtPhone.Text = oCompanyInfo.StrCompanyPhone.Trim(); ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf(ddlCountry.Items.FindByValue(oCompanyInfo.IntCountryId.ToString())); ddlState.SelectedIndex = ddlState.Items.IndexOf(ddlState.Items.FindByValue(oCompanyInfo.IntStateId.ToString())); txtStateText.Text = oCompanyInfo.StrStateName; fillState(); // ddlState.SelectedIndex = ddlState.Items.IndexOf(ddlState.Items.FindByValue(oCompanyInfo.IntStateId.ToString())); rblApproved.SelectedValue = oCompanyInfo.ChrIsApproved.ToString(); } oCompanyInfo = null; oCompanyManager = null; }
protected void lnkBtnSendRequest_Click(object sender, EventArgs e) { string strEmailContentForCompany = string.Empty; strEmailContentForCompany = "<table>"; string strContent = string.Empty; BLL.TemplateLib oTemplateLib = new BLL.TemplateLib(); strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RegistrationRequestForUserEmail").TextAreaHTML; List<Entity.CompanyInfo> _objListCompanyInfo = new List<Entity.CompanyInfo>(); foreach (GridViewRow gvRows in GVUsers.Rows) { CheckBox chkSelect = (CheckBox)gvRows.FindControl("chkSelect"); if (chkSelect.Checked) { lblMsg.Text = string.Empty; Label lblCompanyRequestedUsersListId = (Label)gvRows.FindControl("lblCompanyRequestedUsersListId"); Label lblEmail = (Label)gvRows.FindControl("lblEmail"); Label lblName = (Label)gvRows.FindControl("lblName"); if (lblCompanyRequestedUsersListId != null) { string strRegistrationLink = AppConfig.GetBaseSiteUrl() + "UserRegistration.aspx?iid=" + lblCompanyRequestedUsersListId.Text; strEmailContentForCompany = strEmailContentForCompany + "<tr><td>" + lblName.Text + "(" + lblEmail.Text + ")</td></tr>"; strContent = strContent.Replace("[FullName]", lblName.Text); strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl()); strContent = strContent.Replace("[RegistrationLink]", strRegistrationLink); strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName()); //AppLib.SendMailToUser(lblEmail.Text, "Registration Request By TLW", strContent, AppConfig.GetAdminEmail()); string fname = "~/Upload/" + lblName.Text + ".html"; StreamWriter _testData = new StreamWriter(Server.MapPath(fname)); _testData.WriteLine(strContent); // Write the file. _testData.Flush(); _testData.Close(); // Close the instance of StreamWriter. _testData.Dispose(); // Dispose from memory. oCompanyInfo = new Entity.CompanyInfo(); oCompanyInfo.IntCompanyRequestedUsersListId = Convert.ToInt32(lblCompanyRequestedUsersListId.Text); oCompanyInfo.ChrStatus = 'S'; oCompanyInfo.DtModifiedDate = DateTime.Now; _objListCompanyInfo.Add(oCompanyInfo); oCompanyInfo = null; } } } if (_objListCompanyInfo.Count > 0) { strEmailContentForCompany = strEmailContentForCompany + "</table>"; strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("EmailToCompanyForRegistrationofUser").TextAreaHTML; strContent = strContent.Replace("[CompanyName]", ddlCompany.SelectedItem.Text); strContent = strContent.Replace("[Name]", strEmailContentForCompany); oCompanyInfo = new Entity.CompanyInfo(); oCompanyManager = new BLL.CompanyManager(); oCompanyInfo = oCompanyManager.GetCompanyDetailsById(Convert.ToInt32(ddlCompany.SelectedValue)); if (oCompanyInfo != null) { AppLib.SendMailToUser(oCompanyInfo.StrCompanyEmail, "Registration Request Status of User", strContent, AppConfig.GetAdminEmail()); } oCompanyManager.UpdateRequestUserStatus(_objListCompanyInfo); oCompanyManager = null; oCompanyInfo = null; lblMsg.Text = "Registration Request has been sent successfully."; BindCompanies('Y'); } else { lblMsg.Text = "Please select atleast one record."; } //BindCompanies('Y'); oTemplateLib = null; }
protected void lnkBtnUpdate_Click(object sender, EventArgs e) { BLL.CompanyManager oCompanyManager = new BLL.CompanyManager(); List<Entity.CompanyInfo> oListCompanyInfo = new List<Entity.CompanyInfo>(); Entity.CompanyInfo oCompanyInfo = new Entity.CompanyInfo(); switch (ddlToEmails.SelectedValue) { case "0":/*send email to all the users*/ { oListCompanyInfo = oCompanyManager.GetAllUsers(); if (oListCompanyInfo.Count > 0) { foreach (var item in oListCompanyInfo) { AppLib.SendMailToUser(item.StrEmpEmail, txtSubject.Text, reContent.Content, txtFromEmail.Text); } } oCompanyManager = null; oListCompanyInfo = null; break; } case "1":/*send email to all companies*/ { oListCompanyInfo = oCompanyManager.GetCompanyAllCompanies(); if (oListCompanyInfo.Count > 0) { foreach (var item in oListCompanyInfo) { AppLib.SendMailToUser(item.StrEmpEmail, txtSubject.Text, reContent.Content, txtFromEmail.Text); } } break; } case "2":/* send email to single companies*/ { oCompanyInfo = oCompanyManager.GetCompanyDetailsById(Convert.ToInt32(ddlCompany.SelectedValue)); if (oCompanyInfo != null) { AppLib.SendMailToUser(oCompanyInfo.StrCompanyEmail, txtSubject.Text, reContent.Content,txtFromEmail.Text); } break; } case "3":/*send email to all the users of the company*/ { oListCompanyInfo = oCompanyManager.GetUsersByCompanyId(Convert.ToInt32(ddlCompany.SelectedValue)); foreach (var item in oListCompanyInfo) { AppLib.SendMailToUser(item.StrEmpEmail, txtSubject.Text, reContent.Content, txtFromEmail.Text); } break; } case "4":/*send email to single user of the compan*/ { AppLib.SendMailToUser(ddlUsers.SelectedItem.Text, txtSubject.Text, reContent.Content, txtFromEmail.Text); break; } default: { break; } } lblMsg.Text = "Email(s) has been successfully sent. "; txtSubject.Text = string.Empty; reContent.Content = string.Empty; oCompanyManager = null; oCompanyInfo = null; oListCompanyInfo = null; }
private void sendOutConfirmationEmail(int intCompanyId) { try { oCompanyInfo = new Entity.CompanyInfo(); oCompanyManager = new BLL.CompanyManager(); oCompanyInfo = oCompanyManager.GetCompanyDetailsById(intCompanyId); if (oCompanyInfo != null) { string strContent = string.Empty; BLL.TemplateLib oTemplateLib = new BLL.TemplateLib(); strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("CompanyStatusChangedEmail").TextAreaHTML; string strToEmail = oCompanyInfo.StrCompanyEmail; strContent = strContent.Replace("[CompanyName]", oCompanyInfo.StrCompanyName); strContent = strContent.Replace("[UI_USERNAME]", oCompanyInfo.StrCompanyEmail); strContent = strContent.Replace("[WC_EMAIL_PROJECT_NAME]", AppConfig.GetSiteName()); strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl()); strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName()); strContent = strContent.Replace("[SitePhone]", AppConfig.GetSITEPHONE()); strContent = strContent.Replace("[Status]", oCompanyInfo.ChrIsActive.Equals('Y') ? "Active" : "Deactive"); AppLib.SendMailToUser(strToEmail, "Registration Request Status Changed From Tri Living Well", strContent, AppConfig.GetAdminEmail()); oTemplateLib = null; oCompanyInfo = null; oCompanyManager = null; } } catch { } }
private void SendUserRegistrationEmailtoAdmin() { try { Entity.CompanyInfo oCompanyInfo = new Entity.CompanyInfo(); oCompanyManager = new BLL.CompanyManager(); oCompanyInfo = oCompanyManager.GetCompanyDetailsById(intLoggedUserId); if (oCompanyInfo != null) { string strContent = string.Empty; BLL.TemplateLib oTemplateLib = new BLL.TemplateLib(); strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("UserRegistrationRequestByCompany").TextAreaHTML; strContent = strContent.Replace("[CompanyName]", oCompanyInfo.StrCompanyName.Trim()); strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl()); strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName()); AppLib.SendMailToUser(AppConfig.GetAdminEmail(), "User Registration Request from Company", strContent, AppConfig.GetAdminEmail()); oTemplateLib = null; } oCompanyInfo = null; oCompanyManager = null; } catch { } }