/// <summary> /// 分页 /// </summary> /// <param name="entity"></param> /// <param name="PageIndex"></param> /// <param name="PageSize"></param> /// <param name="count"></param> /// <returns></returns> public List <Entity.UserInfo> GetPage(Entity.UserInfo entity, int PageIndex, int PageSize, out int count) { string sqlwhere = ""; if (entity.DepartmentID != 0) { sqlwhere += " and UserInfo.DepartmentID=" + entity.DepartmentID; } if (entity.UserName != null && !entity.UserName.Equals("")) { sqlwhere += " and UserInfo.UserName like '%" + entity.UserName + "%'"; } string sql = "select count(*) from UserInfo where 1=1 " + sqlwhere; count = (int)db.ExecScalar(); sql = @"select * from ( select UserInfo.*,ROW_NUMBER() over(order by UserInfo.UserID) rowid,Department.DepartmentName from UserInfo inner join Department on UserInfo.DepartmentID=Department.DepartmentID where 1=1 " + sqlwhere + ") tamp where rowid between @PageIndex and @PageSize"; db.PrepareSql(sql); db.SetParameter("PageIndex", (PageIndex - 1) * PageSize + 1); db.SetParameter("PageSize", PageIndex * PageSize); DataTable dt = new DataTable(); dt = db.ExecQuery(); if (dt.Rows.Count == 0) { return(null); } List <Entity.UserInfo> GetList = new List <UserInfo>(); foreach (DataRow item in dt.Rows) { entity.UserID = int.Parse(item["UserID"].ToString()); entity.DepartmentID = int.Parse(item["DepartmentID"].ToString()); entity.RoleID = int.Parse(item["RoleID"].ToString()); entity.UserNumber = item["UserNumber"].ToString(); entity.LoginName = item["LoginName"].ToString(); entity.LoginPwd = item["LoginPwd"].ToString(); entity.UserName = item["UserName"].ToString(); entity.UserAge = int.Parse(item["UserAge"].ToString()); entity.UserSex = int.Parse(item["UserSex"].ToString()); entity.UserTel = item["UserTel"].ToString(); entity.UserAddress = item["UserAddress"].ToString(); entity.UserIphone = item["UserIphone"].ToString(); entity.UserRemarks = item["UserRemarks"].ToString(); entity.UserStatr = int.Parse(item["UserStatr"].ToString()); entity.EntryTime = DateTime.Parse(item["EntryTime"].ToString()); entity.DimissionTime = DateTime.Parse(item["DimissionTime"].ToString()); entity.BasePay = decimal.Parse(item["BasePay"].ToString()); entity.department = new Department(); entity.department.DepartmentName = item["DepartmentName"].ToString(); GetList.Add(entity); } return(GetList); }
private void BindFAQ() { Entity.UserInfo oUserInfo = new Entity.UserInfo(); BLL.UserLib oUserLib = new BLL.UserLib(); GVTopics.DataSource = oUserLib.GetAllFAQsTopicsFromFAQ(); GVTopics.DataBind(); oUserLib = null; oUserInfo = null; }
protected void lnkBtnSubmit_Click(object sender, EventArgs e) { BLL.UserLib oUserLib = new BLL.UserLib(); Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.IntQuestionId = 0; oUserInfo.StrHeading = ddlTopic.SelectedItem.Text; oUserInfo.StrQuestion = txtQuestion.Text; if (oUserInfo.StrQuestion.Length > 500) oUserInfo.StrQuestion = oUserInfo.StrQuestion.Substring(0, 499); oUserInfo.StrAnswer = txtAnswer.Text; if (oUserInfo.StrAnswer.Length > 500) oUserInfo.StrAnswer = oUserInfo.StrAnswer.Substring(0, 499); oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.StrUserId = AppLib.GetLoggedInUserName(); if (Request.QueryString["id"] == null) { oUserInfo.ChrUserType = 'A'; if (oUserLib.InsertFAQ(oUserInfo)) { oUserLib = null; oUserInfo = null; Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/Templates/ManageFaq.aspx?msg=ins", true); } else { lblMsg.Text = "FAQ already exists."; } } else { oUserInfo.IntFAQId = Convert.ToInt32(Request.QueryString["id"]); if (oUserLib.UpdateFAQ(oUserInfo)) { oUserLib = null; oUserInfo = null; Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/Templates/ManageFaq.aspx?msg=up", true); } else { lblMsg.Text = "FAQ already exists."; } } // SendContactUsEmail(); }
protected void GVLibrary_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AddToFavorite")) { LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource; Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.IntFavoriteTypeId = 0; oUserInfo.IntFavoriteId = 0; if (lnkBtnFavorite.Text == "Remove from Favorite") oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument); oUserInfo.StrUserId = AppLib.GetLoggedInUserName(); oUserInfo.StrTitle = ""; oUserInfo.StrFavoriteType = "Library"; oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument); BLL.UserLib oUserLib = new BLL.UserLib(); oUserLib.LibraryAddToFavorite(oUserInfo); oUserInfo = null; oUserLib = null; BindLibrary(); } else if (e.CommandName.Equals("PathViewlabrariesFile")) { Entity.LibraryInfo oLibraryInfo = new Entity.LibraryInfo(); BLL.LibraryLib oLibraryLib = new BLL.LibraryLib(); oLibraryInfo = oLibraryLib.GetLibraryByLibraryId(Convert.ToInt32(e.CommandArgument)); if (oLibraryInfo.StrLocationType.ToLower().Equals("pdf") || oLibraryInfo.StrLocationType.ToLower().Equals("video")) { GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); LinkButton lnkNewslettes = (LinkButton)row.FindControl("lnkViewLabraries"); string path = AppConfig.GetBaseSiteUrl() + AppConfig.GetLibrariesFilePath() + oLibraryInfo.StrLocation; Response.Write("<script type='text/javascript'>detailedresults=window.open('" + path + "', 'popUpWindow', 'height=700,width=900,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');</script>"); } else { } } }
protected void GVFavoriteList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("DeleteDetails")) { LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource; Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument); oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument); BLL.UserLib oUserLib = new BLL.UserLib(); oUserLib.EventAddToFavorite(oUserInfo); oUserInfo = null; oUserLib = null; BindFavoriteList(); lblMsg.Text = "Record has been deleted successfully."; } }
/// Function Header******************************************************* /// Function Name: BindEvents /// Function Type: Function /// Functionality: used to get bind the events /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* private void BindSectionVisited() { Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.StrDateFrom = AppLib.GetBackDate(); oUserInfo.StrDateTo = AppLib.GetFutureDate(); if (!txtVisitedFrom.Text.Trim().Equals(string.Empty)) { if (AppLib.isDateTime(txtVisitedFrom.Text.Trim())) { oUserInfo.StrDateFrom = txtVisitedFrom.Text.Trim(); oUserInfo.StrDateTo = AppLib.GetFutureDate(); } else oUserInfo.StrDateFrom = AppLib.GetFutureDate(); } if (!txtVisitedTo.Text.Trim().Equals(string.Empty)) { if (AppLib.isDateTime(txtVisitedTo.Text.Trim())) oUserInfo.StrDateTo = txtVisitedTo.Text.Trim(); else oUserInfo.StrDateTo = AppLib.GetBackDate(); } if (oUserInfo.StrDateTo.Equals(oUserInfo.StrDateFrom)) { string strTodayDate = DateTime.Now.ToShortDateString(); if (strTodayDate.Equals(oUserInfo.StrDateTo)) oUserInfo.StrDateTo = AppLib.GetFutureDate(); } oUserInfo.StrDateTo = oUserInfo.StrDateTo + " 11:59:00 PM"; oUserInfo.StrDateFrom = oUserInfo.StrDateFrom + " 12:01:00 AM"; oUserInfo.StrUserType = ddlUserType.SelectedValue; oUserInfo.StrSectionVisited = txtSectionVisited.Text.Trim(); BLL.UserLib oUserLib = new BLL.UserLib(); GVQuestion.DataSource = oUserLib.GetSectionVisitedDetails(oUserInfo); GVQuestion.DataBind(); oUserLib = null; oUserInfo = null; }
protected void GVNewsLetter_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AddToFavorite")) { LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource; Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.IntFavoriteTypeId = 0; oUserInfo.IntFavoriteId = 0; if (lnkBtnFavorite.Text == "Remove from Favorite") oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument); oUserInfo.StrUserId = AppLib.GetLoggedInUserName(); oUserInfo.StrTitle = ""; oUserInfo.StrFavoriteType = "Newsletter"; oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument); BLL.UserLib oUserLib = new BLL.UserLib(); oUserLib.NewsletterAddToFavorite(oUserInfo); oUserInfo = null; oUserLib = null; BindNewsLetters(); } else if (e.CommandName.Equals("PathNewslettersFile")) { Entity.NewsInfo oNewsInfo = new Entity.NewsInfo(); BLL.NewsLib oNewsLib = new BLL.NewsLib(); oNewsInfo = oNewsLib.GetNewsLettersById(Convert.ToInt32(e.CommandArgument)); if (oNewsInfo != null) { GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); LinkButton lnkNewslettes = (LinkButton)row.FindControl("lnkNewsletters"); ViewState["strOldFileName"] = oNewsInfo.StrPDFFilename; string Path = AppConfig.GetBaseSiteUrl() + AppConfig.GetNewsLettersPDFPath() + oNewsInfo.StrPDFFilename; Response.Write("<script type='text/javascript'>detailedresults=window.open('" + Path + "', 'popUpWindow', 'height=700,width=900,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');</script>"); } } }
/// <summary> /// 添加 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Add(Entity.UserInfo entity) { string sql = "insert into UserInfo(DepartmentID,RoleID,UserNumber,LoginName,LoginPwd,UserName,UserAge,UserSex,UserTel,UserAddress,UserIphone,UserRemarks,UserStatr,EntryTime,DimissionTime,BasePay) values(@UserID,@DepartmentID,@RoleID,@UserNumber,@LoginName,@LoginPwd,@UserName,@UserAge,@UserSex,@UserTel,@UserAddress,@UserIphone,@UserRemarks,@UserStatr,@EntryTime,@DimissionTime,@BasePay)"; db.PrepareSql(sql); db.SetParameter("DepartmentID", entity.DepartmentID); db.SetParameter("RoleID", entity.RoleID); db.SetParameter("UserNumber", entity.UserNumber); db.SetParameter("LoginName", entity.LoginName); db.SetParameter("LoginPwd", entity.LoginPwd); db.SetParameter("UserName", entity.UserName); db.SetParameter("UserAge", entity.UserAge); db.SetParameter("UserSex", entity.UserSex); db.SetParameter("UserTel", entity.UserTel); db.SetParameter("UserAddress", entity.UserAddress); db.SetParameter("UserIphone", entity.UserIphone); db.SetParameter("UserRemarks", entity.UserRemarks); db.SetParameter("UserStatr", entity.UserStatr); db.SetParameter("EntryTime", entity.EntryTime); db.SetParameter("DimissionTime", entity.DimissionTime); db.SetParameter("BasePay", entity.BasePay); return(db.ExecNonQuery()); }
/// <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; } }
protected void GVNewsLetter_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AddToFavorite")) { LinkButton lnkBtnFavorite = (LinkButton)e.CommandSource; Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.IntFavoriteTypeId = 0; oUserInfo.IntFavoriteId = 0; if (lnkBtnFavorite.Text == "Remove from Favorite") oUserInfo.IntFavoriteId = Convert.ToInt32(e.CommandArgument); oUserInfo.StrUserId = AppLib.GetLoggedInUserName(); oUserInfo.StrTitle = ""; oUserInfo.StrFavoriteType = "Newsletter"; oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.IntFavoriteTypeId = Convert.ToInt32(e.CommandArgument); BLL.UserLib oUserLib = new BLL.UserLib(); oUserLib.NewsletterAddToFavorite(oUserInfo); oUserInfo = null; oUserLib = null; //BindNewsLetters(); } }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Update(Entity.UserInfo entity) { string sql = "update UserInfo set DepartmentID=@DepartmentID,RoleID=@RoleID,UserNumber=@UserNumber,LoginName=@LoginName,LoginPwd=@LoginPwd,UserName=@UserName,UserAge=@UserAge,UserSex=@UserSex,UserTel=@UserTel,UserAddress=@UserAddress,UserIphone=@UserIphone,UserRemarks=@UserRemarks,UserStatr=@UserStatr,EntryTime=@EntryTime,DimissionTime=@DimissionTime,BasePay=@BasePay where UserID=@UserID"; db.PrepareSql(sql); db.SetParameter("UserID", entity.UserID); db.SetParameter("DepartmentID", entity.DepartmentID); db.SetParameter("RoleID", entity.RoleID); db.SetParameter("UserNumber", entity.UserNumber); db.SetParameter("LoginName", entity.LoginName); db.SetParameter("LoginPwd", entity.LoginPwd); db.SetParameter("UserName", entity.UserName); db.SetParameter("UserAge", entity.UserAge); db.SetParameter("UserSex", entity.UserSex); db.SetParameter("UserTel", entity.UserTel); db.SetParameter("UserAddress", entity.UserAddress); db.SetParameter("UserIphone", entity.UserIphone); db.SetParameter("UserRemarks", entity.UserRemarks); db.SetParameter("UserStatr", entity.UserStatr); db.SetParameter("EntryTime", entity.EntryTime); db.SetParameter("DimissionTime", entity.DimissionTime); db.SetParameter("BasePay", entity.BasePay); return(db.ExecNonQuery()); }
public static int LoginCheck(Entity.UserInfo ui) { string[] names = new string[] { "UserID", "UserPassWord" }; string[] values = new string[] { ui.UserID, ui.UserPassWord }; return(DataAccess.Operations.ExecuteSQLByScalar("UserLoginCheck", CommandType.StoredProcedure, names, values)); }
private void BindDetails() { BLL.UserLib oUserLib = new BLL.UserLib(); Entity.UserInfo oUserInfo = new Entity.UserInfo(); if (Request.QueryString["id"] != null) { oUserInfo = oUserLib.GetAllFAQByFaqId(Convert.ToInt32(Request.QueryString["id"])); if (oUserInfo != null) { ddlTopic.SelectedIndex = ddlTopic.Items.IndexOf(ddlTopic.Items.FindByText(oUserInfo.StrHeading)); txtQuestion.Text = oUserInfo.StrQuestion; txtAnswer.Text = oUserInfo.StrAnswer; } } oUserInfo = null; oUserLib = null; }
protected void btn_Login_Click(object sender, EventArgs e) { if (this.tbx_UserID.Text.Trim() == "") { Response.Write("<script>alert('用户ID不能为空!')</script>"); return; } if (this.tbx_PassWord.Text.Trim() == "") { Response.Write("<script>alert('密码不能为空!')</script>"); return; } if (tbx_UserID.Text.Length > 6) { Entity.UserInfo ui = new Entity.UserInfo(); ui.UserID = this.tbx_UserID.Text.Trim(); ui.UserPassWord = this.tbx_PassWord.Text.Trim(); int result = Business.StudentBusiness.LoginCheck(ui); if (result == 0) { Response.Write("<script>alert('用户名或密码错误!')</script>"); return; } else { DataTable dt = Business.StudentBusiness.GetUserInfoByUserID(ui); ui.UserName = dt.Rows[0]["username"].ToString(); ui.Birthday = dt.Rows[0]["Birthday"].ToString(); ui.Email = dt.Rows[0]["Email"].ToString(); ui.Age = dt.Rows[0]["Age"].ToString(); Session["user"] = ui; WebForm1.MultiviewSwitcher = 2; Response.Write("<script>alert('欢迎进入日语学习系统!');window.location.href = 'MainPage.aspx'</script>"); } } else if (tbx_UserID.Text.Length == 3) { Entity.SuperAdminInfo sa = new SuperAdminInfo(); sa.SuperAdminID = tbx_UserID.Text.Trim(); sa.SuperAdminPassWord = tbx_PassWord.Text.Trim(); int result = Business.SuperAdminBusiness.SuperAdminLoginCheck(sa); if (result == 1) { Session["superadmin"] = sa; WebForm1.MultiviewSwitcher = 4; Response.Write("<script>alert('欢迎进入日语学习系统!');window.location.href = 'MainPage.aspx'</script>"); } else { Response.Write("<script>alert('用户名或密码错误!')</script>"); return; } } else { Entity.AdminInfo ai = new AdminInfo(); ai.AdminID = tbx_UserID.Text.Trim(); ai.AdminPassword = tbx_PassWord.Text.Trim(); int result = Business.AdminBusiness.AdminLoginCheck(ai); if (result == 0) { Response.Write("<script>alert('用户名或密码错误!')</script>"); return; } else { DataTable dt = Business.AdminBusiness.SelectAdminInfoByAdminID(ai); ai.AdminName = dt.Rows[0]["AdminName"].ToString(); Session["admin"] = ai; WebForm1.MultiviewSwitcher = 3; Response.Write("<script>alert('欢迎进入日语学习系统!');window.location.href = 'MainPage.aspx'</script>"); } } }
/*Sub Header*********************************************************** Function Name: InsertVisitedSectionDetails Functionality: This function is used to insert the section visited by user. Input: _strString and the _intRetCharacter Output: Note: *********************************************************************/ public static void InsertVisitedSectionDetails(string _strSectionVisited) { BLL.UserLib oUserLib = new BLL.UserLib(); Entity.UserInfo oUserInfo = new Entity.UserInfo(); oUserInfo.StrUserId = AppLib.GetLoggedInUserName(); oUserInfo.StrUserType = AppLib.GetCurrentUserType(); oUserInfo.DtCreatedOn = DateTime.Now; oUserInfo.StrAgent = System.Web.HttpContext.Current.Request.ServerVariables.Get("HTTP_USER_AGENT"); oUserInfo.StrVisitedIP = System.Web.HttpContext.Current.Request.ServerVariables.Get("REMOTE_ADDR"); oUserInfo.StrSectionVisited = _strSectionVisited; oUserLib.InesrtSectionVisitedDetails(oUserInfo); oUserInfo = null; oUserLib = null; }
public static string GetProfilePhoto(UserInfo userInfo, SystemImageSize size = SystemImageSize.Size40) { return GetProfilePhoto(userInfo.Picture, (SystemUserType)userInfo.UserTypeID, size); }
/// <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; } }
public static DataTable GetMyCollectionsByUserID(Entity.UserInfo ui) { string[] names = new string[] { "UserID" }; string[] values = new string[] { ui.UserID }; return(DataAccess.Operations.GetDataTable("User_GetMyCollectionsByUserID", CommandType.StoredProcedure, names, values)); }
public static int ChangePassword(string newpwd, Entity.UserInfo ui) { string[] names = new string[] { "UserPassword", "UserID" }; string[] values = new string[] { newpwd, ui.UserID }; return(DataAccess.Operations.ExecuteSQLByQuery("User_ChangePassword", CommandType.StoredProcedure, names, values)); }
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> /// Returns UserInfo of this instance. /// </summary> /// <returns>UserInfo of this instance.</returns> public static UserInfo SetValue(IDataReader reader) { UserInfo info = new UserInfo(); int idColumnIndex = reader.GetOrdinal("ID"); int userNameColumnIndex = reader.GetOrdinal("UserName"); int passWordColumnIndex = reader.GetOrdinal("PassWord"); int memoColumnIndex = reader.GetOrdinal("Memo"); info.ID = reader.GetGuid(idColumnIndex); info.UserName = Convert.ToString(reader.GetValue(userNameColumnIndex)); info.PassWord = Convert.ToString(reader.GetValue(passWordColumnIndex)); if (!reader.IsDBNull(memoColumnIndex)) info.Memo = Convert.ToString(reader.GetValue(memoColumnIndex)); return info; }
public static int Admin_ModifyUserInfo(Entity.UserInfo ui) { string[] names = new string[] { "UserID", "UserName", "UserPassword", "Birthday", "Email", "Gender", "Age" }; object[] values = new string[] { ui.UserID, ui.UserName, ui.UserPassWord, ui.Birthday, ui.Email, ui.Gender, ui.Age }; return(DataAccess.Operations.ExecuteSQLByQuery("Admin_ModifyUserInfo", CommandType.StoredProcedure, names, values)); }
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(); } } }
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; } } } }
public static int RegisterForStudent(Entity.UserInfo ui) { string[] names = new string[] { "UserID", "UserName", "UserPassWord", "Birthday", "Email", "Gender", "Age" }; string[] values = new string[] { ui.UserID, ui.UserName, ui.UserPassWord, ui.Birthday, ui.Email, ui.Gender, ui.Age }; return(DataAccess.Operations.ExecuteSQLByQuery("RegisterForStudent", CommandType.StoredProcedure, names, values)); }
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; } } } }