protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) { BLL.FoodIntakeLib oFoodIntakeLib = new BLL.FoodIntakeLib(); Telerik.Web.UI.Calendar.View.MonthView monthView = (Telerik.Web.UI.Calendar.View.MonthView)RadCalendar1.CalendarView; List<Entity.FoodIntakeInfo> oListFoodIntakeInfo = new List<Entity.FoodIntakeInfo>(); oListFoodIntakeInfo = oFoodIntakeLib.GetFoodIntakeDetailsByUserId(AppLib.GetLoggedInUserName()); foreach (var item in oListFoodIntakeInfo) { if (e.Day.Date == item.DtFoodIntakeDate) { string _strFoodDetails = @"<table class='tblItems' style='width:94%;' align='left' border='1'><tr><td align='right' ><a href = 'javascript:void(0)' onclick = 'HideDetails()'>Close</a></td></tr><tr class='trAlt'><td>Date</td></tr><tr><td style='padding-left: 10px;'>" + item.DtFoodIntakeDate.ToString("MM/dd/yyyy") + @"</td></tr><tr class='trAlt'><td>Calorie</td></tr><tr><td style='padding-left: 10px;'>" + item.IntCalorie.ToString() + @"</td></tr><tr class='trAlt'><td>Milk</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrMilkDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Fruit</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrFruitDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Vegetables</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrVegetablesDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Starch</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrStarchDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Protein</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrProteinDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>FAT</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrFATDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Water</td></tr><tr><td style='padding-left: 10px;'>" + GetSplitedDetailsofActivity(item.StrWaterDetails.ToString()) + @"</td></tr><tr class='trAlt'><td>Created On</td></tr><tr><td style='padding-left: 10px;'>" + item.DtFoodIntakeDate.ToString("MM/dd/yyyy") + @"</td></tr></table>"; //Response.Write(_strFoodDetails); Label lbTemp = new Label(); lbTemp.Text = _strFoodDetails; e.Cell.Attributes.Add("onclick", "DisplayDetails(\"" + lbTemp.Text+ "\")"); //e.Cell.Attributes.Add("onmouseout", "HideDetails()"); e.Cell.Text = "Date: " + item.DtFoodIntakeDate.ToString("MM/dd/yyyy") + "<br />"; e.Cell.Text = e.Cell.Text + "Calorie: " + item.IntCalorie.ToString() + "<br />"; // e.Cell.Text = e.Cell.Text + "Calorie: " + item.StrMilkDetails.ToString() + "<br />"; lbTemp = null; } } oListFoodIntakeInfo = null; oFoodIntakeLib = null; }
protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) { BLL.FoodIntakeLib oFoodIntakeLib = new BLL.FoodIntakeLib(); List<Entity.FoodIntakeInfo> oListFoodIntakeInfo = new List<Entity.FoodIntakeInfo>(); oListFoodIntakeInfo = oFoodIntakeLib.GetFoodIntakeDetailsByUserId(AppLib.GetLoggedInUserName()); foreach (var item in oListFoodIntakeInfo) { if (e.Day.Date == item.DtFoodIntakeDate) { e.Cell.HorizontalAlign = HorizontalAlign.Left; string _strFoodDetails = @"<table style='width:100%;' align='left' border='1'> <tr class='trAlt'><td style='text-align:left;'>Date: " + item.DtFoodIntakeDate.ToString("MM/dd/yyyy") + @" </td><td style='text-align:left;'>Calorie: " + item.IntCalorie.ToString() + @"</td></tr> <tr class='trAlt'><td style='text-align:left;'>Milk:" + GetSplitedDetailsofActivity(item.StrMilkDetails.ToString()) + @"</td><td style='text-align:left;'>Fruit:" + GetSplitedDetailsofActivity(item.StrFruitDetails.ToString()) + @"</td></tr> <tr class='trAlt'><td style='text-align:left;'>Vegetables:" + GetSplitedDetailsofActivity(item.StrVegetablesDetails.ToString()) + @"</td> <td style='text-align:left;'>Starch:" + GetSplitedDetailsofActivity(item.StrStarchDetails.ToString()) + @"</td></tr> <tr class='trAlt'><td style='text-align:left;'>Protein:" + GetSplitedDetailsofActivity(item.StrProteinDetails.ToString()) + @"</td> <td style='text-align:left;'>FAT:" + GetSplitedDetailsofActivity(item.StrFATDetails.ToString()) + @"</td></tr> <tr class='trAlt'><td colspan='2' style='text-align:left;'>Water:" + GetSplitedDetailsofActivity(item.StrWaterDetails.ToString()) + @"</td></tr> </table>"; e.Cell.Text = _strFoodDetails; } } oListFoodIntakeInfo = null; oFoodIntakeLib = null; }
/// <summary> /// following event is used to calculate the additional minute. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { Entity.FoodIntakeInfo oFoodIntakeInfo = new Entity.FoodIntakeInfo(); BLL.FoodIntakeLib oFoodIntakeLib = new BLL.FoodIntakeLib(); try { oFoodIntakeInfo.StrUserId = AppLib.GetLoggedInUserName(); oFoodIntakeInfo.DtFoodIntakeDate = Convert.ToDateTime(txtDate.Text); oFoodIntakeInfo.IntCalorie = Convert.ToInt32(txtCurrentCalorie.Text); oFoodIntakeInfo.StrMilkDetails = lblMilk.Text + "~" + GetTxtBoxValue(txtMilkRecord) + "~" + GetTxtBoxValue(txtMilkDailyTotal); oFoodIntakeInfo.StrFruitDetails = lblFruit.Text + "~" + GetTxtBoxValue(txtFruitRecord) + "~" + GetTxtBoxValue(txtFruitDailyTotal); oFoodIntakeInfo.StrVegetablesDetails = lblVegetables.Text + "~" + GetTxtBoxValue(txtVegetablesRecord) + "~" + GetTxtBoxValue(txtVegetablesDailyTotal); oFoodIntakeInfo.StrStarchDetails = lblStarch.Text + "~" + GetTxtBoxValue(txtStarchRecord) + "~" + GetTxtBoxValue(txtStarchDailyTotal); oFoodIntakeInfo.StrProteinDetails = lblProtein.Text + "~" + GetTxtBoxValue(txtProteinRecord) + "~" + GetTxtBoxValue(txtProteinDailyTotal); oFoodIntakeInfo.StrFATDetails = lblFat.Text + "~" + GetTxtBoxValue(txtFatRecord) + "~" + GetTxtBoxValue(txtFatDailyTotal); oFoodIntakeInfo.StrWaterDetails = lblWater.Text + "~" + GetTxtBoxValue(txtWaterRecord) + "~" + GetTxtBoxValue(txtWaterDailyTotal); if (oFoodIntakeLib.InsertFoodIntakeDetails(oFoodIntakeInfo).Equals(0)) { oFoodIntakeLib = null; oFoodIntakeInfo = null; Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/FoodJournal.aspx?msg=ins", true); } } catch { } finally { oFoodIntakeLib = null; oFoodIntakeInfo = null; } }
private void BindFoodIntake() { BLL.FoodIntakeLib oFoodIntakeLib = new BLL.FoodIntakeLib(); try { DLFILob.DataSource = oFoodIntakeLib.GetFoodIntakeDetailsByUserId(AppLib.GetLoggedInUserName()); DLFILob.DataBind(); } catch { } finally { oFoodIntakeLib = null; } }