protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            /*if (!chkWaiverAgreement.Checked)
            {
                lblError.Text = "Please accept the waiver agreement";
                return;
            }
            else
            {*/
                SqlConnClass objSqlConnClass = new SqlConnClass();
                BackofficeClass objBackOfficeClass = new BackofficeClass();
                PALClass objPALClass;
                objPALClass = new PALClass(objSqlConnClass.OpenConnection());
                objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);

                DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
                if (DS1 != null)
                {
                    if (DS1.Tables[0].Rows.Count > 0)
                    {
                        BLL.UserLib oUserLib = new BLL.UserLib();
                        oUserLib.UpdateUserStratificationStep(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()), "3");
                        oUserLib = null;
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep4.aspx?id=" + Request.QueryString["id"].ToString() + "&c=" + Request.QueryString["c"].ToString() + "&sc=" + Request.QueryString["sc"].ToString());
                    }
                }
            //}
        }
        catch { }
    }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {

            SqlConnClass objSqlConnClass = new SqlConnClass();
            BackofficeClass objBackOfficeClass = new BackofficeClass();
            DDClass objDDClass;
            objDDClass = new DDClass(objSqlConnClass.OpenConnection());
            objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);
            DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
            if (DS1 != null)
            {
                if (DS1.Tables[0].Rows.Count > 0)
                {
                    DataSet DS = objDDClass.DD_INSERT_DdUsers(DS1.Tables[0].Rows[0]["USER_ID"].ToString(), txtCalories.Text.Trim());
                    objSqlConnClass.CloseConnection();
                    objBackOfficeClass = null;
                    objDDClass = null;
                }
            }

            BLL.UserLib oUserLib = new BLL.UserLib();
            oUserLib.UpdateUserStratificationStep(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()), "5");
            oUserLib = null;

            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep6.aspx?id=" + Request.QueryString["id"].ToString() + "&c=" + Request.QueryString["c"].ToString() + "&sc=" + Request.QueryString["sc"].ToString());
        }
        catch { }
    }
 protected void lnkBtnSubmit_Click(object sender, EventArgs e)
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     oUserLib.UpdateFavoriteTitle(Convert.ToInt32(Request.QueryString["fid"]), txtFavoriteTitle.Text.Trim());
     oUserLib = null;
     Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/MyFavoriteList.aspx?msg=up", true);
 }
    /// Function Header*******************************************************
    /// Function Name: BindEvents
    /// Function Type: Function
    /// Functionality: used to get bind the events
    /// Input: 
    /// Output: 
    /// Return Value:
    /// Note: 
    /// *********************************************************************
    private void BindFAQ()
    {
        BLL.UserLib oUserLib = new BLL.UserLib();
        GVFAQ.DataSource = oUserLib.GetAllFAQs();

        GVFAQ.DataBind();
        oUserLib = null;
    }
 protected void GVFAQ_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("DeleteFAQ"))
     {
         BLL.UserLib oUserLib = new BLL.UserLib();
         oUserLib.DeleteFAQ(Convert.ToInt32(e.CommandArgument));
         oUserLib = null;
         Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/Templates/ManageFaq.aspx?msg=del", true);
     }
 }
