protected void Page_Load(object sender, EventArgs e) { SqlConnClass objSqlConnClass = new SqlConnClass(); TextAreaClass objTextAreaClass; objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DSCMS = objTextAreaClass.TxA_Get_TextAreas(Request.QueryString["cmstype"].ToString(), "2"); try { if (DSCMS.Tables[0].Rows.Count > 0)//There needs to be at least 1 row { lblTextAreaHtml.Text = DSCMS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); lblHeading.Text = DSCMS.Tables[0].Rows[0]["strDefaultName"].ToString(); #region Insert visited log details AppLib.InsertVisitedSectionDetails(lblHeading.Text); #endregion } } catch { } finally { objSqlConnClass.CloseConnection(); objSqlConnClass = null; objTextAreaClass = null; DSCMS = null; } }
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 { } }
private void fillOutForm() { SqlConnClass objSqlConnClass = new SqlConnClass(); FoodExchangeClass objFoodExchangeClass = new FoodExchangeClass(objSqlConnClass.OpenConnection()); literalFoodExchange.Text = objFoodExchangeClass.GetFoodExchangeTable(); objSqlConnClass.CloseConnection(); }
private void BindCMSText() { TextAreaClass objTextAreaClass; SqlConnClass objSqlConnClass = new SqlConnClass(); objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DS = objTextAreaClass.TxA_Get_TextAreas("ToolsResources", "1"); lblToolsResources.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); DS = null; objTextAreaClass = null; objSqlConnClass = null; }
private void BindCMSText() { TextAreaClass objTextAreaClass; SqlConnClass objSqlConnClass = new SqlConnClass(); objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DS = objTextAreaClass.TxA_Get_TextAreas("ActivityCalendar", "1"); lblActivitycalender.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); DS = null; objTextAreaClass = null; objSqlConnClass = null; }
private void BindCMSText_Pro() { TextAreaClass objTextAreaClass; SqlConnClass objSqlConnClass = new SqlConnClass(); objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DS = objTextAreaClass.TxA_Get_TextAreas("Meal_Proteins", "1"); lblPROTEINS.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); DS = null; objTextAreaClass = null; objSqlConnClass = null; }
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) { //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(); }
private void BindCMSText() { TextAreaClass objTextAreaClass; SqlConnClass objSqlConnClass = new SqlConnClass(); objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DS = objTextAreaClass.TxA_Get_TextAreas("DailyCaloricRequirement", "2"); lblDCRequirmentHTMLText.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); DS = objTextAreaClass.TxA_Get_TextAreas("DailyCaloricRequirementHowActiveAreYou", "2"); lblActiveAreYouHTMLText.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); /* if (DS.Tables[0].Rows[0]["TextAreaHTML"].ToString().Length > 100) { lblDCRequirmentHTMLText.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString().Substring(0, 100); } else { lblDCRequirmentHTMLText.Text = DS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); }*/ DS = null; objTextAreaClass = null; objSqlConnClass = 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()); 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; } }
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; } } } }
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(); } } }
/// <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 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 bindChart() { double[] avg = new double[1]; avg[0] = valsleep; double[] avgstress = new double[1]; avgstress[0] = valstres; double[] avgoutlook = new double[1]; avgoutlook[0] = valoutlook; double[] avgengagement = new double[1]; avgengagement[0] = valengagement; double[] avgenergy = new double[1]; avgenergy[0] = valenergy; chart1.Series["Average"].Points[0].YValues = avg; chart1.Series["Average"].Points[1].YValues = avgstress; chart1.Series["Average"].Points[2].YValues = avgoutlook; chart1.Series["Average"].Points[3].YValues = avgengagement; chart1.Series["Average"].Points[4].YValues = avgenergy; 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(); 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)); 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]; foreach (DataRow dr in dt.Rows) { string day = dr["Day"].ToString().Trim().ToLower(); switch (day) { case "monday": double[] mon = new double[1]; double[] monstress = new double[1]; double[] outlook = new double[1]; double[] engagement = new double[1]; double[] energy = new double[1]; mon[0] = Convert.ToInt16(dr["Sleep"].ToString()); monstress[0] = Convert.ToInt16(dr["Stress"].ToString()); outlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); engagement[0] = Convert.ToInt16(dr["Engagement"].ToString()); energy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (mon[0] == -1 || monstress[0] == -1 || outlook[0] == -1 || engagement[0] == -1 || energy[0] == -1) { mon[0] = 0; monstress[0] = 0; outlook[0] = 0; engagement[0] = 0; energy[0] = 0; } else { chart1.Series["Monday"].Points[0].YValues = mon; chart1.Series["Monday"].Points[1].YValues = monstress; chart1.Series["Monday"].Points[2].YValues = outlook; chart1.Series["Monday"].Points[3].YValues = engagement; chart1.Series["Monday"].Points[4].YValues = energy; } break; case "tuesday": double[] tues = new double[1]; double[] tuestress = new double[1]; double[] tuesoutlook = new double[1]; double[] tuesengament = new double[1]; double[] tuesenergy = new double[1]; tues[0] = Convert.ToInt16(dr["Sleep"].ToString()); tuestress[0] = Convert.ToInt16(dr["Stress"].ToString()); tuesoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); tuesengament[0] = Convert.ToInt16(dr["Engagement"].ToString()); tuesenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (tues[0] == -1 || tuestress[0] == -1 || tuesoutlook[0] == -1 || tuesengament[0] == -1 || tuesenergy[0] == -1) { tues[0] = 0; tuestress[0] = 0; tuesoutlook[0] = 0; tuesengament[0] = 0; tuesenergy[0] = 0; } else { chart1.Series["Tuesday"].Points[0].YValues = tues; chart1.Series["Tuesday"].Points[1].YValues = tuestress; chart1.Series["Tuesday"].Points[2].YValues = tuesoutlook; chart1.Series["Tuesday"].Points[3].YValues = tuesengament; chart1.Series["Tuesday"].Points[4].YValues = tuesenergy; } break; case "wednesday": double[] wed = new double[1]; double[] wedstress = new double[1]; double[] wedoutlook = new double[1]; double[] wedengage = new double[1]; double[] wedenergy = new double[1]; wed[0] = Convert.ToInt16(dr["Sleep"].ToString()); wedstress[0] = Convert.ToInt16(dr["Stress"].ToString()); wedoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); wedengage[0] = Convert.ToInt16(dr["Engagement"].ToString()); wedenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (wed[0] == -1 || wedstress[0] == -1 || wedoutlook[0] == -1 || wedengage[0] == -1 || wedenergy[0] == -1) { wed[0] = 0; wedstress[0] = 0; wedoutlook[0] = 0; wedengage[0] = 0; wedenergy[0] = 0; } else { chart1.Series["Wednesday"].Points[0].YValues = wed; chart1.Series["Wednesday"].Points[1].YValues = wedstress; chart1.Series["Wednesday"].Points[2].YValues = wedoutlook; chart1.Series["Wednesday"].Points[3].YValues = wedengage; chart1.Series["Wednesday"].Points[4].YValues = wedenergy; } break; case "thursday": double[] turs = new double[1]; double[] turstress = new double[1]; double[] tursoutlook = new double[1]; double[] tursengage = new double[1]; double[] tursenergy = new double[1]; turs[0] = Convert.ToInt16(dr["Sleep"].ToString()); turstress[0] = Convert.ToInt16(dr["Stress"].ToString()); tursoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); tursengage[0] = Convert.ToInt16(dr["Engagement"].ToString()); tursenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (turs[0] == -1 || turstress[0] == -1 || tursoutlook[0] == -1 || tursengage[0] == -1 || tursenergy[0] == -1) { turs[0] = 0; turstress[0] = 0; tursoutlook[0] = 0; tursengage[0] = 0; tursenergy[0] = 0; } else { chart1.Series["Thursday"].Points[0].YValues = turs; chart1.Series["Thursday"].Points[1].YValues = turstress; chart1.Series["Thursday"].Points[2].YValues = tursoutlook; chart1.Series["Thursday"].Points[3].YValues = tursengage; chart1.Series["Thursday"].Points[4].YValues = tursenergy; } break; case "friday": double[] xpoint = new double[1]; double[] xpointstress = new double[1]; double[] xpointoutlook = new double[1]; double[] xpointengage = new double[1]; double[] xpointenergy = new double[1]; xpoint[0] = Convert.ToInt16(dr["Sleep"].ToString()); xpointstress[0] = Convert.ToInt16(dr["Stress"].ToString()); xpointoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); xpointengage[0] = Convert.ToInt16(dr["Engagement"].ToString()); xpointenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (xpoint[0] == -1 || xpointstress[0] == -1 || xpointoutlook[0] == -1 || xpointengage[0] == -1 || xpointenergy[0] == -1) { xpoint[0] = 0; xpointstress[0] = 0; xpointoutlook[0] = 0; xpointengage[0] = 0; xpointenergy[0] = 0; } else { chart1.Series["Friday"].Points[0].YValues = xpoint; chart1.Series["Friday"].Points[1].YValues = xpointstress; chart1.Series["Friday"].Points[2].YValues = xpointoutlook; chart1.Series["Friday"].Points[3].YValues = xpointengage; chart1.Series["Friday"].Points[4].YValues = xpointenergy; } break; case "saturday": double[] sat = new double[1]; double[] satress = new double[1]; double[] satoutlook = new double[1]; double[] satengagement = new double[1]; double[] satenergy = new double[1]; sat[0] = Convert.ToInt16(dr["Sleep"].ToString()); satress[0] = Convert.ToInt16(dr["Stress"].ToString()); satoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); satengagement[0] = Convert.ToInt16(dr["Engagement"].ToString()); satenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (sat[0] == -1 || satress[0] == -1 || satoutlook[0] == -1 || satengagement[0] == -1 || satenergy[0] == -1) { sat[0] = 0; satress[0] = 0; satoutlook[0] = 0; satengagement[0] = 0; satenergy[0] = 0; } else { chart1.Series["Saturday"].Points[0].YValues = sat; chart1.Series["Saturday"].Points[1].YValues = satress; chart1.Series["Saturday"].Points[2].YValues = satoutlook; chart1.Series["Saturday"].Points[3].YValues = satengagement; chart1.Series["Saturday"].Points[4].YValues = satenergy; } break; case "sunday": double[] sun = new double[1]; double[] sunstress = new double[1]; double[] sunoutlook = new double[1]; double[] sunengage = new double[1]; double[] sunenergy = new double[1]; sun[0] = Convert.ToInt16(dr["Sleep"].ToString()); sunstress[0] = Convert.ToInt16(dr["Stress"].ToString()); sunoutlook[0] = Convert.ToInt16(dr["Outlook"].ToString()); sunengage[0] = Convert.ToInt16(dr["Engagement"].ToString()); sunenergy[0] = Convert.ToInt16(dr["Energy"].ToString()); if (sun[0] == -1 || sunstress[0] == -1 || sunoutlook[0] == -1 || sunengage[0] == -1 || sunenergy[0] == -1) { sun[0] = 0; sunstress[0] = 0; sunoutlook[0] = 0; sunengage[0] = 0; sunenergy[0] = 0; } else { chart1.Series["Sunday"].Points[0].YValues = sun; chart1.Series["Sunday"].Points[1].YValues = sunstress; chart1.Series["Sunday"].Points[2].YValues = sunoutlook; chart1.Series["Sunday"].Points[3].YValues = sunengage; chart1.Series["Sunday"].Points[4].YValues = sunenergy; } break; } } } }
private void ProcessMembershipLogin(string username) { username = username.Replace("'", "''"); this.cmd.Parameters.Clear(); // this.cmd.CommandText = string.Format("SELECT UserID, UserName FROM ForumUsers WHERE UserName='******' AND Disabled=0", username); this.cmd.CommandText = string.Format("SELECT UserID, Email FROM ForumUsers WHERE Email='{0}' AND Disabled=0", username); this.cn.Open(); DbDataReader dr = cmd.ExecuteReader(); if (dr.Read()) //if user found if db (already exists) { Session["aspnetforumUserID"] = (dr[0]).ToString(); Session["aspnetforumUserName"] = (dr[1]).ToString(); dr.Close(); } else //user not exists YET - let's add him to our ForumUsers table { SqlConnClass objSqlConnClass = new SqlConnClass(); UsersClass objUsersClass = new UsersClass(objSqlConnClass.OpenConnection()); //DataRow DR = objUsersClass.USR_GET_GetUserInfo(Membership.GetUser().ProviderUserKey.ToString()).Tables[0].Rows[0]; /*Above line is commented by Netsmartz*/ DataSet ds = objUsersClass.USR_GET_GetUserInfo(Membership.GetUser().ProviderUserKey.ToString()); if (ds != null && ds.Tables.Count > 0) { DataRow DR = ds.Tables[0].Rows[0]; string sUserDisplayName = ""; if (DR != null) { sUserDisplayName = DR["FNAME"].ToString() + " " + DR["LNAME"].ToString(); } objSqlConnClass.CloseConnection(); dr.Close(); this.cmd.Parameters.Clear(); this.cmd.CommandText = "INSERT INTO ForumUsers (UserID, UserName, Email, [Password], UserDisplayName, Homepage, Interests, RegistrationDate, Disabled, ActivationCode) " + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; Utils.DB.PrepareCommandText(ref cmd); Utils.DB.FillCommandParamaters(ref cmd, Membership.GetUser().ProviderUserKey.ToString(), username, "none", "none", sUserDisplayName, string.Empty, string.Empty, Utils.GetCurrTime(), false, string.Empty); this.cmd.ExecuteNonQuery(); this.cmd.Parameters.Clear(); this.cmd.CommandText = string.Format("SELECT UserID, UserName FROM ForumUsers WHERE UserName='******' AND Disabled=0", username); dr = cmd.ExecuteReader(); dr.Read(); Session["aspnetforumUserID"] = (dr[0]).ToString(); Session["aspnetforumUserName"] = dr[1].ToString(); dr.Close(); } } this.cn.Close(); }
private void BindCMSText() { TextAreaClass objTextAreaClass; SqlConnClass objSqlConnClass = new SqlConnClass(); objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DS = objTextAreaClass.Get_MultipleCMSPagesText(); for (int i = 0; i < DS.Tables[0].Rows.Count; i++) { string strTemp = DS.Tables[0].Rows[i]["strPageName"].ToString(); if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("tutorialsandnavigation")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblTutorialNavigationHTMLText.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblTutorialNavigationHTMLText.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("goalsobjectives")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblGoalsObjectives.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblGoalsObjectives.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("levelofintensity")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblLevelOfIntensity.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblLevelOfIntensity.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("howwemeasure")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblHowWeMeasure.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblHowWeMeasure.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("nutritioncenter")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblNutritionCenter.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblNutritionCenter.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("personalfitness")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lbPersonalFitness.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lbPersonalFitness.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("wellnessdairy")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblWellnessDiary.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblWellnessDiary.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } else if (DS.Tables[0].Rows[i]["strPageName"].ToString().ToLower().Equals("wellnessdairyforum")) { if (DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Length > 900) lblWellnessDairyForum.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString().Substring(0, 900); else lblWellnessDairyForum.Text = DS.Tables[0].Rows[i]["TextAreaHTML"].ToString(); } } DS = null; objTextAreaClass = null; objSqlConnClass.CloseConnection(); objSqlConnClass = null; }
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(); } } }
/// <summary> /// BindDetails() function used to bind all the details that need to be display on the page load. /// </summary> private void BindCMSDetails() { SqlConnClass objSqlConnClass = new SqlConnClass(); TextAreaClass objTextAreaClass; objTextAreaClass = new TextAreaClass(objSqlConnClass.OpenConnection()); DataSet DSCMS = objTextAreaClass.TxA_Get_TextAreas("MyNutritionOverview", "2"); try { if (DSCMS.Tables[0].Rows.Count > 0)//There needs to be at least 1 row { if (DSCMS.Tables[0].Rows[0]["TextAreaHTML"].ToString().Length > 900) lblNutritionOverview.Text = DSCMS.Tables[0].Rows[0]["TextAreaHTML"].ToString().Substring(0, 900); else lblNutritionOverview.Text = DSCMS.Tables[0].Rows[0]["TextAreaHTML"].ToString(); } } catch { } finally { objSqlConnClass.CloseConnection(); objSqlConnClass = null; objTextAreaClass = null; DSCMS = 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) { } }