Пример #1
0
    private void SendContactUsEmail()
    {
        string strContent = string.Empty;

        BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();

        strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("ContactUsEmail").TextAreaHTML;
        strContent = strContent.Replace("[Name]", txtName.Text);
        strContent = strContent.Replace("[Email]", txtEmail.Text);
        strContent = strContent.Replace("[Phone]", txtBphone.Text);
        strContent = strContent.Replace("[Subject]", txtsubject.Text);
        strContent = strContent.Replace("[Comments]", txtComments.Text);
        strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl());
        strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName());
        strContent = strContent.Replace("[SitePhone]", AppConfig.GetSITEPHONE());

        AppLib.SendMailToUser(txtEmail.Text, txtsubject.Text, strContent, AppConfig.GetAdminEmail());

        AppLib.SendMailToUser(AppConfig.GetAdminEmail(), txtsubject.Text, "Dear Admin, Following are the contents that were sent to the user. <br />" + strContent, txtEmail.Text);

        lblMsg.Text = "Thanks for contact us. Your details has been successfully sent to TLW.";
        txtName.Text = string.Empty;
        txtBphone.Text = string.Empty;
        txtComments.Text = string.Empty;
        txtEmail.Text = string.Empty;
        txtsubject.Text = string.Empty;
    }
 protected void lnkBtnUpdate_Click(object sender, EventArgs e)
 {
     BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
     oTemplateLib.UpdateTemplateDetails(ddlPage.SelectedValue, reContent.Content);
     lblMsg.Text = "Content has been updated successfully.";
     oTemplateLib = null;
 }
    protected void ddlTemplateName_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Convert.ToInt32(ddlTemplateName.SelectedValue) > 0)
        {
            BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
            ddlPage.DataSource = oTemplateLib.GetTemplateByTemplateType(Convert.ToInt32(ddlTemplateName.SelectedValue));
            ddlPage.DataTextField = "StrDefaultName";
            ddlPage.DataValueField = "StrPageName";
            ddlPage.DataBind();
            ddlPage.Items.Insert(0, new ListItem("Select", "0"));
            oTemplateLib = null;
            reContent.Content = string.Empty;

            List<ListItem> li = new List<ListItem>();
            foreach (ListItem list in ddlPage.Items)
            {
                li.Add(list);
            }
            li.Sort((x, y) => string.Compare(x.Text, y.Text));
            ddlPage.Items.Clear();
            ddlPage.DataSource = li;
            ddlPage.DataTextField = "Text";
            ddlPage.DataValueField = "Value";
            ddlPage.DataBind();

        }
        else
        {
            ddlPage.Items.Clear();
            lblMsg.Text = "Please Select Template";
            reContent.Content = string.Empty;
        }
    }
    protected void ddlSelectPage_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (!ddlPage.SelectedValue.ToString().Equals("0"))
        {
            BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
            reContent.Content = oTemplateLib.GetTemplateDetailsByTemplateTemplateName(ddlPage.SelectedValue).TextAreaHTML;

            oTemplateLib = null;
        }
        else
        {
            lblMsg.Text = "Please Select Content";
            reContent.Content = string.Empty;
        }
    }
 private void BindCMSText()
 {
     BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
     try
     {
         lblCMSText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessFourthStepIntroduction").TextAreaHTML;
         lblWalkingText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("WalkingOverview").TextAreaHTML;
         lblRunningText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RunningOverview").TextAreaHTML;
         lblCyclingText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("CyclingOverview").TextAreaHTML;
         lblSwimmingText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("SwimmingOverview").TextAreaHTML;
         lblFemaleHomeText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("FemaleHomeOverview").TextAreaHTML;
         lblFemaleGymText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("FemaleGymOverview").TextAreaHTML;
         lblMaleHomeText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("MaleHomeOverview").TextAreaHTML;
         lblMaleGymText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("MaleGymOverview").TextAreaHTML;
         lblCrossfitText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("CrossFitOverview").TextAreaHTML;
     }
     catch { }
     finally { oTemplateLib = null; }
 }
    private void sendOutConfirmationEmail(string sUsername)
    {
        try
        {
            string strContent = string.Empty;
            MembershipUser Current = Membership.GetUser(sUsername);
            string pass = Current.GetPassword().ToString();
            BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
            strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("ForgotPassword").TextAreaHTML;
            strContent = strContent.Replace("[UI_USERNAME]", sUsername);
            strContent = strContent.Replace("[UI_PASSWORD]", pass);
            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());

            AppLib.SendMailToUser(sUsername, "Forgot Password From Tri Living Well", strContent, AppConfig.GetAdminEmail());
            oTemplateLib = null;
        }
        catch { }
    }
 private void BindCMSText()
 {
     BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
     try
     {
         lblCMSText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessFirstStepIntroductionPart2").TextAreaHTML;
     }
     catch { }
     finally { oTemplateLib = null; }
 }
    /// Function Header*******************************************************
    /// Function Name: SaveDetails
    /// Function Type: Function
    /// Functionality: Function used to save the details of questions with answer provided by admin
    /// Input: 
    /// Output: 
    /// Return Value:
    /// Note: 
    /// ********************************************************************
    private void SaveDetails()
    {
        string strContent = string.Empty;

        BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();

        Entity.CompanyInfo oCompanyInfo = new Entity.CompanyInfo();
        oCompanyInfo.StrUserName = AppLib.GetLoggedInUserName();
        oCompanyInfo.IntQuestionId = Convert.ToInt32(Request.QueryString["qid"]);
        oCompanyInfo.StrAnswer = txtAnswer.Text.Trim();
        oCompanyInfo.DtAnsweredOn = DateTime.Now;
        oCompanyInfo.StrQuestionType = rdoQuestionType.SelectedValue;
        oCompanyInfo.StrAnsweredBy = AppLib.GetLoggedInUserName();
        oCompanyInfo.StrQuestion = lblQuestion.Text;
        oCompanyInfo.StrUserId = lblUserId.Text;
        BLL.CompanyManager oCompanyManager = new BLL.CompanyManager();
        oCompanyManager.SaveAnswerFromHealthCoach(oCompanyInfo);

        strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("HealthCoachSubmitQuestionEmail").TextAreaHTML;

        try
        {

           // strContent = strContent.Replace("[Name]", oCompanyManager.GetUserDetailsByUsername(lblUserEmail.Text).StrUserFullName);
            strContent = strContent.Replace("[Name]", oCompanyManager.GetUserDetailsByUsername(oCompanyInfo.StrUserId).StrUserFullName);

            strContent = strContent.Replace("[Category]", lblCategory.Text);
            strContent = strContent.Replace("[Question]", lblQuestion.Text);
            strContent = strContent.Replace("[Subject]", lblSubject.Text);
            strContent = strContent.Replace("[Comments]", lblComments.Text);
            strContent = strContent.Replace("[QuestionType]", rdoQuestionType.SelectedValue);
            strContent = strContent.Replace("[Answer]", txtAnswer.Text);
            strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl());
            strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName());
            strContent = strContent.Replace("[SitePhone]", AppConfig.GetSITEPHONE());
           // AppLib.SendMailToUser(lblUserEmail.Text, lblSubject.Text, strContent, AppConfig.GetAdminEmail());
           AppLib.SendMailToUser(oCompanyInfo.StrUserId, lblSubject.Text, strContent, AppConfig.GetAdminEmail());
            //AppLib.SendMailToUser(oCompanyInfo.StrUserId, lblSubject.Text, strContent, "*****@*****.**");

            //AppLib.SendMailToUser(AppConfig.GetAdminEmail(), lblSubject.Text, "Dear Admin, Following are the contents that were sent to the user. <br />" + strContent, lblUserEmail.Text);
        }
        catch { }
        finally
        {
            oTemplateLib = null;
            oCompanyManager = null;
            oCompanyInfo = null;
        }

        Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/UserUtilities/ManageQuestionforHealthCoach.aspx?msg=up", true);
    }
    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;
    }
    private void sendOutConfirmationEmail(string sUsername)
    {
        try
        {
            string strContent = string.Empty;

            BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
            strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("LoginNotification").TextAreaHTML;

            strContent = strContent.Replace("[LoginTime]", DateTime.Now.ToString());
            strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl());
            strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName());
            strContent = strContent.Replace("[SitePhone]", AppConfig.GetSITEPHONE());

            AppLib.SendMailToUser(sUsername, "Login Notification from Tri Living Well", strContent, AppConfig.GetAdminEmail());
            oTemplateLib = null;
        }
        catch { }
    }
    private void sendOutConfirmationEmail()
    {
        try
        {
            string strContent = string.Empty;

            BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();

            strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("CompanyRegistrationEmail").TextAreaHTML;
            strContent = strContent.Replace("[CompanyName]", txtCompanyName.Text.Trim());
            strContent = strContent.Replace("[UI_USERNAME]", txtCompanyEmail.Text.Trim());
            strContent = strContent.Replace("[UI_PASSWORD]", txtPassword.Text.Trim());
            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]", "Deactive");

            AppLib.SendMailToUser(txtCompanyEmail.Text.Trim(), "Registration Request from Tri Living Well", strContent, AppConfig.GetAdminEmail());
            oTemplateLib = null;
        }
        catch { }
    }
    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 SendContactUsEmail()
    {
        string strContent = string.Empty;

        BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();

        strContent = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("HealthCoachSubmitQuestionEmail").TextAreaHTML;

        Entity.CompanyInfo oCompanyInfo = new Entity.CompanyInfo();
        oCompanyInfo.StrCategoryLevel = ddlLevel.SelectedItem.Text;
        oCompanyInfo.StrUserName = AppLib.GetLoggedInUserName();
        oCompanyInfo.StrCategoryName = ddlCategory.SelectedItem.Text;
        oCompanyInfo.StrQuestion = txtQuestion.Text.Trim();
        oCompanyInfo.StrSubject = txtsubject.Text.Trim();
        oCompanyInfo.StrComments = txtComments.Text.Trim();
        oCompanyInfo.StrQuestionType = rdoQuestionType.SelectedItem.Text;
        oCompanyInfo.StrAnswer = string.Empty;
        oCompanyInfo.DtCreatedOn = DateTime.Now;
        oCompanyInfo.ChrIsAnsweredGiven = 'N';
        oCompanyInfo.ChrIsDeleted = 'N';

        BLL.CompanyManager oCompanyManager = new BLL.CompanyManager();
        oCompanyManager.SaveQuestionToHealthCoachFromUser(oCompanyInfo);

        lblMsg.Text = "Your question has been successfully sent to health coach. Health Coach will approach you soon";
        strContent = strContent.Replace("[Name]", oCompanyManager.GetUserDetailsByUsername(AppLib.GetLoggedInUserName()).StrUserFullName);
        strContent = strContent.Replace("[Email]", AppLib.GetLoggedInUserName());
        strContent = strContent.Replace("[Category]", ddlCategory.SelectedItem.Text + " - " + ddlLevel.SelectedItem.Text);
        strContent = strContent.Replace("[Question]", txtQuestion.Text.Trim());

        strContent = strContent.Replace("[Subject]", txtsubject.Text);
        strContent = strContent.Replace("[Comments]", txtComments.Text);
        strContent = strContent.Replace("[QuestionType]", rdoQuestionType.SelectedItem.Text);

        strContent = strContent.Replace("[SiteUrl]", AppConfig.GetBaseSiteUrl());
        strContent = strContent.Replace("[SiteName]", AppConfig.GetSiteName());
        strContent = strContent.Replace("[SitePhone]", AppConfig.GetSITEPHONE());

        ///Code for Forum

        if (rdoQuestionType.SelectedValue == "Public")
        {

            string msg = txtQuestion.Text;
            msg = msg.Trim();
            msg = msg.Replace("<", "&lt;").Replace(">", "&gt;");
            msg = aspnetforum.Utils.Formatting.FilterBadWords(msg);

            bool isModer = false;

            if (msg == "") return;

            string catgory = ddlCategory.SelectedItem.Text;
            string lvl = ddlLevel.SelectedValue;
            string totalvalue = catgory + " - " + lvl;
            providerFactory = aspnetforum.Utils.DB.CreateDBProviderFactory();
            cn = aspnetforum.Utils.DB.CreateConnection();
            cmd = providerFactory.CreateCommand();
            cmd.Connection = cn;
            this.cn.Open();
            this.cmd.CommandText = "SELECT ForumID FROM Forums WHERE Title='" + totalvalue + "'";

            object _forumID = this.cmd.ExecuteScalar();

            if (_addTopic || _changeTopic) //creating a new topic or editing topic title
            {
                string subj = txtsubject.Text;
                subj = subj.Trim();
                if (subj == "") return;
                subj = aspnetforum.Utils.Formatting.FilterBadWords(subj);

                if (_addTopic)
                {
                    string CurrentUserID = Membership.GetUser().ProviderUserKey.ToString();
                    this.cmd.Parameters.Clear();
                    this.cmd.CommandText = "INSERT INTO ForumTopics (ForumID, UserID, Subject, Visible) " +
                        "VALUES (?, convert(uniqueidentifier, ?), ?, ?)";
                    aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, _forumID, CurrentUserID, subj, !_premoderated);
                    this.cmd.ExecuteNonQuery();
                    this.cmd.Parameters.Clear();

                    this.cmd.CommandText = "SELECT MAX(TopicID) FROM ForumTopics WHERE Subject=?";
                    aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, subj);
                    _topicID = Convert.ToInt32(this.cmd.ExecuteScalar());
                    this.cmd.Parameters.Clear();

                    //CREATE A POLL (if specified)
                    string pollQuestion = "";//tbPollQuestion.Text.Trim();
                    if (pollQuestion.Length > 0)
                    {
                        //add a poll
                        this.cmd.Parameters.Clear();
                        this.cmd.CommandText = "INSERT INTO ForumPolls (TopicID, Question) " +
                            "VALUES (?, ?)";
                        aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, _topicID, pollQuestion);
                        this.cmd.ExecuteNonQuery();
                        this.cmd.Parameters.Clear();

                        //now get the ID of the poll we just created
                        this.cmd.CommandText = "SELECT MAX(PollID) FROM ForumPolls WHERE TopicID=?";
                        aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, _topicID);
                        int pollID = Convert.ToInt32(this.cmd.ExecuteScalar());
                        this.cmd.Parameters.Clear();

                        int i = 0;
                        while (Request.Form["PollOption" + i] != null && Request.Form["PollOption" + i].Trim().Length > 0)
                        {
                            //add option
                            this.cmd.CommandText = "INSERT INTO ForumPollOptions (PollID, OptionText) " +
                            "VALUES (?, ?)";
                            aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, pollID, Request.Form["PollOption" + i]);
                            this.cmd.ExecuteNonQuery();
                            this.cmd.Parameters.Clear();
                            i++;
                        }
                    }
                }
                else if (_changeTopic) //edit topic subj
                {
                    this.cmd.Parameters.Clear();
                    this.cmd.CommandText = "UPDATE ForumTopics SET Subject = ? WHERE TopicID = ?";
                    aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, subj, _topicID);
                    this.cmd.ExecuteNonQuery();
                    this.cmd.Parameters.Clear();
                }
            }

            // Inserting or updating?
            if (_isEditing)
            {
                //if moderatro, admin or message author
                //if (bmoderator || _messageAuthorID == CurrentUserID)
                //{
                //    // Record last editor and date at the end of the message.
                //    msg += "\r\n<em>edited by " + Session["aspnetforumUserName"] +
                //            " on " + aspnetforum.Utils.GetCurrTime().ToShortDateString() + "</em>";

                //    this.cmd.CommandText = "UPDATE ForumMessages SET Body=?, Visible=? " +
                //        "WHERE MessageID=" + _messageId;
                //    aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, msg, !_premoderated);
                //    this.cmd.ExecuteNonQuery();
                //    this.cmd.Parameters.Clear();

                //    SaveAttachments(_messageId);
                //}
            }
            else //inserting
            {
                this.cmd.CommandText = "INSERT INTO ForumMessages (TopicID, UserID, Body, CreationDate, Visible) " +
                    "VALUES (?, convert(uniqueidentifier, ?), ?, ?, ?)";
                aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, _topicID, CurrentUserID, msg, aspnetforum.Utils.GetCurrTime(), !_premoderated);
                this.cmd.ExecuteNonQuery();
                this.cmd.Parameters.Clear();

                //incrementing repliescount (well... actually - re-calculating it)
                this.cmd.CommandText = "SELECT Count(MessageID) FROM ForumMessages WHERE TopicID=" + _topicID;
                object res = this.cmd.ExecuteScalar();
                this.cmd.CommandText = "UPDATE ForumTopics SET RepliesCount=" + res.ToString() + " WHERE TopicID=" + _topicID;
                this.cmd.ExecuteNonQuery();

                //incrementing PostsCount in Users table only for new messages, not edits.
                //only for registered users (if guestmode is on)
                if (CurrentUserID != "")
                {
                    this.cmd.CommandText = "UPDATE ForumUsers SET PostsCount=PostsCount+1 WHERE UserID='" + CurrentUserID + "'";
                    this.cmd.ExecuteNonQuery();
                }

                //get last message's ID
                this.cmd.CommandText = "SELECT MAX(MessageID) FROM ForumMessages WHERE TopicID=" + _topicID + " AND UserID='" + CurrentUserID + "'";
                aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, true);
                res = this.cmd.ExecuteScalar();
                int lastmsgid = (res == null || res == DBNull.Value) ? 0 : Convert.ToInt32(res);

                //updating LastMessageID in Topics table
                this.cmd.CommandText = "UPDATE ForumTopics SET LastMessageID=" + lastmsgid + " WHERE TopicID=" + _topicID;
                this.cmd.ExecuteNonQuery();

                SaveAttachments(lastmsgid);
            }

            //saving notifications settings
            if (_mailNotificationsEnabled)
            {
                this.cmd.CommandText = "DELETE FROM ForumSubscriptions WHERE UserID='" + CurrentUserID + "' AND TopicID=" + _topicID;
                this.cmd.ExecuteNonQuery();
                //if(this.cbSubscribe.Checked)
                //{
                this.cmd.CommandText = "INSERT INTO ForumSubscriptions (UserID, TopicID) VALUES ('" + CurrentUserID + "', " + _topicID + ")";
                this.cmd.ExecuteNonQuery();
                //}
            }

            //sending notifications
            if (_mailNotificationsEnabled)
            {
                string url = Request.Url.ToString().ToLower();
                url = url.Substring(0, url.IndexOf("addpost.aspx"));

                if (_addTopic)
                {
                    if (_forumID != null)
                    {
                        aspnetforum.SendNotifications.SendNewTopicNotificationEmails(Convert.ToInt32(_forumID), CurrentUserID, url);
                    }

                }
                else
                {
                    aspnetforum.SendNotifications.SendNewMsgNotificationEmails(_topicID, CurrentUserID, url);
                }
            }

        }

        try
        {
            AppLib.SendMailToUser(AppLib.GetLoggedInUserName(), txtsubject.Text, strContent, AppConfig.GetAdminEmail());

            AppLib.SendMailToUser(AppConfig.GetAdminEmail(), txtsubject.Text, "Dear Admin, Following are the contents that were sent to the user. <br />" + strContent, AppLib.GetLoggedInUserName());
        }
        catch { }

        oTemplateLib = null;
        oCompanyManager = null;
        oCompanyInfo = null;

        txtQuestion.Text = string.Empty;
        txtsubject.Text = string.Empty;
        txtComments.Text = string.Empty; ;
        rdoQuestionType.SelectedIndex = 0;
    }
    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 { }
    }
 private void BindCMSText()
 {
     BLL.TemplateLib oTemplateLib = new BLL.TemplateLib();
     try
     {
         lblCMSText.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessThirdStepIntroduction").TextAreaHTML;
         lblCMSTri.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessThirdStepTri").TextAreaHTML;
         lblCMSLiving.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessThirdStepLiving").TextAreaHTML;
         lblCMSWell.Text = oTemplateLib.GetTemplateDetailsByTemplateTemplateName("RiskStratificationProcessThirdStepWell").TextAreaHTML;
     }
     catch { }
     finally { oTemplateLib = null; }
 }