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) { if (!AppLib.IsLoggedinSessionExists()) Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true); #region Insert visited log details AppLib.InsertVisitedSectionDetails("Daily Dairy"); #endregion objDDClass = new DDClass(objSqlConnClass.OpenConnection()); gsUserID = Membership.GetUser().ProviderUserKey.ToString(); if (IsPostBack) {/* if (Request.QueryString["date"] != null) { gsDate = Request.QueryString["date"].ToString(); } } else {*/ gsDate = ViewState["gsDate"].ToString(); } }
private void Reset() { TxtDate.Text = string.Empty; TxtAdmsNo.Text = string.Empty; TxtAdmsDate.Text = string.Empty; TxtSclName.Text = string.Empty; TxtStdName.Text = string.Empty; TxtAcdYear.Text = string.Empty; TxtRollNo.Text = string.Empty; DDGender.ClearSelection(); DDClass.ClearSelection(); DDSection.ClearSelection(); TxtDob.Text = string.Empty; TxtEmail.Text = string.Empty; TxtFatherName.Text = string.Empty; TxtMotherName.Text = string.Empty; TxtFtrOcc.Text = string.Empty; TxtNationality.Text = string.Empty; TxtReligion.Text = string.Empty; TxtCategory.Text = string.Empty; TxtState.Text = string.Empty; TxtCountry.Text = string.Empty; TxtTemAdd.Text = string.Empty; TxtPerAdd.Text = string.Empty; TxtCountact.Text = string.Empty; TxtAltNo.Text = string.Empty; DDStatus.ClearSelection(); }
private void Class() { DDClass.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Class", "-1")); DDClass.AppendDataBoundItems = true; string constr = ConfigurationManager.ConnectionStrings["SMSConnectionString"].ConnectionString; string strQuery = "select Class from Class"; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = strQuery; cmd.Connection = con; try { con.Open(); DDClass.DataSource = cmd.ExecuteReader(); DDClass.DataTextField = "Class"; DDClass.DataValueField = "Class"; DDClass.DataBind(); } catch (Exception ex) { throw ex; } finally { con.Close(); con.Dispose(); } }
protected void Reset() { txtBook_Name.Text = string.Empty; txtCopies.Text = string.Empty; txtprice.Text = string.Empty; txtStock.Text = string.Empty; DDClass.ClearSelection(); txtBook_Number.Text = string.Empty; }
protected void Page_Load(object sender, EventArgs e) { objDDClass = new DDClass(objSqlConnClass.OpenConnection()); objPalClass = new PALClass(objSqlConnClass.OpenConnection()); gsUserID = Membership.GetUser().ProviderUserKey.ToString(); if (!IsPostBack) { } }
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 Page_Load(object sender, EventArgs e) { objDDClass = new DDClass(objSqlConnClass.OpenConnection()); gsUserID = Membership.GetUser().ProviderUserKey.ToString(); if (!IsPostBack) { if (Request.QueryString["date"] != null) { gsDate = Request.QueryString["date"].ToString(); } } else { gsDate = ViewState["gsDate"].ToString(); } }
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(); }
/// <summary> /// Queries the database for the information needed to create a character, and displays /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { InitCreationData(); if (!IsPostBack) { DisplayRace(races[0]); DisplayClass(classes[0]); DisplayBackground(backgrounds[0]); DDRace.DataSource = races; DDRace.DataBind(); DDClass.DataSource = classes; DDClass.DataBind(); DDBackground.DataSource = backgrounds; DDBackground.DataBind(); RollStats(); } }
/// <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 BindEvents() { string sUsername = ""; try { sUsername = Membership.GetUser().UserName; } catch { } if (sUsername == "") { Response.Redirect("../Main_Frame.aspx"); } else { BLL.UserLib oUserLib = new BLL.UserLib(); Entity.UserInfo oUserInfo = new Entity.UserInfo(); SqlConnClass objSqlConnClass = new SqlConnClass(); DDClass objDDClass = new DDClass(objSqlConnClass.OpenConnection()); DataSet DS = objDDClass.GetwellnessDate(sUsername); if (DS.Tables[0].Rows.Count > 0) { DataTable dt = new DataTable(); DateTime datee = DateTime.Now; DateTime dl = datee.AddDays(-6); string[] dateArr = new string[DS.Tables[0].Rows.Count]; for (int i = 0; i < DS.Tables[0].Rows.Count; i++) { dateArr[i] = DS.Tables[0].Rows[i]["Dates"].ToString(); } DateTime maxdate = Convert.ToDateTime(DS.Tables[0].Rows[0]["Dates"]); DateTime mindate = Convert.ToDateTime(DS.Tables[0].Rows[DS.Tables[0].Rows.Count - 1]["Dates"]); for (int i = 0, k = 0; i < dateArr.Length; i++, k++, maxdate.AddDays(-k)) { if (Convert.ToDateTime(dateArr[i]) != maxdate.AddDays(-k)) { for (int j = 0; Convert.ToDateTime(dateArr[i]) < maxdate.AddDays(-k); j++) { if (DS.Tables[0].Rows.Count < 7) { DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, maxdate.AddDays(-k).ToString("dddd"), maxdate.AddDays(-k), mindate.AddDays(-k).DayOfWeek); k = k + j + 1; } } } } int rcount = DS.Tables[0].Rows.Count; if (rcount < 7) { for (int j = 0; j < 7 - rcount; j++) { int x = j + 1; if (j == 0) { DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, mindate.AddDays(-1).ToString("dddd"), mindate.AddDays(-1), mindate.AddDays(-1).DayOfWeek); } else { DS.Tables[0].Rows.Add(100, oCompanyInfo.StrUserName, -1, -1, -1, -1, -1, mindate.AddDays(-x).ToString("dddd"), mindate.AddDays(-x), mindate.AddDays(-x).DayOfWeek); } } } DS.AcceptChanges(); dt = DS.Tables[0]; // Sorting DataTable DataView dataView = new DataView(dt); dataView.Sort = " DayOfWeeks ASC"; string expression = "Dates > '1/1/00'"; // Sort descending by column named CompanyName. string sortOrder = "DayOfWeeks ASC"; DataRow[] dr = dt.Select(expression, sortOrder); DateTime date = Convert.ToDateTime(dt.Rows[0]["Dates"]); GVdiary.DataSource = dataView; GVdiary.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { objDDClass = new DDClass(objSqlConnClass.OpenConnection()); lblMsg.Text = string.Empty; }
protected void Page_Load(object sender, EventArgs e) { objDDClass = new DDClass(objSqlConnClass.OpenConnection()); }
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////// }
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 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; } } } }
/// <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 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) { } }
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(); } } }