修改首页

This commit is contained in:
2023-08-25 09:52:24 +08:00
parent fae93887c0
commit 24ed5b1c49
13 changed files with 3598 additions and 350 deletions
+107 -77
View File
@@ -293,7 +293,7 @@ namespace FineUIPro.Web
Response.Expires = 0; //设置过期时间
Response.Cache.SetNoStore(); //在服务器端不缓存该页面
Response.AppendHeader("Pragma", "no-cache"); //在客户端不缓存
ProjectService.InitAllProjectShortNameDropDownList(this.drpProject, this.CurrUser.UserId, false);
ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false);
if (!string.IsNullOrEmpty(Request.Params["projectId"]))
{
this.drpProject.SelectedValue = Request.Params["projectId"];
@@ -316,81 +316,81 @@ namespace FineUIPro.Web
this.InitMenuModeButton();
this.InitLangMenuButton();
GetWeather();
//GetWeather();
}
}
private void GetWeather()
{
try
{
string appkey = "cc220b45380a453a08cb79fd2d40ea3e"; //配置您申请的appkey
//1.根据城市查询天气
//string url1 = "http://op.juhe.cn/onebox/weather/query";
//var parameters1 = new Dictionary<string, string>();
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.drpProject.SelectedValue);
string city = "武汉";
if (project != null && !string.IsNullOrEmpty(project.City))
{
city = project.City;
}
if (!string.IsNullOrEmpty(city))
{
//parameters1.Add("cityname", city); //要查询的城市,如:温州、上海、北京
//parameters1.Add("key", appkey);//你申请的key
//parameters1.Add("dtype", ""); //返回数据的格式,xml或json,默认json
//try
//{
// string appkey = "cc220b45380a453a08cb79fd2d40ea3e"; //配置您申请的appkey
// //1.根据城市查询天气
// //string url1 = "http://op.juhe.cn/onebox/weather/query";
// //var parameters1 = new Dictionary<string, string>();
// Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.drpProject.SelectedValue);
// string city = "武汉";
// if (project != null && !string.IsNullOrEmpty(project.City))
// {
// city = project.City;
// }
// if (!string.IsNullOrEmpty(city))
// {
// //parameters1.Add("cityname", city); //要查询的城市,如:温州、上海、北京
// //parameters1.Add("key", appkey);//你申请的key
// //parameters1.Add("dtype", ""); //返回数据的格式,xml或json,默认json
//string result1 = sendPost(url1, parameters1, "get");
Model.Weather oldWeather = BLL.WeatherService.GetWeatherByDateAndCity(DateTime.Now.Date, city);
if (oldWeather == null) //未生成天气记录
{
string result = BLL.CommonService.CreateGetHttpResponse("http://apis.juhe.cn/simpleWeather/query?city=" + city + "&key=" + appkey);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.reason == "查询成功!")
{
string tem = j2.result.realtime.temperature;
string weather = j2.result.realtime.info;
if (weather == "多云")
{
this.btnWeather.IconFont = IconFont.Cloud;
}
else if (weather == "晴")
{
this.btnWeather.IconFont = IconFont.SunO;
}
else if (weather == "阴")
{
this.btnWeather.IconFont = IconFont.Cloud;
}
else if (weather.Contains("雪"))
{
this.btnWeather.IconFont = IconFont.SnowflakeO;
}
string alltem = j2.result.future[0].temperature;
this.btnWeather.Text = tem;
string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月" + DateTime.Now.Day + "日";
this.btnWeather.ToolTip = date + " " + city + " " + weather + " " + alltem;
Model.Weather newWeather = new Model.Weather();
newWeather.WeatherId = SQLHelper.GetNewID();
newWeather.City = city;
newWeather.Date = DateTime.Now.Date;
newWeather.WeatherRef = weather;
newWeather.CurrTem = tem;
newWeather.AllTem = alltem;
BLL.WeatherService.AddWeather(newWeather);
}
}
else
{
this.btnWeather.Text = oldWeather.CurrTem;
string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月" + DateTime.Now.Day + "日";
this.btnWeather.ToolTip = date + " " + city + " " + oldWeather.WeatherRef + " " + oldWeather.AllTem;
}
}
}
catch (Exception ex)
{
}
// //string result1 = sendPost(url1, parameters1, "get");
// Model.Weather oldWeather = BLL.WeatherService.GetWeatherByDateAndCity(DateTime.Now.Date, city);
// if (oldWeather == null) //未生成天气记录
// {
// string result = BLL.CommonService.CreateGetHttpResponse("http://apis.juhe.cn/simpleWeather/query?city=" + city + "&key=" + appkey);
// var j2 = JsonConvert.DeserializeObject<dynamic>(result);
// if (j2.reason == "查询成功!")
// {
// string tem = j2.result.realtime.temperature;
// string weather = j2.result.realtime.info;
// if (weather == "多云")
// {
// this.btnWeather.IconFont = IconFont.Cloud;
// }
// else if (weather == "晴")
// {
// this.btnWeather.IconFont = IconFont.SunO;
// }
// else if (weather == "阴")
// {
// this.btnWeather.IconFont = IconFont.Cloud;
// }
// else if (weather.Contains("雪"))
// {
// this.btnWeather.IconFont = IconFont.SnowflakeO;
// }
// string alltem = j2.result.future[0].temperature;
// this.btnWeather.Text = tem;
// string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月" + DateTime.Now.Day + "日";
// this.btnWeather.ToolTip = date + " " + city + " " + weather + " " + alltem;
// Model.Weather newWeather = new Model.Weather();
// newWeather.WeatherId = SQLHelper.GetNewID();
// newWeather.City = city;
// newWeather.Date = DateTime.Now.Date;
// newWeather.WeatherRef = weather;
// newWeather.CurrTem = tem;
// newWeather.AllTem = alltem;
// BLL.WeatherService.AddWeather(newWeather);
// }
// }
// else
// {
// this.btnWeather.Text = oldWeather.CurrTem;
// string date = DateTime.Now.Year + "年" + DateTime.Now.Month + "月" + DateTime.Now.Day + "日";
// this.btnWeather.ToolTip = date + " " + city + " " + oldWeather.WeatherRef + " " + oldWeather.AllTem;
// }
// }
//}
//catch (Exception ex)
//{
//}
}
/// <summary>
@@ -596,11 +596,11 @@ namespace FineUIPro.Web
/// <param name="type"></param>
protected void MenuSwitchMethod(string type)
{
// this.CurrUser.LoginProjectId = this.drpProject.SelectedValue;
// this.CurrUser.LoginProjectId = this.drpProject.SelectedValue;
this.XmlDataSource1.DataFile = "common/Menu_Personal.xml";
this.leftPanel.Hidden = true;
var projectUser = BLL.ProjectUserService.GetProjectUserByUserIdProjectId(this.CurrUser.LoginProjectId, this.CurrUser.UserId);
if (projectUser != null&&type!=BLL.Const.Menu_Opinion)
if (projectUser != null && type != BLL.Const.Menu_Opinion)
{
string roleTypes = string.Empty;
string roleCNs = string.Empty;
@@ -631,12 +631,12 @@ namespace FineUIPro.Web
}
else
{
this.Tab1.IFrameUrl = "~/common/mainProject.aspx";
this.Tab1.IFrameUrl = "~/common/mainProject2.aspx";
}
}
else
{
this.Tab1.IFrameUrl = "~/common/mainProject.aspx";
this.Tab1.IFrameUrl = "~/common/mainProject2.aspx";
}
this.CurrUser.LastProjectId = null;
if (!string.IsNullOrEmpty(type))
@@ -677,17 +677,17 @@ namespace FineUIPro.Web
this.Tab1.IFrameUrl = "~/Opinion/OpinionCollection.aspx";
this.Tab1.Title = "意见收集";
}
else if (type==Const.Menu_Doc)
else if (type == Const.Menu_Doc)
{
this.Tab1.IFrameUrl = "~/DocManage/DocManage.aspx";
this.Tab1.Title = "协调与沟通";
}
else if (type==Const.Menu_ToDo)
else if (type == Const.Menu_ToDo)
{
this.Tab1.IFrameUrl = "~/SysManage/ProjectToDo.aspx";
}
else
{
{
this.Tab1.Title = "首页";
}
}
@@ -803,5 +803,35 @@ namespace FineUIPro.Web
{
this.MenuSwitchMethod(Const.Menu_ToDo);
}
protected void ProjectZJ_Click(object sender, EventArgs e)
{
ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false);
if (this.drpProject.Items.Count > 0)
{
this.drpProject.SelectedIndex = 0;
this.CurrUser.LoginProjectId = this.drpProject.SelectedValue;
}
}
protected void ProjectTG_Click(object sender, EventArgs e)
{
ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_2, false);
if (this.drpProject.Items.Count > 0)
{
this.drpProject.SelectedIndex = 0;
this.CurrUser.LoginProjectId = this.drpProject.SelectedValue;
}
}
protected void ProjectJG_Click(object sender, EventArgs e)
{
ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_3, false);
if (this.drpProject.Items.Count > 0)
{
this.drpProject.SelectedIndex = 0;
this.CurrUser.LoginProjectId = this.drpProject.SelectedValue;
}
}
}
}