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 { }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser currentUser = Membership.GetUser();
        AccountClass objAccountClass;
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);
        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User"))
                {
                    string strTemp = DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString();
                    if (DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString().Equals(string.Empty) || DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString() != "6")
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep1.aspx?id=" + AppLib.Encrypt(currentUser.UserName), true);
                }
            }
        }

        DS = null;

        objTemplateClass = new TemplateClass(objSqlConnClass.OpenConnection());
    }
    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 Page_Load(object sender, EventArgs e)
 {
     objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
     {
         fillName();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (AppLib.IsLoggedinSessionExists())
        {
            #region Insert visited log details

            AppLib.InsertVisitedSectionDetails("Back Office Home page");

            #endregion
        }
        else
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/Main_Frame.aspx", true);

        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());

        //if (Request.QueryString["register"] != null)
        //{
        //    IFRAME_CONTENT.Attributes.Remove("src");
        //    IFRAME_CONTENT.Attributes.Add("src", "UserUtilities/CreateUser.aspx");
        //}
        //if (!IsPostBack)
        //{
        //    fillOutForm();
        //}
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objBackofficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);
        objReportClass = new ReportClass(objSqlConnClass.sqlConnection);

        giYearCurrent = System.DateTime.Now.Year;
        giMonthCurrent = System.DateTime.Now.Month;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        hdSiteUrl.Value = AppConfig.GetBaseSiteUrl();
        string strScript = "<script type='text/javascript'>function load(sUrl) { document.getElementById(iframeName).src = '" + AppConfig.GetBaseSiteUrl() + "' + sUrl; } </script>";

        this.Page.RegisterClientScriptBlock("abc", strScript);

        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
    }
    public DropDownList fillDropDown(DropDownList DropDownList1, string sListName, string sTableName)
    {
        BackofficeClass objBackofficeClass = new BackofficeClass(sqlConn);

        DropDownList1.DataSource = objBackofficeClass.GET_Items_AnyItemTable(sListName, sTableName);
        DropDownList1.DataTextField = "ITEM_TEXT";
        DropDownList1.DataValueField = "ITEM_VALUE";
        DropDownList1.DataBind();

        return DropDownList1;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objPALClass = new PALClass(objSqlConnClass.OpenConnection());
        objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        gsUserID = Membership.GetUser().ProviderUserKey.ToString();

        ///////RadChart settings//////
        int iDdDays = giChartDaySpan;
        int iPalDays = giChartDaySpan;

        DataSet DS = objDDClass.DD_GET_DdEntries_BY_UserId(gsUserID,"","");
        if (DS.Tables[0].Rows.Count > 2)
        {
            DateTime dStart = Convert.ToDateTime(DS.Tables[0].Rows[0]["DD_ENTRY_DATE"]);
            DateTime dEnd = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count -1]["DD_ENTRY_DATE"]);
            TimeSpan TS = dStart - dEnd;
            iDdDays = TS.Days;
            if (TS.Days < giChartDaySpan)
            {
                giChartDaySpan = TS.Days;
            }
        }
        DS = objPALClass.PAL_GET_PalEntries_BY_UserId(gsUserID, "", "");
        if (DS.Tables[0].Rows.Count > 2)
        {
            DateTime dStart = Convert.ToDateTime(DS.Tables[0].Rows[0]["PAL_ENTRY_DATE"]);
            DateTime dEnd = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count -1]["PAL_ENTRY_DATE"]);
            TimeSpan TS = dStart - dEnd;
            iPalDays = TS.Days;
        }

        if (iPalDays < iDdDays)
        {
            if (iDdDays < giChartDaySpan)
            {
                giChartDaySpan = iDdDays;
            }
        }
        else
        {
            if (iPalDays < giChartDaySpan)
            {
                giChartDaySpan = iPalDays;
            }
        }

        ///////RadChart settings//////
    }
    protected void lnkbtnSave_Click(object sender, EventArgs e)
    {
        BackofficeClass objBackOfficeClass = new BackofficeClass();
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());

        BLL.HotSectionDetailsLib oHotSectionDetailsLib = null;
        Entity.HotSectionDetailsInfo oHotSectionDetailsInfo = null;
        try
        {

            oHotSectionDetailsInfo = new Entity.HotSectionDetailsInfo();
            if (txtHeading.Text.Length > 500)
                oHotSectionDetailsInfo.StrHeading = txtHeading.Text.Substring(0, 498);
            else
                oHotSectionDetailsInfo.StrHeading = txtHeading.Text.Trim();

            oHotSectionDetailsInfo.StrDescription = txtDescription.Text.Trim();
            oHotSectionDetailsInfo.DtCreatedOn = DateTime.Now;
            oHotSectionDetailsInfo.StrLink = string.Empty;
            oHotSectionDetailsInfo.ChrIsDeleted = 'N';
            oHotSectionDetailsInfo.ChrDisplayOnDashboard = 'Y';
            oHotSectionDetailsInfo.GuidUserId = new Guid(DS.Tables[0].Rows[0]["USER_ID"].ToString());
            oHotSectionDetailsLib = new BLL.HotSectionDetailsLib();
            if (ViewState["IntHotSectionId"] != null)
            {
                oHotSectionDetailsInfo.IntHotSectionId = Convert.ToInt32(ViewState["IntHotSectionId"]);
                ViewState["IntHotSectionId"] = null;
                if (oHotSectionDetailsLib.UpdateHotSectionDetails(oHotSectionDetailsInfo) > 0)
                    Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/UserUtilities/ManageHotLinks.aspx?msg=up");
                else
                    lblMsg.Text = "Record already exists.";
            }
            else
            {
                if (oHotSectionDetailsLib.SaveHotSectionDetails(oHotSectionDetailsInfo) > 0)
                    Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/UserUtilities/ManageHotLinks.aspx?msg=ins");
                else
                    lblMsg.Text = "Record already exists.";
            }
        }
        catch (Exception ex) { lblMsg.Text = ex.Message; }
        finally
        {
            DS = null;
            objBackOfficeClass = null;
            oHotSectionDetailsInfo = null;
            oHotSectionDetailsLib = null;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        objForumClass = new ForumClass(objSqlConnClass.sqlConnection);

        if (Request.QueryString["register"] != null)
        {
            IFRAME_CONTENT.Attributes.Remove("src");
            IFRAME_CONTENT.Attributes.Add("src", "UserUtilities/CreateUser.aspx");
        }
        //if (!IsPostBack)
        {
            fillOutForm();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (AppLib.IsLoggedinSessionExists())
        {
            #region Insert visited log details

            AppLib.InsertVisitedSectionDetails("Edit User");

            #endregion
        }
        else
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/Main_Frame.aspx", true);

        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string strScript = "<script type='text/javascript'>function load(sUrl) { document.getElementById(iframeName).src = '" + AppConfig.GetBaseSiteUrl() + "' + sUrl; } </script>";
        this.Page.RegisterClientScriptBlock("abc", strScript);
        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        objForumClass = new ForumClass(objSqlConnClass.sqlConnection);

        if (Request.QueryString["register"] != null)
        {
            IFRAME_CONTENT.Attributes.Remove("src");
            IFRAME_CONTENT.Attributes.Add("src","UserUtilities/CreateUser.aspx");
        }
        //if (!IsPostBack)
        {
            fillOutForm();
        }
    }
    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 { }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());

        if (!this.Page.IsPostBack)
        {

            if (Request.QueryString["msg"] != null)
            {
                if (Request.QueryString["msg"].ToString().Equals("ins"))
                    lblMsg.Text = "User created successfully.";
                else if (Request.QueryString["msg"].ToString().Equals("up"))
                    lblMsg.Text = "User information has beed updated successfully.";
                else if (Request.QueryString["msg"].ToString().Equals("del"))
                    lblMsg.Text = "User has beed deleted successfully.";

            }
        }
    }
    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 Page_Load(object sender, EventArgs e)
    {
        MembershipUser currentUser = Membership.GetUser();
        if (!AppLib.IsLoggedinSessionExists() || currentUser == null)
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true);

        objSqlConnClass.OpenConnection();

        AccountClass objAccountClass;
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);
        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);

        #region Insert visited log details

        //AppLib.InsertVisitedSectionDetails("Dashboard Page");

        #endregion

        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User"))
                {
                    if (DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString().Equals(string.Empty) || DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString() != "6")
                    {
                        DS = null;
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep1.aspx?id=" + AppLib.Encrypt(currentUser.UserName), true);
                    }
                }
            }
        }

        DS = null;

        objTemplateClass = new TemplateClass(objSqlConnClass.sqlConnection);

        objPALClass = new PALClass(objSqlConnClass.sqlConnection);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objPALClass = new PALClass(objSqlConnClass.OpenConnection());
        objBackofficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);

        div1.Style.Add("display", "none");
        div2.Style.Add("display", "none");
        div2_5.Style.Add("display", "none");
        //div3.Style.Add("display", "none");
        BindImages();
        if (ViewState["gsLevelID"] != null)
        {
            gsLevelID = ViewState["gsLevelID"].ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";
        try
        {
            if (AppLib.GetCurrentUserType().ToLower().ToString().Equals("c"))
            {
                trStatus.Visible = false;
                trApprovedStatus.Visible = false;
                lnkBtnBack.Visible = false;
            }

            objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            if (!IsPostBack)
            {
                BindCountry();
                BindCompanyDetails();
            }
        }
        catch { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        fillNames();
        if (!AppLib.IsLoggedinSessionExists())
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/Main_Frame.aspx", true);
        MembershipUser currentUser = Membership.GetUser();
        Roles.GetRolesForUser(HttpContext.Current.User.Identity.Name);
        //string strScript = "<script type='text/javascript'>function load(sUrl) { document.getElementById(iframeName).src = '" + AppConfig.GetBaseSiteUrl() + "' + sUrl; } </script>";
        //this.Page.RegisterClientScriptBlock("abc", strScript);
        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        objForumClass = new ForumClass(objSqlConnClass.sqlConnection);

        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        DataSet DS = objBackOfficeClass.Mem_GET_Admin(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("Administrator"))
                {
                    if (Session["popup"] != null)
                    {
                        bool pop = (bool)Session["popup"];

                        if (pop)
                        {
                            BLL.CompanyManager oCompanyManager = new BLL.CompanyManager();
                            int no = oCompanyManager.GetQuestion();
                            // string Script = "jConfirm('You have " + no + " unanswered HealthCoach Message !  Click Ok to answer them', 'HealthCoach Message',function(r) {alert(r);});";

                            if (no != 0)
                            {

                                string Script = "jConfirm('You have " + no + " unanswered HealthCoach Message !  Click Ok to see them', 'HealthCoach Message',function(r) { if(r) {window.location.href = '../Backoffice/UserUtilities/ManageQuestionforHealthCoach.aspx';}});";
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", Script, true);
                                Session["popup"] = false;
                                Response.Redirect("../Backoffice/UserUtilities/ManageQuestionforHealthCoach.aspx");
                            }
                        }
                        else
                        {
                            Session.Remove(Session["popup"].ToString());
                        }
                    }
                    else
                    {

                    }
                }

                else
                {
                    if (Session["popup"] != null)
                    {
                        bool pop = (bool)Session["popup"];

                        if (pop)
                        {
                            BLL.CompanyManager oCompanyManagers = new BLL.CompanyManager();
                            int no = oCompanyManagers.GetAnswers(currentUser.UserName);
                            if (no != 0)
                            {
                                string Script = "jConfirm('You have " + no + " answered HealthCoach Message !  Click Ok to see them', 'HealthCoach Message',function(r) { if(r) {window.location.href = '../Users/MyAskedQuestions.aspx';}});";
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", Script, true);
                                Session["popup"] = false;
                            }
                        }
                        else
                        {
                            Session.Remove(Session["popup"].ToString());
                        }
                    }
                    else
                    {

                    }
                }
            }
        }

        //if (Request.QueryString["register"] != null)
        //{
        //    IFRAME_CONTENT.Attributes.Remove("src");
        //    IFRAME_CONTENT.Attributes.Add("src", "UserUtilities/CreateUser.aspx");
        //}

        //if (!IsPostBack)
        {
            fillOutForm();
        }

        //if (HttpContext.Current.User.IsInRole("Administrator"))
        //{

        //    if (Session["popup"] != null)
        //    {
        //        bool pop = (bool)Session["popup"];

        //        if (pop)
        //        {
        //            BLL.CompanyManager oCompanyManager = new BLL.CompanyManager();
        //            int no = oCompanyManager.GetQuestion();
        //            string Script = "jConfirm('You have " + no + " unanswered HealthCoach Message !  Click Ok to answer them', 'HealthCoach Message',function(r) { if(r) {window.location.href = '../Backoffice/UserUtilities/ManageQuestionforHealthCoach.aspx';}});";
        //            ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseWindow", Script, true);
        //            Session["popup"] = false;
        //        }
        //        else
        //        {
        //            Session.Remove(Session["popup"].ToString());
        //        }
        //    }
        //    else
        //    {

        //    }
        //}
        //else
        //{

        //}
    }
    private void fillNames()
    {
        string usr = "";
        try
        {
            MembershipUser currentUsers = Membership.GetUser();
            BackofficeClass objBackOfficeClass;
            objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            DataSet DS = objBackOfficeClass.Mem_GET_Admin(currentUsers.UserName);
            if (DS != null)
            {
                if (DS.Tables[0].Rows.Count > 0)
                {
                    usr = DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User").ToString();
                    if (usr == "True")
                    {
                        usr = "******";
                    }
                }
            }

            lblName.Text = "Guest";

            lblLogout.Text = "<a style='text-decoration: underline;color:white;' href='" + AppConfig.GetBaseSiteUrl() + "login/logout.aspx'>Logout</a>";
            if (Membership.GetUser() != null)
            { //lblEdit.Text = "<a class='small' href=\"javascript:load('/main/UserUtilities/EditUser.aspx');\">My Account</a> <span style=font-weight:normal;>|</span> ";
                lblEdit.Text = "<a style='color:white; Font:inherit;'   href=\"" + AppConfig.GetBaseSiteUrl() + "BackOffice/UserUtilities/UserAccount.aspx?src=" + usr + "\">My Account</a> <span style=font-weight:normal;></span> ";
                /* Above line is commented by Netsmartz*/
                //lblLogout.Text = "<a class='small' href='/login/logout.aspx'>Logout</a>"; /*Commented By Netsmartz*/
                lblLogout.Text = "<a style='text-decoration: underline;color:white;' href='" + AppConfig.GetBaseSiteUrl() + "login/logout.aspx'>Logout</a>";

                string sUsername = Membership.GetUser().UserName;
                DS = objBackofficeClass.Mem_GET_UserInfo(sUsername);
                if (DS != null)
                    lblName.Text = DS.Tables[0].Rows[0]["FNAME"].ToString() + " " + DS.Tables[0].Rows[0]["LNAME"].ToString();

            }
        }
        catch { }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";

        try
        {
            //    Response.Write(AppLib.Encrypt("1"));
            /*DateTime dtTodayDate = DateTime.Now;
            DateTime dtBDate = Convert.ToDateTime("16/06/1983");
            Response.Write(dtTodayDate - dtBDate);*/

            objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            objUsersClass = new UsersClass(objSqlConnClass.sqlConnection);

            if (ViewState["gsAccountFrom"] != null)
            {
                gsAccountFrom = ViewState["gsAccountFrom"].ToString();
            }

            if (Request.QueryString["cid"] != null && Request.QueryString["id"] != null)
            {
                BindCompanyDetails();
                /*TextBox txtOrganization = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtOrganization");
                txtOrganization.Attributes.Add("Readonly", "true");*/
            }

            if (!IsPostBack)
            {
                BindCompanyControl();
                giShowReceipt = 1;
                giSendEmail = 1;
                CreateUserWizard1.FinishDestinationPageUrl = "/";
                CreateUserWizard1.LoginCreatedUser = false;

                //////////////////////////////////////////////////////////
                //Taking the List of Items in DataSets from the Database
                //////////////////////////////////////////////////////////

                // DataSet DegreeDS =

                DataSet StateDS = objBackofficeClass.GET_Items_AnyItemTable("State", "List_StateCountry");
                DataSet CountryDS = objBackofficeClass.GET_Items_AnyItemTable("Country", "List_StateCountry");

                ///////////////////////////////////////////////////////////////////////////////////////
                //Assigning the DropDownList objects by finding the controls from the createuserwizard
                ////////////////////////////////////////////////////////////////////////////////////////

                DropDownList ddlDegree = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlDegree");
                DropDownList ddlYourRole = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlYourRole");
                DropDownList ddlState = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlState");
                DropDownList ddlCountry = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlCountry");
                DropDownList ddlAccountFromRelationship = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlAccountFromRelationship");
                DropDownList ddlGender = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlGender");
                DropDownList ddlFamilyStatus = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlFamilyStatus");

                /////////////////////////////
                //Binding the DropDownLists
                ////////////////////////////

                ddlDegree = objSqlConnClass.fillDropDown(ddlDegree, "Degree", "List_Items");
                ddlYourRole = objSqlConnClass.fillDropDown(ddlYourRole, "Your Role", "List_Items");
                ddlAccountFromRelationship = objSqlConnClass.fillDropDown(ddlAccountFromRelationship, "Account From Relationship", "List_Items");
                ddlGender = objSqlConnClass.fillDropDown(ddlGender, "Gender", "List_Items");
                ddlFamilyStatus = objSqlConnClass.fillDropDown(ddlFamilyStatus, "Family Status", "List_Items");

                BindDropDownList(ddlState, StateDS);
                BindDropDownList(ddlCountry, CountryDS);
            }
        }
        catch (Exception ex) { }
        finally
        {
            objSqlConnClass.CloseConnection();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        gaDates = new string[giArraySize, 4];

        objPALClass = new PALClass(objSqlConnClass.OpenConnection());
        objDDClass = new DDClass(objSqlConnClass.OpenConnection());
        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        gsUserID = Membership.GetUser().ProviderUserKey.ToString();

        ///////RadChart settings/////

        giChartDaySpan = 180;
        if (rbDays1Month.Checked) { giChartDaySpan = 30; }
        else if (rbDays3Month.Checked) { giChartDaySpan = 90; }
        else{ giChartDaySpan = 180; }

        if (rbViewDaily.Checked) { giChartAverageView = 1; }
        else if (rbViewWeekly.Checked) { giChartAverageView = 7; }
        else if (rbViewMonthly.Checked) { giChartAverageView = 30; }

        int iDdDays = giChartDaySpan;
        int iPalDays = giChartDaySpan;

        /*
        DataSet DS = objDDClass.DD_GET_DdEntries_BY_UserId(gsUserID, "", "");
        if (DS.Tables[0].Rows.Count > 2)
        {
            //foreach(DataRow DR in DS.Tables[0].Rows

            DateTime dStart = Convert.ToDateTime(DS.Tables[0].Rows[0]["DD_ENTRY_DATE"]);
            DateTime dEnd = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count - 1]["DD_ENTRY_DATE"]);
            TimeSpan TS = dStart - dEnd;
            iDdDays = TS.Days;
        }
        DS = objPALClass.PAL_GET_PalEntries_BY_UserId(gsUserID, "", "");
        if (DS.Tables[0].Rows.Count > 2)
        {
            DateTime dStart = Convert.ToDateTime(DS.Tables[0].Rows[0]["PAL_ENTRY_DATE"]);
            DateTime dEnd = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count - 1]["PAL_ENTRY_DATE"]);
            TimeSpan TS = dStart - dEnd;
            iPalDays = TS.Days;
        }

        if (iPalDays < iDdDays)
        {
            if (iDdDays < giChartDaySpan)
            {
                giChartDaySpan = iDdDays;
            }
        }
        else
        {
            if (iPalDays < giChartDaySpan)
            {
                giChartDaySpan = iPalDays;
            }
        }

        if (rbDays1Month.Checked) { giChartDaySpan = 30; }
        else if (rbDays3Month.Checked) { giChartDaySpan = 90; }
        else { giChartDaySpan = 180; }
         */
           // Response.Write(giChartDaySpan.ToString());

        /*
         if (giChartDaySpan / 12 * 12 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 12; }
         else if (giChartDaySpan / 13 * 13 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 13; }
         else if (giChartDaySpan / 14 * 14 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 14; }
         else if (giChartDaySpan / 15 * 15 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 15; }
         else if (giChartDaySpan / 16 * 16 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 16; }
         else if (giChartDaySpan / 17 * 17 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 17; }
         else if (giChartDaySpan / 18 * 18 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 18; }
         else if (giChartDaySpan / 19 * 19 == giChartDaySpan) { RadChart1.PlotArea.XAxis.LabelStep = 19; }
         * */
        ///////RadChart settings//////
    }
    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; }
    }
    /// <summary>
    /// following function is used to check whether the current logged in user is male or female
    /// </summary>
    private void FindLoggedInUserGender()
    {
        string strEmailId = AppLib.Decrypt(Request.QueryString["id"].ToString());
        objBackOfficeClass = new BackofficeClass();
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(strEmailId);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
                intGenderID = Convert.ToInt32(DS.Tables[0].Rows[0]["GENDER_ID"]);
        }

        DS = null;
        objBackOfficeClass = null;
    }
    /// <summary>
    /// following function is used to bind the personal summary details.
    /// </summary>
    private void BindPersonalSummaryDetails()
    {
        lblCurrentPersonalSummary.Text = DateTime.Now.ToShortDateString();
        BLL.PersonalSummaryLib oPersonalSummaryLib = null;
        Entity.PersonalSummaryInfo oPersonalSummaryInfo = null;
        BackofficeClass objBackOfficeClass = new BackofficeClass();
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
        try
        {
            oPersonalSummaryLib = new BLL.PersonalSummaryLib();
            oPersonalSummaryInfo = new Entity.PersonalSummaryInfo();

            oPersonalSummaryInfo = oPersonalSummaryLib.GetPersonalSummaryDetailsByUserId(new Guid(DS.Tables[0].Rows[0]["USER_ID"].ToString()));
            if (oPersonalSummaryInfo != null)
            {
                ViewState["isExists"] = "1";

                lblStartDatePersonalSummary.Text = oPersonalSummaryInfo.DtModifiedOn.ToShortDateString();
                txtStartWeight.Text = oPersonalSummaryInfo.DecWeight.ToString("00.00");
                txtStartWaistToHips.Text = oPersonalSummaryInfo.DecWaistToHip.ToString("00.00");
                txtStartWaistToHeight.Text = oPersonalSummaryInfo.DecWaistToHeight.ToString("00.00");
                txtStartWaist.Text = oPersonalSummaryInfo.DecWaist.ToString("00.00");
                txtStartBodyFAT.Text = oPersonalSummaryInfo.DecBodyFATPercentage.ToString("00.00");
                txtStartBMI.Text = oPersonalSummaryInfo.DecBMI.ToString("00.00");
            }
            else
                ViewState["isExists"] = "0";
        }
        catch (Exception ex) { throw ex; }
        finally
        {
            oPersonalSummaryLib = null;
            oPersonalSummaryInfo = null;
            objBackOfficeClass = null;
            DS = null;
        }
    }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            bool blnIsChecked = false;

            foreach (GridViewRow gvRow in GVQuestionnaire.Rows)
            {
                RadioButtonList rdoListAnswer = (RadioButtonList)gvRow.FindControl("rdoListAnswer");
                if (!blnIsChecked)
                {
                    if (rdoListAnswer != null)
                    {
                        if (rdoListAnswer.SelectedValue.Equals("Yes"))
                        {
                            blnIsChecked = true;
                            break;
                        }
                    }
                }
                else
                {
                    break;
                }
            }

            if (blnIsChecked)
            {
                if (!chkWaiverAgreement.Checked)
                {
                    lblError.Text = "Please accept the waiver agreement";
                    return;
                }
                else
                {
                    List<Entity.QuestionnaireInfo> oListQuestionnaireInfo = new List<Entity.QuestionnaireInfo>();

                    foreach (GridViewRow gvr in GVQuestionnaire.Rows)
                    {
                        Entity.QuestionnaireInfo oQuestionnaireInfo = new Entity.QuestionnaireInfo();
                        oQuestionnaireInfo.DtCreatedDate = DateTime.Now;
                        Label lblQuestionId = (Label)gvr.FindControl("lblQuestionId");
                        Label lblQuestion = (Label)gvr.FindControl("lblQuestion");
                        RadioButtonList rdoListAnswer = (RadioButtonList)gvr.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;
                    }

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

                            DS = null;
                            objBackOfficeClass = null;
                            oListQuestionnaireInfo = null;
                            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep2.aspx?id=" + Request.QueryString["id"].ToString());
                        }
                    }
                }
            }

            else
            {
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep2.aspx?id=" + Request.QueryString["id"].ToString());
            }

        }

        catch (Exception ex) { lblError.Text = ex.Message; }
    }