예제 #6
0
    private void BindFAQ()
    {
        Entity.UserInfo oUserInfo = new Entity.UserInfo();

        BLL.UserLib oUserLib = new BLL.UserLib();
        GVTopics.DataSource = oUserLib.GetAllFAQsTopicsFromFAQ();

        GVTopics.DataBind();
        oUserLib = null;
        oUserInfo = null;
    }
 /// <summary>
 /// following function is used to bind the details at pageload
 /// </summary>
 private void BindDetails()
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     try
     {
         ddlActivityType.DataSource = oUserLib.GetMETActivities();
         ddlActivityType.DataTextField = "StrActivityName";
         ddlActivityType.DataValueField = "IntActivityTypeId";
         ddlActivityType.DataBind();
     }
     catch { }
     finally { oUserLib = null; }
 }
 /// <summary>
 /// following event is used to calculate the additional minute.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnCalculate_Click(object sender, EventArgs e)
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     try
     {
         decimal decMet = oUserLib.GetMETActivityDetailsByActivityId(Convert.ToInt32(ddlActivityType.SelectedValue)).DecMET;
         decimal decWeightinKG = Convert.ToDecimal(txtWeight.Text) / Convert.ToDecimal(2.2);
         decMet = decMet - 1;
         decimal decResult = (decMet * Convert.ToDecimal(3.5) * decWeightinKG) / Convert.ToDecimal(200);
         txtAdditionalMinuteAdded.Text = Math.Round(Convert.ToDecimal(Convert.ToDecimal(1750) / decResult)).ToString();
     }
     catch { }
     finally { oUserLib = null; }
 }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();

        oUserInfo.IntQuestionId = 0;
        oUserInfo.StrHeading = ddlTopic.SelectedItem.Text;
        oUserInfo.StrQuestion = txtQuestion.Text;
        if (oUserInfo.StrQuestion.Length > 500)
            oUserInfo.StrQuestion = oUserInfo.StrQuestion.Substring(0, 499);

        oUserInfo.StrAnswer = txtAnswer.Text;
        if (oUserInfo.StrAnswer.Length > 500)
            oUserInfo.StrAnswer = oUserInfo.StrAnswer.Substring(0, 499);

        oUserInfo.DtCreatedOn = DateTime.Now;
        oUserInfo.StrUserId = AppLib.GetLoggedInUserName();
        if (Request.QueryString["id"] == null)
        {
            oUserInfo.ChrUserType = 'A';

            if (oUserLib.InsertFAQ(oUserInfo))
            {
                oUserLib = null;
                oUserInfo = null;
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/Templates/ManageFaq.aspx?msg=ins", true);
            }
            else
            {
                lblMsg.Text = "FAQ already exists.";
            }
        }
        else
        {
            oUserInfo.IntFAQId = Convert.ToInt32(Request.QueryString["id"]);

            if (oUserLib.UpdateFAQ(oUserInfo))
            {
                oUserLib = null;
                oUserInfo = null;
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/Templates/ManageFaq.aspx?msg=up", true);
            }
            else
            {
                lblMsg.Text = "FAQ already exists.";
            }
        }

        // SendContactUsEmail();
    }
    protected void GVLibrary_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddToFavorite"))
        {
            LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource;
            Entity.UserInfo oUserInfo = new Entity.UserInfo();
            oUserInfo.IntFavoriteTypeId = 0;
            oUserInfo.IntFavoriteId = 0;
            if (lnkBtnFavorite.Text == "Remove from Favorite")
                oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument);

            oUserInfo.StrUserId = AppLib.GetLoggedInUserName();
            oUserInfo.StrTitle = "";
            oUserInfo.StrFavoriteType = "Library";
            oUserInfo.DtCreatedOn = DateTime.Now;
            oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument);
            BLL.UserLib oUserLib = new BLL.UserLib();
            oUserLib.LibraryAddToFavorite(oUserInfo);

            oUserInfo = null;
            oUserLib = null;
            BindLibrary();
        }
        else if (e.CommandName.Equals("PathViewlabrariesFile"))
        {

            Entity.LibraryInfo oLibraryInfo = new Entity.LibraryInfo();
            BLL.LibraryLib oLibraryLib = new BLL.LibraryLib();

            oLibraryInfo = oLibraryLib.GetLibraryByLibraryId(Convert.ToInt32(e.CommandArgument));

            if (oLibraryInfo.StrLocationType.ToLower().Equals("pdf") || oLibraryInfo.StrLocationType.ToLower().Equals("video"))
            {
                GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                LinkButton lnkNewslettes = (LinkButton)row.FindControl("lnkViewLabraries");

                string path = AppConfig.GetBaseSiteUrl() + AppConfig.GetLibrariesFilePath() + oLibraryInfo.StrLocation;

                Response.Write("<script type='text/javascript'>detailedresults=window.open('" + path + "', 'popUpWindow', 'height=700,width=900,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');</script>");

            }
            else
            {

            }

        }
    }
 protected void GVFavoriteList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("DeleteDetails"))
     {
         LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource;
         Entity.UserInfo oUserInfo = new Entity.UserInfo();
         oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument);
         oUserInfo.DtCreatedOn = DateTime.Now;
         oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument);
         BLL.UserLib oUserLib = new BLL.UserLib();
         oUserLib.EventAddToFavorite(oUserInfo);
         oUserInfo = null;
         oUserLib = null;
         BindFavoriteList();
         lblMsg.Text = "Record has been deleted successfully.";
     }
 }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        if (hfCategoryId.Value.ToString() == null)
        {
            lblError.Text = "Please accept the waiver agreement";
            return;
        }
        else
        {
            try
            {
                SqlConnClass objSqlConnClass = new SqlConnClass();
                BackofficeClass objBackOfficeClass = new BackofficeClass();
                PALClass objPALClass;
                objPALClass = new PALClass(objSqlConnClass.OpenConnection());
                objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);

                DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
                if (DS1 != null)
                {
                    if (DS1.Tables[0].Rows.Count > 0)
                    {
                        DataSet DS = objPALClass.PAL_INSERTMULTIPLE_PalStarts(DS1.Tables[0].Rows[0]["USER_ID"].ToString(), hfCategoryId.Value, DateTime.Now.ToString("MM/dd/yyyy"), "1");

                        objSqlConnClass.CloseConnection();

                        objBackOfficeClass = null;
                        objPALClass = null;
                        BLL.UserLib oUserLib = new BLL.UserLib();
                        oUserLib.UpdateUserStratificationStep(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()), "4");
                        oUserLib = null;
                        DS = null;

                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep5.aspx?id=" + Request.QueryString["id"].ToString() + "&c=" + Request.QueryString["c"].ToString() + "&sc=" + Request.QueryString["sc"].ToString());

                    }
                }

                objSqlConnClass.CloseConnection();
                objBackOfficeClass = null;
                objPALClass = null;
            }
            catch { }
        }
    }
