|
最近做的一个小项目,用了fineui,简单的一个表格,但是确让用户崩溃了。问题:1、项目刚部署时,打开这个页面2~5秒,客户勉强还可以接受,毕竟是开源免费版,速度不能跟专业版比,可以理解,但是过了一段时间后,问题来了,打开时间越来越长,两个月后已达到25~40秒,客户已爆发,数据就100多条;
2、使用了数据库分页,点击下一页,报错“出错了,communication failure(0)”;
3、项目内就这个页面有问题,其他页面速度可以接受;
4、尝试了iis应用程序池回收、重启iis、浏览器清除缓存,毫无效果;
5、由于客户机、服务器、数据库都在一个局域网内,所以我自己也搭了一个环境,运行发现并没什么问题(3秒左右),但是我不知道过一段时间会不会有变化。
请三石兄以及各位道友帮我看看哪里出了问题,谢谢,第一次用fineui做项目,对很多功能不甚了解。
代码如下
前台:<f:Grid ID="Grid1" BoxFlex="1" ShowBorder="true" ShowHeader="true" Title="实时监察" runat="server"
IsDatabasePaging="true" PageSize="20" DataKeyNames="doProjectNo,projectNo,doProjectNumber"
AllowPaging="true"
EnableCheckBoxSelect="true" EnableMultiSelect="true">
<Toolbars>
<f:Toolbar runat="server">
<Items>
<fropDownList ID="dp_type" runat="server" AutoPostBack="true" Width="85px" OnSelectedIndexChanged="dp_type_OnSelectedIndexChanged">
<fistItem Value="1" Text="全部" Selected="true" />
<fistItem Value="2" Text="超期预警" />
<fistItem Value="3" Text="今日预警" />
<fistItem Value="4" Text="一天预警" />
<fistItem Value="5" Text="两天预警" />
<fistItem Value="6" Text="预审预警" />
</fropDownList>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField Width="30px" EnablePagingNumber="true">
</f:RowNumberField>
<f:TemplateField HeaderText="时限预警" TextAlign="Center">
<ItemTemplate>
<img src="<%# imghq(DataBinder.Eval(Container.DataItem, "doProjectNo")) %>">
</ItemTemplate>
</f:TemplateField>
<f:TemplateField HeaderText="部门">
<ItemTemplate>
<%# depart(DataBinder.Eval(Container.DataItem, "departmentNumber"))%>
</ItemTemplate>
</f:TemplateField>
<f:BoundField Width="100px" DataField="doProjectNo" DataFormatString="{0}" HeaderText="业务流水号" />
<f:BoundField ExpandUnusedSpace="true" DataField="applicant" DataFormatString="{0}"
HeaderText="申请单位" />
<f:BoundField ExpandUnusedSpace="true" DataField="littleScopeName" DataFormatString="{0}"
HeaderText="项目名称" />
<f:BoundField Width="100px" DataField="doCount" DataFormatString="{0}" HeaderText="件数" />
<f:TemplateField HeaderText="操作步骤信息" Width="200px">
<ItemTemplate>
<%# stepinfo(DataBinder.Eval(Container.DataItem, "doProjectNo"))%>
</ItemTemplate>
</f:TemplateField>
<f:BoundField Width="100px" DataField="curOperator" DataFormatString="{0}" HeaderText="承办单位(人)" />
</Columns>
</f:Grid>
后台:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
public void BindData()
{
string where = "doneState<>'办结' ";
string date1 = "";
string date2 = "";
if (dp_type.SelectedValue == "2")
{
GetD1D2(out date1,out date2, "0");
where += "and doneState<>'预受理' and (deadlineDate >= '" + date1 + "') and (deadlineDate <= '" + date2 + "')";
}
else if (dp_type.SelectedValue == "3")
{
GetD1D2(out date1, out date2, "d");
where += "and doneState<>'预受理' and (deadlineDate >= '" + date1 + "') and (deadlineDate <= '" + date2 + "')";
}
else if (dp_type.SelectedValue == "4")
{
GetD1D2(out date1, out date2, "1");
where += "and doneState<>'预受理' and (deadlineDate >= '" + date1 + "') and (deadlineDate <= '" + date2 + "')";
}
else if (dp_type.SelectedValue == "5")
{
GetD1D2(out date1, out date2, "2");
where += "and doneState<>'预受理' and (deadlineDate >= '" + date1 + "') and (deadlineDate <= '" + date2 + "')";
}
else if (dp_type.SelectedValue == "6")
{
where += "and doneState='预受理' ";
}
Grid1.RecordCount = bll_DoProject.GetCount(where);
DataSet ds = bll_DoProject.GetPageListSSJC(Grid1.PageSize, Grid1.PageIndex, where);
Grid1.DataSource = ds.Tables[0];
Grid1.DataBind();
}
protected void Grid1_PageIndexChange(object sender, FineUI.GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindData();
}
protected string stepinfo(object doProjectNo)
{
string dpn = doProjectNo.ToString();
Model.DoProject model_DoProject = bll_DoProject.GetModelbydoprojectNO(dpn);
DataSet ds_step = bll_StepDefine.GetDSbyprojectNo(model_DoProject.projectNo);
string step = "";
if (ds_step.Tables[0].Rows.Count > 0)
{
int wc = 0;
int next = 0;
for (int j = 0; j < ds_step.Tables[0].Rows.Count; j++)
{
DataRow dr_step = ds_step.Tables[0].Rows[j];
Model.Step model_Step = bll_Step.GetModel(dr_step["name"].ToString(), model_DoProject.doProjectNumber);
if (model_Step == null)
{
}
else if (model_Step.state == "已完成")
{
wc = j+1;
}
next = j + 2;
if (wc == 0)
{
step += dr_step["name"].ToString() + " → ";
}
else if (wc == j+1)
{
step += "<font color='green'>" + dr_step["name"].ToString() + "</font>" + " → ";
}
else if ((next - wc) == 2)
{
step += "<font color='orange'>" + dr_step["name"].ToString() + "</font>" + " → ";
}
else
{
step += dr_step["name"].ToString() + " → ";
}
}
step = step.Substring(0, step.Length - 3);
}
else
{
step = "";
}
return step;
}
protected string depart(object departmentNumber)
{
Model.Department model_Department = bll_Department.GetModel1(departmentNumber.ToString());
return model_Department.departmentName;
}
protected string imghq(object doprojectno)
{
Model.DoProject model = bll_DoProject.GetModelbydoprojectNO(doprojectno.ToString());
DateTime dtdead;
try
{
dtdead = Convert.ToDateTime(model.deadlineDate.ToString());
}
catch
{
dtdead = Convert.ToDateTime(model.preAcceptStepDate.ToString()).AddDays(2);
}
DateTime dt1 = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 00:00:00");
DateTime dt2 = Convert.ToDateTime(dtdead.ToShortDateString() + " 23:59:59");
TimeSpan ts = dt2 - dt1;
if (dt2 < dt1)
{
return "../images/yj_red.png";
}
else
{
if (ts.Days == 0)
{
return "../images/yj_yellow.png";
}
if (ts.Days == 1)
{
return "../images/yj_blue.png";
}
if (ts.Days >= 2)
{
return "../images/yj_green.png";
}
else
{
return "";
}
}
}
protected void GetD1D2(out string dt1, out string dt2, string day)
{
dt1 = "1900-1-1 00:00:00.000";
dt2 = "2017-10-20 00:00:00.000";
switch (day)
{
case "2": dt1 = (DateTime.Now + new TimeSpan(2, 0, 0, 0)).ToShortDateString() + " 0:00:00";
dt2 = (DateTime.Now + new TimeSpan(2, 0, 0, 0)).ToShortDateString() + " 23:59:59"; break;
case "1": ……;
case "d": ……;
default: dt2 = (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToShortDateString() + " 23:59:59"; break;
}
}
|
|