Esempio n. 28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     hdSiteUrl.Value = AppConfig.GetBaseSiteUrl();
     objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
 }
    private void UpdatePersonalSummaryDetails()
    {
        BackofficeClass objBackOfficeClass = new BackofficeClass();
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
        BLL.PersonalSummaryLib oPersonalSummaryLib = null;
        Entity.PersonalSummaryInfo oPersonalSummaryInfo = null;
        try
        {
            oPersonalSummaryLib = new BLL.PersonalSummaryLib();
            oPersonalSummaryInfo = new Entity.PersonalSummaryInfo();

            oPersonalSummaryInfo.DecBMI = Convert.ToDecimal(txtCurrentBMI.Text);
            oPersonalSummaryInfo.DecBodyFATPercentage = Convert.ToDecimal(txtCurrentBodyFAT.Text);
            oPersonalSummaryInfo.DecWaist = Convert.ToDecimal(txtCurrentWaist.Text);
            oPersonalSummaryInfo.DecWaistToHeight = Convert.ToDecimal(txtCurrentWaistToHeight.Text);
            oPersonalSummaryInfo.DecWaistToHip = Convert.ToDecimal(txtCurrentWaistToHips.Text);
            oPersonalSummaryInfo.DecWeight = Convert.ToDecimal(txtCurrentWeight.Text);
            oPersonalSummaryInfo.DtCreatedOn = DateTime.Now;
            oPersonalSummaryInfo.GuidUserId = new Guid(DS.Tables[0].Rows[0]["USER_ID"].ToString());
            oPersonalSummaryLib.SavePersonalSummaryDetails(oPersonalSummaryInfo);
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Main/MyNutrition.aspx?msg=up");

        }
        catch (Exception ex) { throw ex; }
        finally
        {
            oPersonalSummaryInfo = null;
            oPersonalSummaryLib = null;
            objBackOfficeClass = null;
            DS = null;

        }
    }
    protected void lnkCalculateScore_Click(object sender, EventArgs e)
    {
        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;
                        }
                    }
                }
            }

            //   Response.Write(intNegativeRiskFactor.ToString());

            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());

            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;

            //lblTotalScore.Text = "Your Score:" + " " + intScore.ToString();
        }
        catch { }
        finally { }
    }