예제 #13
0
 protected void GVQuestionAnswer_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             GridView GVInnerAnswer = (GridView)e.Row.FindControl("GVInnerAnswer");
             if (GVInnerAnswer != null)
             {
                 GVInnerAnswer.DataSource = oUserLib.GetAllFAQsByTopic(DataBinder.Eval(e.Row.DataItem, "StrHeading").ToString());
                 GVInnerAnswer.DataBind();
             }
         }
     }
     catch { }
     finally { oUserLib = null; }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Session["strUserName"] = "******";
        if (!AppLib.IsLoggedinSessionExists())
        {
            lblError.Text = "Your session has been expired. Please login again";
            return;
        }

        //AppLib.GetLoggedInUserName());
        #region Insert visited log details

        AppLib.InsertVisitedSectionDetails("Risk Stratification Process Step 6");

        #endregion

        if (!Page.IsPostBack)
        {
            SqlConnClass objSqlConnClass = new SqlConnClass();
            BackofficeClass objBackOfficeClass = new BackofficeClass();
            DDClass objDDClass;
            objDDClass = new DDClass(objSqlConnClass.OpenConnection());
            objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);
            DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
            if (DS1 != null)
            {
                if (DS1.Tables[0].Rows.Count > 0)
                {
                    BLL.UserLib oUserLib = new BLL.UserLib();
                    oUserLib.UpdateUserStratificationStep(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()), "6");
                    oUserLib = null;
                }
            }

            objBackOfficeClass = null;
            objDDClass = null;
            DS1 = null;
        }

        BindCMSText();
    }
    protected void GVNewsLetter_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddToFavorite"))
        {
            LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource;
            Entity.UserInfo oUserInfo = new Entity.UserInfo();
            oUserInfo.IntFavoriteTypeId = 0;
            oUserInfo.IntFavoriteId = 0;
            if (lnkBtnFavorite.Text == "Remove from Favorite")
                oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument);

            oUserInfo.StrUserId = AppLib.GetLoggedInUserName();
            oUserInfo.StrTitle = "";
            oUserInfo.StrFavoriteType = "Newsletter";
            oUserInfo.DtCreatedOn = DateTime.Now;
            oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument);
            BLL.UserLib oUserLib = new BLL.UserLib();
            oUserLib.NewsletterAddToFavorite(oUserInfo);

            oUserInfo = null;
            oUserLib = null;
            BindNewsLetters();
        }
        else if (e.CommandName.Equals("PathNewslettersFile"))
        {
            Entity.NewsInfo oNewsInfo = new Entity.NewsInfo();
            BLL.NewsLib oNewsLib = new BLL.NewsLib();

            oNewsInfo = oNewsLib.GetNewsLettersById(Convert.ToInt32(e.CommandArgument));
            if (oNewsInfo != null)
            {

                GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                LinkButton lnkNewslettes = (LinkButton)row.FindControl("lnkNewsletters");
                ViewState["strOldFileName"] = oNewsInfo.StrPDFFilename;
                string Path = AppConfig.GetBaseSiteUrl() + AppConfig.GetNewsLettersPDFPath() + oNewsInfo.StrPDFFilename;
                Response.Write("<script type='text/javascript'>detailedresults=window.open('" + Path + "', 'popUpWindow', 'height=700,width=900,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');</script>");
            }
        }
    }
    protected void GVNewsLetter_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddToFavorite"))
        {
            LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource;
            Entity.UserInfo oUserInfo = new Entity.UserInfo();
            oUserInfo.IntFavoriteTypeId = 0;
            oUserInfo.IntFavoriteId = 0;
            if (lnkBtnFavorite.Text == "Remove from Favorite")
                oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument);

            oUserInfo.StrUserId = AppLib.GetLoggedInUserName();
            oUserInfo.StrTitle = "";
            oUserInfo.StrFavoriteType = "Newsletter";
            oUserInfo.DtCreatedOn = DateTime.Now;
            oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument);
            BLL.UserLib oUserLib = new BLL.UserLib();
            oUserLib.NewsletterAddToFavorite(oUserInfo);

            oUserInfo = null;
            oUserLib = null;
            //BindNewsLetters();
        }
    }
    /// <summary>
    /// following function is used to bind the nutritional journal details
    /// </summary>
    private void BindNutritionalJournal()
    {
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        SqlConnClass objSqlConnClass = new SqlConnClass();
        DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        DataSet DS = objDDClass.get_User_Calorie(Membership.GetUser().ProviderUserKey.ToString());
        try
        {
            if (DS.Tables[0].Rows.Count > 0)
                txtCurrentCalorie.Text = DS.Tables[0].Rows[0]["CALORIE_NUMBER"].ToString();

            oUserInfo = oUserLib.GetFoodExchangeChartByCalories(Convert.ToInt32(DS.Tables[0].Rows[0]["CALORIE_NUMBER"]));
            if (oUserInfo != null)
            {
                lblMilk.Text = oUserInfo.IntMilk.ToString();
                lblFruit.Text = oUserInfo.IntFruit.ToString();
                lblVegetables.Text = oUserInfo.IntVegetable.ToString();
                lblStarch.Text = oUserInfo.IntStarch.ToString();
                lblProtein.Text = oUserInfo.IntProtein.ToString();
                lblFat.Text = oUserInfo.IntFat.ToString();
                lblWater.Text = oUserInfo.IntWater.ToString();
            }
        }
        catch
        { }
        finally
        {
            objSqlConnClass.CloseConnection();
            objSqlConnClass = null;
            objDDClass = null;
            DS = null;
            oUserLib = null;
            oUserInfo = null;
        }
    }
