20230327展示页跳转
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
using Aspose.Words;
|
||||
using BLL;
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
@@ -24,7 +21,6 @@ namespace FineUIPro.Web.DataShow
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
@@ -37,56 +33,36 @@ namespace FineUIPro.Web.DataShow
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"select NEWID() as ID, v.ProjectId,v.ProjectCode,v.ProjectName,v.allcount,v.ccount,isnull(v.allCount,0)-ISNULL(v.cCount,0) as ucCount,
|
||||
(case when isnull(v.allCount,0) > 0 then cast((isnull(v.allCount,0)-ISNULL(v.cCount,0)) *1.0 /isnull(v.allCount,0)*100 as decimal(18, 2))
|
||||
else 0 end) as rateV
|
||||
from (select h.ProjectId,p.ProjectCode,p.ProjectName,COUNT(*) as allCount,
|
||||
isnull((select COUNT(*) from HSSE_Hazard_HazardRegister as c
|
||||
where c.ProjectId=h.ProjectId and states =3
|
||||
and '1' = @cpara
|
||||
group by c.ProjectId),0) as cCount
|
||||
from HSSE_Hazard_HazardRegister as h
|
||||
left join Base_Project as p on h.ProjectId=p.ProjectId
|
||||
where p.projectId is not null ";
|
||||
string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
string cpara = string.Empty;
|
||||
if (this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND h.projectId = @projectId"; ///状态为已完成
|
||||
strSql += " AND projectId = @projectId"; ///状态为已完成
|
||||
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
||||
|
||||
cpara += " AND c.projectId ="+ this.drpProject.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
{
|
||||
strSql += " AND h.RegisterDate >=@StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
//if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
//{
|
||||
// strSql += " AND h.RegisterDate >=@StartTime";
|
||||
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
|
||||
cpara += " AND c.RegisterDate >=" + this.txtStartTime.Text;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
{
|
||||
strSql += " AND h.RegisterDate <=@EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
||||
// cpara += " AND c.RegisterDate >=" + this.txtStartTime.Text;
|
||||
//}
|
||||
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
//{
|
||||
// strSql += " AND h.RegisterDate <=@EndTime";
|
||||
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
||||
|
||||
// cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text;
|
||||
//}
|
||||
|
||||
cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cpara))
|
||||
{
|
||||
listStr.Add(new SqlParameter("@cpara"," '1' And "+ cpara));
|
||||
}
|
||||
else
|
||||
{
|
||||
listStr.Add(new SqlParameter("@cpara", "'1'"));
|
||||
}
|
||||
strSql += " group by h.ProjectId,p.ProjectCode,p.ProjectName) as v";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
Grid1.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -177,5 +153,132 @@ namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
protected int Count1(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4");
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate <= datetime2);
|
||||
}
|
||||
if (this.rbType.SelectedValue == "0")
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue == "3");
|
||||
}
|
||||
else
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue != "3");
|
||||
}
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected int Count2(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States == "3");
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate <= datetime2);
|
||||
}
|
||||
if (this.rbType.SelectedValue == "0")
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue == "3");
|
||||
}
|
||||
else
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue != "3");
|
||||
}
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected int Count3(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "3" && x.States != "4");
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.RegisterDate <= datetime2);
|
||||
}
|
||||
if (this.rbType.SelectedValue == "0")
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue == "3");
|
||||
}
|
||||
else
|
||||
{
|
||||
getT = getT.Where(x => x.HazardValue != "3");
|
||||
}
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected string Count4(object projectId)
|
||||
{
|
||||
string rate=string.Empty;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getALL= Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4");
|
||||
if (this.rbType.SelectedValue == "0")
|
||||
{
|
||||
getALL = getALL.Where(x => x.HazardValue == "3");
|
||||
}
|
||||
else
|
||||
{
|
||||
getALL = getALL.Where(x => x.HazardValue != "3");
|
||||
}
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getALL = getALL.Where(x => x.RegisterDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getALL = getALL.Where(x => x.RegisterDate >= datetime1);
|
||||
}
|
||||
var getT = getALL.Where(x => x.ProjectId == projectId.ToString() && x.States == "3");
|
||||
int coutall = getALL.Count();
|
||||
int cout0 = getT.Count();
|
||||
if (coutall > 0)
|
||||
{
|
||||
rate = Math.Round(cout0 * 1.0 / coutall * 100, 2).ToString();
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user