예제 #18
0
 /*Sub Header***********************************************************
 Function Name: InsertVisitedSectionDetails
 Functionality: This function is used to insert the section visited by user.
 Input: _strString and the _intRetCharacter
 Output:
 Note:
 *********************************************************************/
 public static void InsertVisitedSectionDetails(string _strSectionVisited)
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     Entity.UserInfo oUserInfo = new Entity.UserInfo();
     oUserInfo.StrUserId = AppLib.GetLoggedInUserName();
     oUserInfo.StrUserType = AppLib.GetCurrentUserType();
     oUserInfo.DtCreatedOn = DateTime.Now;
     oUserInfo.StrAgent = System.Web.HttpContext.Current.Request.ServerVariables.Get("HTTP_USER_AGENT");
     oUserInfo.StrVisitedIP = System.Web.HttpContext.Current.Request.ServerVariables.Get("REMOTE_ADDR");
     oUserInfo.StrSectionVisited = _strSectionVisited;
     oUserLib.InesrtSectionVisitedDetails(oUserInfo);
     oUserInfo = null;
     oUserLib = null;
 }
    private void InsertData()
    {
        try
        {
            DateTime dateValue = System.DateTime.Today;
            string dy = dateValue.ToString("dddddddd");

            providerFactory = aspnetforum.Utils.DB.CreateDBProviderFactory();
            cn = aspnetforum.Utils.DB.CreateConnection();
            cmd = providerFactory.CreateCommand();
            cmd.Connection = cn;
            this.cn.Open();

            oCompanyInfo.StrUserName = AppLib.GetLoggedInUserName();
            int sleep = Convert.ToInt32(ddlQualitySleep.SelectedValue);
            int stress = Convert.ToInt32(ddlLevel.SelectedValue);
            int outlook = Convert.ToInt32(ddloutlook.SelectedValue);
            int engagement = Convert.ToInt32(ddlengagement.SelectedValue);
            int energy = Convert.ToInt32(ddlenergylevel.SelectedValue);

            if (sleep == 0 || stress == 0  || outlook == 0 || engagement == 0 || energy == 0)
                lblMsg.Text = "You must answer each question to save.";

            else
            {

                string sUsername = Membership.GetUser().UserName;
                BLL.UserLib oUserLib = new BLL.UserLib();
                Entity.UserInfo oUserInfo = new Entity.UserInfo();
                SqlConnClass objSqlConnClass = new SqlConnClass();
                DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
                DataSet DS = objDDClass.AddupdateWellness(sUsername);
                if (DS.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = new DataTable();
                    DateTime datee = DateTime.Today;

                    string[] dateArr = new string[DS.Tables[0].Rows.Count];
                    for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
                    {
                        DateTime maxdate = Convert.ToDateTime(DS.Tables[0].Rows[i]["Dates"].ToString());
                        if (maxdate == datee)
                        {
                            this.cmd.CommandText = "Update tbl_wellnessEntry set UserName='******',Sleep='" + sleep + "',Stress='" + stress + "',Outlook='" + outlook + "',Engagement='" + engagement + "',Energy='" + energy + "',Day='" + dy + "',Dates='" + maxdate + "' where Dates='" + datee + "'";
                            this.cmd.ExecuteNonQuery();
                            this.cn.Close();
                            BindEvents();
                            bindChart();

                            // Page.Response.Redirect(Page.Request.Url.ToString(), true);
                            //lblMsg.Text = "* Your wellness Diary is Updated Successfully";
                        }
                    }
                }
                else
                {
                    this.cmd.CommandText = "INSERT INTO tbl_wellnessEntry(UserName, Sleep, Stress, Outlook, Engagement, Energy, Day, Dates) " +
                    "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
                    aspnetforum.Utils.DB.FillCommandParamaters(ref cmd, sUsername, sleep, stress, outlook, engagement, energy, dy, System.DateTime.Today.ToShortDateString());
                    this.cmd.ExecuteNonQuery();
                    this.cn.Close();
                    BindEvents();
                    bindChart();
                    //  Page.Response.Redirect(Page.Request.Url.ToString(), true);
                    //lblMsg.Text = "* Your wellness Diary is Inserted Successfully";
                }
            }

        }
        catch (Exception ex)
        {

        }
    }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
        try
        {

            bool bolIsPositiveRiskFactor = false;
            int intPositiveRiskFactor = 0;
            int intNegativeRiskFactor = 0;
            //Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep3.aspx?id=" + Request.QueryString["id"].ToString());
            foreach (GridViewRow gvr in GVQuestionnaireHeading.Rows)
            {
                Label lblQuestionHeading = (Label)gvr.FindControl("lblQuestionHeading");
                GridView GVQuestion = (GridView)gvr.FindControl("GVQuestion");
                string strQuestHeading = lblQuestionHeading.Text;

                if (lblQuestionHeading != null)
                {
                    if (!strQuestHeading.ToLower().Equals("age"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            Label lblQuestionId = (Label)gvrQuestions.FindControl("lblQuestionId");
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");

                            if (lblQuestionId.Text.Equals("18"))
                            {

                                //18 means 45 old
                            }
                            else if (lblQuestionId.Text.Equals("19"))
                            {
                                //19 means 55 old

                            }
                        }
                    }

                    if (strQuestHeading.ToLower().Equals("positive risk factor"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer != null)
                            {
                                if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                    bolIsPositiveRiskFactor = true;
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("cholesterol"))
                    {
                        bool blnIsAdded = false;
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                if (!blnIsAdded)
                                {
                                    blnIsAdded = true;
                                    intNegativeRiskFactor = intNegativeRiskFactor + 1;
                                }
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("hypertension"))
                    {
                        bool blnIsAdded = false;
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                if (!blnIsAdded)
                                {
                                    blnIsAdded = true;
                                    intNegativeRiskFactor = intNegativeRiskFactor + 1;
                                }
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("smoking"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                //Response.Write("smoking=" + intNegativeRiskFactor);
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("pre-diabetes"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("weight"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("activity factor"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                }
            }

            if (bolIsPositiveRiskFactor)
                intNegativeRiskFactor = intNegativeRiskFactor - 1;

            int intScore = 0;
            int intCategory = 0;

            //intScore = intNegativeRiskFactor - intPositiveRiskFactor;
            intScore = intNegativeRiskFactor;
            objBackOfficeClass = new BackofficeClass();
            string strEmailId = AppLib.Decrypt(Request.QueryString["id"].ToString());

            if (!oQuestionnaireLib.HasUserGivenYesAnswerinFirstRiskStratificationStep(strEmailId))
            {
                oQuestionnaireLib = null;
                DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(strEmailId);
                if (DS != null)
                {
                    if (DS.Tables[0].Rows.Count > 0)
                    {
                        int intCurrentYear = DateTime.Now.Year;
                        int intBirthYear = Convert.ToDateTime(DS.Tables[0].Rows[0]["DATE_BIRTH"]).Year;
                        int intPresentAge = intCurrentYear - intBirthYear;

                        int intGenderCode = Convert.ToInt32(DS.Tables[0].Rows[0]["GENDER_ID"]);
                        if ((intGenderCode.Equals(1) && intPresentAge <= 45) || (intGenderCode.Equals(2) && intPresentAge <= 55))
                        {///1 = male, 2= female
                            if (intScore <= 1)
                            {
                                /*Well category Low Risk*/
                                intCategory = 0;
                                category = "Well";
                            }
                            if (intScore >= 2)
                            {
                                /*Living category Medium Risk*/
                                intCategory = 2;
                                category = "Living";
                            }
                        }
                        else if ((intGenderCode.Equals(1) && intPresentAge > 45) || (intGenderCode.Equals(2) && intPresentAge > 55))
                        {///1 = male, 2= female
                            if (intScore >= 2)
                            {
                                /*Living category Medium Risk*/
                                intCategory = 2;
                                category = "Living";
                            }
                            if (intScore <= 1)
                            {
                                /*Well category Low Risk*/
                                intCategory = 0;
                                category = "Well";
                            }
                        }
                        else
                        {
                            intCategory = 1;
                            category = "Tri";
                            //try and high risk
                            /*if user given any yes answer at the step 1 questions*/
                        }
                    }
                }

                DS = null;
                objBackOfficeClass = null;
            }
            else
            {  //try and high risk
                intCategory = 1;
                category = "Tri";
                /*Means user given any yes answer at the step 1 questions*/

            }

            List<Entity.QuestionnaireInfo> oListQuestionnaireInfo = new List<Entity.QuestionnaireInfo>();

            foreach (GridViewRow gvr in GVQuestionnaireHeading.Rows)
            {
                GridView GVQuestion = (GridView)gvr.FindControl("GVQuestion");
                if (GVQuestion != null)
                {
                    foreach (GridViewRow gvrQuestion in GVQuestion.Rows)
                    {
                        Entity.QuestionnaireInfo oQuestionnaireInfo = new Entity.QuestionnaireInfo();
                        oQuestionnaireInfo.DtCreatedDate = DateTime.Now;
                        Label lblQuestionId = (Label)gvrQuestion.FindControl("lblQuestionId");
                        Label lblQuestion = (Label)gvrQuestion.FindControl("lblQuestion");
                        RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestion.FindControl("rdoListAnswer");

                        if (lblQuestionId != null && lblQuestion != null)
                        {
                            oQuestionnaireInfo.IntQuestionnaireId = Convert.ToInt32(lblQuestionId.Text);
                            oQuestionnaireInfo.StrQuestion = lblQuestion.Text;
                            oQuestionnaireInfo.StrAnswer = rdoListAnswer.SelectedValue;
                        }

                        oListQuestionnaireInfo.Add(oQuestionnaireInfo);
                        oQuestionnaireInfo = null;
                    }
                }

            }

            objBackOfficeClass = new BackofficeClass();
            DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
            if (DS1 != null)
            {
                if (DS1.Tables[0].Rows.Count > 0)
                {
                    oQuestionnaireLib = new BLL.QuestionnaireLib();
                    oQuestionnaireLib.SaveUserRiskStratificationProcessDetailsStepSecond(oListQuestionnaireInfo, new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()));

                    BLL.UserLib oUserLib = new BLL.UserLib();
                    if (!oUserLib.CheckUserAssessmentAlreadyExists(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString())))
                        objBackOfficeClass.Mem_INSERT_UserAssessments(DS1.Tables[0].Rows[0]["USER_ID"].ToString(), "1", intScore.ToString());

                    objBackOfficeClass = null;
                    oListQuestionnaireInfo = null;
                    DS1 = null;
                    oUserLib = null;
                    Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep3.aspx?id=" + Request.QueryString["id"].ToString() + "&sc=" + AppLib.Encrypt(intScore.ToString()) + "&c=" + AppLib.Encrypt(intCategory.ToString()) + "&cat=" + category.ToString());
                }
            }
        }
        catch (Exception ex) { lblError.Text = ex.Message; }
        finally { oQuestionnaireLib = null; }
    }
    private void BindEvents()
    {
        string sUsername = "";
        try
        {
            sUsername = Membership.GetUser().UserName;
        }
        catch
        {
        }
        if (sUsername == "")
        {
            Response.Redirect("../Main_Frame.aspx");
        }
        else
        {

            BLL.UserLib oUserLib = new BLL.UserLib();
            Entity.UserInfo oUserInfo = new Entity.UserInfo();
            SqlConnClass objSqlConnClass = new SqlConnClass();
            DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
            DataSet DS = objDDClass.GetwellnessDate(sUsername);
            if (DS.Tables[0].Rows.Count > 0)
            {
                DataTable dt = new DataTable();
                DateTime datee = DateTime.Now;
                DateTime dl = datee.AddDays(-6);

                string[] dateArr = new string[DS.Tables[0].Rows.Count];
                for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    dateArr[i] = DS.Tables[0].Rows[i]["Dates"].ToString();
                }

                DateTime maxdate = Convert.ToDateTime(DS.Tables[0].Rows[0]["Dates"]);
                DateTime mindate = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count - 1]["Dates"]);
                for (int i = 0, k = 0; i < dateArr.Length; i++, k++, maxdate.AddDays(-k))
                {
                    if (Convert.ToDateTime(dateArr[i]) != maxdate.AddDays(-k))
                    {

                        for (int j = 0; Convert.ToDateTime(dateArr[i]) < maxdate.AddDays(-k); j++)
                        {
                            if (DS.Tables[0].Rows.Count < 7)
                            {
                                DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, maxdate.AddDays(-k).ToString("dddd"), maxdate.AddDays(-k), mindate.AddDays(-k).DayOfWeek);
                                k = k + j + 1;
                            }
                        }

                    }

                }

                int rcount = DS.Tables[0].Rows.Count;

                if (rcount < 7)
                {

                    for (int j = 0; j < 7 - rcount; j++)
                    {
                        int x = j + 1;
                        if (j == 0)
                        {

                            DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, mindate.AddDays(-1).ToString("dddd"), mindate.AddDays(-1), mindate.AddDays(-1).DayOfWeek);
                        }
                        else
                        {
                            DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, mindate.AddDays(-x).ToString("dddd"), mindate.AddDays(-x), mindate.AddDays(-x).DayOfWeek);
                        }

                    }

                }

                DS.AcceptChanges();

                dt = DS.Tables[0];

                // Sorting DataTable

                DataView dataView = new DataView(dt);

                dataView.Sort = " DayOfWeeks ASC";

                string expression = "Dates > '1/1/00'";

                // Sort descending by column named CompanyName.
                string sortOrder = "DayOfWeeks ASC";
                DataRow[] dr = dt.Select(expression, sortOrder);

                DateTime date = Convert.ToDateTime(dt.Rows[0]["Dates"]);

                GVdiary.DataSource = dataView;
                GVdiary.DataBind();

            }

        }
    }
    protected void OnLoggedIn(object sender, EventArgs e)
    {
        TextBox UserName = (TextBox)Login1.FindControl("UserName");
        TextBox Password = (TextBox)Login1.FindControl("Password");

        try
        {
            HttpContext.Current.Session["strUserName"] = UserName.Text.ToString().Trim();
            sendOutConfirmationEmail(UserName.Text.ToString().Trim());

            BLL.UserLib oUserLib = new BLL.UserLib();

            Session["strUserType"] = oUserLib.GetRoleNameByUserName(UserName.Text.ToString().Trim());

            Session["ChrUserType"] = oUserLib.GetUserTypeByUser(UserName.Text.ToString().Trim());

            #region Insert visited log details

            AppLib.InsertVisitedSectionDetails("Logged In");

            #endregion

            oUserLib = null;

            BLL.CompanyManager oCompanyManager;
            Entity.CompanyInfo oCompanyInfo;

            oCompanyManager = new BLL.CompanyManager();
            oCompanyInfo = new Entity.CompanyInfo();

            oCompanyInfo = oCompanyManager.GetCompanyDetailsByEmailId(AppLib.GetLoggedInUserName());
            if (oCompanyInfo != null)
                Session["intLoggedUserId"] = oCompanyInfo.IntCompanyId.ToString();

            oCompanyInfo = null;
            oCompanyManager = null;

            CheckBox cbRememberMe = (CheckBox)Login1.FindControl("cbRememberMe");

            if (cbRememberMe.Checked)
            {
                Response.Cookies.Remove("RememberMe");
                HttpCookie myCookie = new HttpCookie("RememberMe");

                myCookie.Values.Add("Email", UserName.Text.ToString().Trim());

                myCookie.Expires = DateTime.Now.AddDays(200); //you can add years and months too here
                Response.Cookies.Add(myCookie);
            }
            else
            {
                HttpCookie cookie = Request.Cookies["RememberMe"];
                if (cookie != null)
                {
                    cookie.Expires = DateTime.Now.AddDays(-1);
                    Response.Cookies.Add(cookie);
                }
            }
        }
        catch (Exception ex)
        {
        }

        //string sUsername = AppLib.GetLoggedInUserName();
        string sUsername = Membership.GetUser(UserName.Text.Trim()).UserName;

        try
        {
            if (objBackofficeClass.Mem_GET_UserInfo(sUsername).Tables[0].Rows[0]["REGISTRATION_FLG"].ToString() == "0")
            {//they have not gone through their personal registration yet

                FormsAuthentication.SignOut();// LOG USER OUT PROGRAMMATICALLY
                //Response.Redirect("/Main/UserUtilities/EditUser.aspx?username="******"Main/UserUtilities/EditUser.aspx?username="******"Password"))
            {
                //Response.Redirect("/Anonymous/ResetPassword/ResetPassword.aspx");/*Commented by Netsmartz*/

                Response.Redirect(AppConfig.GetBaseSiteUrl() + "Anonymous/ResetPassword/ResetPassword.aspx");
            }
            else if (Roles.IsUserInRole(sUsername, "Company"))
            {
                //Response.Redirect("/Anonymous/ResetPassword/ResetPassword.aspx");/*Commented by Netsmartz*/

                Response.Redirect(AppConfig.GetBaseSiteUrl() + "Company/UploadUsersForRegistration.aspx");
            }
        }
        catch (Exception ex)
        {
        }

        /*---------------------VISITLOG---------------------*/
         //   UC_Visitlog_Visitlog1.addEntry(1, 0, 0, 0, "", "", "");

        Response.Redirect(AppConfig.GetBaseSiteUrl() + "login/login_success.aspx");
    }
        /// Function Header*******************************************************
        /// Function Name: SaveUserRiskStratificationProcessDetails
        /// Function Type: Function
        /// Functionality: used to save the details of risk stratification process step 1 part A
        /// Input: 
        /// Output: 
        /// Return Value:
        /// Note: 
        /// *********************************************************************
        public int SaveUserRiskStratificationProcessDetailsStepSecond(List<Entity.QuestionnaireInfo> oListQuestionnaireInfo, Guid _guidUserId)
        {
            using (TLWDALDataContext _db = new TLWDALDataContext())
            {
                int intRetVal = 1;

                var _varQuestion = _db.UserRiskStratificationDetails.Where(x => x.guidUserId.Equals(_guidUserId)
                                                                    && x.strStratificationStep.Equals("2")
                                                                        ).ToList();
                if (_varQuestion != null)
                {
                    _db.UserRiskStratificationDetails.DeleteAllOnSubmit(_varQuestion);
                    _db.SubmitChanges();
                }

                List<DAL.UserRiskStratificationDetail> oListUserRiskStratificationDetailDAL = new List<DAL.UserRiskStratificationDetail>();

                foreach (var item in oListQuestionnaireInfo)
                {
                    DAL.UserRiskStratificationDetail oUserRiskStratificationDetail = new UserRiskStratificationDetail();
                    oUserRiskStratificationDetail.intQuestionnaireId = item.IntQuestionnaireId;
                    oUserRiskStratificationDetail.strQuestion = item.StrQuestion;
                    oUserRiskStratificationDetail.strAnswer = item.StrAnswer;
                    oUserRiskStratificationDetail.dtCreatedOn = item.DtCreatedDate;
                    oUserRiskStratificationDetail.guidUserId = _guidUserId;
                    oUserRiskStratificationDetail.strStratificationStep = "2";
                    oListUserRiskStratificationDetailDAL.Add(oUserRiskStratificationDetail);
                    oUserRiskStratificationDetail = null;
                }

                _db.UserRiskStratificationDetails.InsertAllOnSubmit(oListUserRiskStratificationDetailDAL);
                _db.SubmitChanges();
                UserLib oUserLib = new UserLib();
                oUserLib.UpdateUserStratificationStep(_guidUserId, "2");
                oUserLib = null;

                oListUserRiskStratificationDetailDAL = null;
                oListQuestionnaireInfo = null;
                return intRetVal;
            }
        }
    private void BindDetails()
    {
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        if (Request.QueryString["id"] != null)
        {
            oUserInfo = oUserLib.GetAllFAQByFaqId(Convert.ToInt32(Request.QueryString["id"]));
            if (oUserInfo != null)
            {
                ddlTopic.SelectedIndex = ddlTopic.Items.IndexOf(ddlTopic.Items.FindByText(oUserInfo.StrHeading));
                txtQuestion.Text = oUserInfo.StrQuestion;
                txtAnswer.Text = oUserInfo.StrAnswer;
            }
        }

        oUserInfo = null;
        oUserLib = null;
    }
    private void update()
    {
        string sUsername = Membership.GetUser().UserName;
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        SqlConnClass objSqlConnClass = new SqlConnClass();
        DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        DataSet DS = objDDClass.GetwellnessDate(sUsername);
        if (DS.Tables[0].Rows.Count > 0)
        {
            DataTable dt = new DataTable();

            DS.AcceptChanges();
            dt = DS.Tables[0];

            string startMonth = ddlStartMonth.SelectedValue;
            string startDay = ddlStartDay.SelectedValue; ;
            string startYear = ddlStartYear.SelectedValue;
            string endMonth = ddlEndMonth.SelectedValue;
            string endDay = ddlEndDay.SelectedValue; ;
            string endYear = ddlEndYear.SelectedValue;
            string startDate = startMonth + "/" + startDay + "/" + startYear;
            string endDate = endMonth + "/" + endDay + "/" + endYear;

            // Sorting DataTable

            string expression = "Dates >= '" + startDate + "' and Dates <= '" + endDate + "'";

            // Sort descending by column named CompanyName.
            string sortOrder = "Dates ASC";

            DataRow[] dr = dt.Select(expression, sortOrder);

            int drLength = dr.Length;

            for (int i = 0; i <= drLength - 1; i++)
            {
                DateTime fulldate = Convert.ToDateTime(dr[i]["Dates"]);
                string dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[i]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[i]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[i]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[i]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[i]["Energy"]);

                chart1.Series["Sleep"].BorderWidth = 2;
                chart1.Series["Stress"].BorderWidth = 2;
                chart1.Series["Outlook"].BorderWidth = 2;
                chart1.Series["Engagement"].BorderWidth = 2;
                chart1.Series["Energy"].BorderWidth = 2;
            }

            DataView dataView = new DataView(dt);

            dataView.RowFilter = "Dates >= '" + startDate + "' and Dates <= '" + endDate + "'";
            dataView.Sort = "Dates ASC";

            GVdiary.DataSource = dataView;
            GVdiary.DataBind();
        }
    }
    private void BindEvents()
    {
        string sUsername = Membership.GetUser().UserName;
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        SqlConnClass objSqlConnClass = new SqlConnClass();
        DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        DataSet DS = objDDClass.GetwellnessDate(sUsername);
        if (DS.Tables[0].Rows.Count > 0)
        {
            DataTable dt = new DataTable();

            DS.AcceptChanges();

            dt = DS.Tables[0];

            int count = dt.Rows.Count;

            if (count > 7)
            {

                dt.DefaultView.Sort = "Dates DESC";
                dt = dt.DefaultView.ToTable();

                DataTable top7 = dt.Clone();
                for (int i = 0; i < 7; i++)
                {
                    top7.ImportRow(dt.Rows[i]);
                }

                DataView dataView = new DataView(top7);

                dataView.Sort = "Dates ASC";
                GVdiary.DataSource = dataView;
                GVdiary.DataBind();
            }
            else
            {

                // Sorting DataTable

                DataView dataView = new DataView(dt);

                dataView.Sort = "Dates ASC";
                GVdiary.DataSource = dataView;
                GVdiary.DataBind();
            }

        }
    }
    /// Function Header*******************************************************
    /// Function Name: BindEvents
    /// Function Type: Function
    /// Functionality: used to get bind the events
    /// Input: 
    /// Output: 
    /// Return Value:
    /// Note: 
    /// *********************************************************************
    private void BindSectionVisited()
    {
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        oUserInfo.StrDateFrom = AppLib.GetBackDate();
        oUserInfo.StrDateTo = AppLib.GetFutureDate();
        if (!txtVisitedFrom.Text.Trim().Equals(string.Empty))
        {
            if (AppLib.isDateTime(txtVisitedFrom.Text.Trim()))
            {
                oUserInfo.StrDateFrom = txtVisitedFrom.Text.Trim();
                oUserInfo.StrDateTo = AppLib.GetFutureDate();
            }
            else
                oUserInfo.StrDateFrom = AppLib.GetFutureDate();
        }

        if (!txtVisitedTo.Text.Trim().Equals(string.Empty))
        {
            if (AppLib.isDateTime(txtVisitedTo.Text.Trim()))
                oUserInfo.StrDateTo = txtVisitedTo.Text.Trim();
            else
                oUserInfo.StrDateTo = AppLib.GetBackDate();
        }

        if (oUserInfo.StrDateTo.Equals(oUserInfo.StrDateFrom))
        {
            string strTodayDate = DateTime.Now.ToShortDateString();
            if (strTodayDate.Equals(oUserInfo.StrDateTo))
                oUserInfo.StrDateTo = AppLib.GetFutureDate();
        }

        oUserInfo.StrDateTo = oUserInfo.StrDateTo + " 11:59:00 PM";
        oUserInfo.StrDateFrom = oUserInfo.StrDateFrom + " 12:01:00 AM";

        oUserInfo.StrUserType = ddlUserType.SelectedValue;
        oUserInfo.StrSectionVisited = txtSectionVisited.Text.Trim();

        BLL.UserLib oUserLib = new BLL.UserLib();

        GVQuestion.DataSource = oUserLib.GetSectionVisitedDetails(oUserInfo);

        GVQuestion.DataBind();
        oUserLib = null;
        oUserInfo = null;
    }
    /// <summary>
    /// following function is used to bind the nutritional journal details
    /// </summary>
    private void BindNutritionalJournal()
    {
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        SqlConnClass objSqlConnClass = new SqlConnClass();
        DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        try
        {

        }
        catch
        { }
        finally
        {
            objSqlConnClass.CloseConnection();
            objSqlConnClass = null;
            objDDClass = null;
            oUserLib = null;
            oUserInfo = null;
        }
    }
 private void BindFAQTopics()
 {
     BLL.UserLib oUserLib = new BLL.UserLib();
     ddlTopic.DataSource = oUserLib.GetFAQTopics();
     ddlTopic.DataTextField = "StrFaqTopic";
     ddlTopic.DataValueField = "IntFAQTopicId";
     ddlTopic.DataBind();
     oUserLib = null;
 }
    private void bindChart()
    {
        string sUsername = Membership.GetUser().UserName;
        BLL.UserLib oUserLib = new BLL.UserLib();
        Entity.UserInfo oUserInfo = new Entity.UserInfo();
        SqlConnClass objSqlConnClass = new SqlConnClass();
        DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        DataSet DS = objDDClass.GetwellnessDate(sUsername);
        if (DS.Tables[0].Rows.Count > 0)
        {
            DataTable dt = new DataTable();

            DS.AcceptChanges();
            dt = DS.Tables[0];

            int noRecords = dt.Rows.Count;

            if (noRecords > 7)
            {
                DataView dataView = new DataView(dt);

                //dataView.Sort = "Dates DESC";

                string expression = "Dates > '1/1/00'";

                // Sort descending by column named CompanyName.
                string sortOrder = "Dates DESC";

                DataRow[] dr = dt.Select(expression, sortOrder);

                double sleep = new double(); ;
                double stress = new double(); ;
                double outlook = new double();
                double engagement = new double();
                double energy = new double();

                DateTime fulldate = Convert.ToDateTime(dr[6]["Dates"]);
                string dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[6]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[6]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[6]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[6]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[6]["Energy"]);

                fulldate = Convert.ToDateTime(dr[5]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[5]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[5]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[5]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[5]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[5]["Energy"]);

                fulldate = Convert.ToDateTime(dr[4]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[4]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[4]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[4]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[4]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[4]["Energy"]);

                fulldate = Convert.ToDateTime(dr[3]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[3]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[3]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[3]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[3]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[3]["Energy"]);

                fulldate = Convert.ToDateTime(dr[2]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[2]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[2]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[2]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[2]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[2]["Energy"]);

                fulldate = Convert.ToDateTime(dr[1]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[1]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[1]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[1]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[1]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[1]["Energy"]);

                fulldate = Convert.ToDateTime(dr[0]["Dates"]);
                dates = fulldate.Date.ToShortDateString();
                chart1.Series["Sleep"].Points.AddXY(dates, dr[0]["Sleep"]);
                chart1.Series["Stress"].Points.AddXY(dates, dr[0]["Stress"]);
                chart1.Series["Outlook"].Points.AddXY(dates, dr[0]["Outlook"]);
                chart1.Series["Engagement"].Points.AddXY(dates, dr[0]["Engagement"]);
                chart1.Series["Energy"].Points.AddXY(dates, dr[0]["Energy"]);

                chart1.Series["Sleep"].BorderWidth = 2;
                chart1.Series["Stress"].BorderWidth = 2;
                chart1.Series["Outlook"].BorderWidth = 2;
                chart1.Series["Engagement"].BorderWidth = 2;
                chart1.Series["Energy"].BorderWidth = 2;

            }

            else
            {

                foreach (DataRow dr in dt.Rows)
                {
                    double sleep = new double(); ;
                    double stress = new double(); ;
                    double outlook = new double();
                    double engagement = new double();
                    double energy = new double();
                    sleep = Convert.ToInt16(dr["Sleep"].ToString());
                    stress = Convert.ToInt16(dr["Stress"].ToString());
                    outlook = Convert.ToInt16(dr["Outlook"].ToString());
                    engagement = Convert.ToInt16(dr["Engagement"].ToString());
                    energy = Convert.ToInt16(dr["Energy"].ToString());

                    string dates = dr["Dates"].ToString();
                    chart1.Series["Sleep"].Points.AddXY(dates, sleep);//(dates, sleep[0]);
                    chart1.Series["Stress"].Points.AddXY(dates, stress);
                    chart1.Series["Outlook"].Points.AddXY(dates, outlook);
                    chart1.Series["Engagement"].Points.AddXY(dates, engagement);
                    chart1.Series["Energy"].Points.AddXY(dates, energy);

                    chart1.Series["Sleep"].BorderWidth = 2;
                    chart1.Series["Stress"].BorderWidth = 2;
                    chart1.Series["Outlook"].BorderWidth = 2;
                    chart1.Series["Engagement"].BorderWidth = 2;
                    chart1.Series["Energy"].BorderWidth = 2;
                }
            }
        }
    }