This commit is contained in:
parent
19c093122b
commit
eca0fd7d5e
|
|
@ -18,7 +18,6 @@ END
|
|||
GO
|
||||
|
||||
|
||||
drop table Accident_Warning
|
||||
--ʹʾ¯Ê¾
|
||||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Accident_Warning') AND type = N'U')
|
||||
BEGIN
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FineUIPro;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
|
@ -99,5 +100,32 @@ namespace BLL
|
|||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 事故类型下拉
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitAccidentTypeDropDownList(DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "string";
|
||||
dropName.DataTextField = "string";
|
||||
dropName.DataSource = GetAccidentTypeDropDownList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事故类型下拉
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetAccidentTypeDropDownList()
|
||||
{
|
||||
return (from x in Funs.DB.Accident_Warning select x.Type).Distinct().OrderBy(x => x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,9 +21,11 @@
|
|||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:TextBox runat="server" Label="查询条件" ID="txtSearch" EmptyText="输入事故编号、标题、类型、地点、来源"
|
||||
<f:TextBox runat="server" Label="查询条件" ID="txtSearch" EmptyText="输入事故编号、标题、地点、来源"
|
||||
Width="420px" LabelWidth="100px" LabelAlign="right">
|
||||
</f:TextBox>
|
||||
<f:DropDownList runat="server" EnableSimulateTree="True" LabelAlign="Right" Label="事故类型" ID="drpType" AutoPostBack="true" OnSelectedIndexChanged="drpType_SelectedIndexChanged">
|
||||
</f:DropDownList>
|
||||
<f:DatePicker runat="server" Label="事故日期" ID="txtAccidentDateStart" LabelAlign="Right"
|
||||
LabelWidth="100px" Width="220px">
|
||||
</f:DatePicker>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ namespace FineUIPro.Web.Accident
|
|||
//}
|
||||
//this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
GetButtonPower();
|
||||
BLL.AccidentWarningService.InitAccidentTypeDropDownList(this.drpType, true);
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
|
|
@ -64,7 +65,7 @@ namespace FineUIPro.Web.Accident
|
|||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (!string.IsNullOrEmpty(this.txtSearch.Text.Trim()))
|
||||
{
|
||||
sb.Append("and (Code like @txtSearch or Title like @txtSearch or Type like @txtSearch or Address like @txtSearch or Source like @txtSearch ) ");
|
||||
sb.Append("and (Code like @txtSearch or Title like @txtSearch or Address like @txtSearch or Source like @txtSearch ) ");
|
||||
listStr.Add(new SqlParameter("@txtSearch", "%" + this.txtSearch.Text.Trim() + "%"));
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
|
||||
|
|
@ -72,6 +73,11 @@ namespace FineUIPro.Web.Accident
|
|||
// sb.Append("and (Type like @txtType ) ");
|
||||
// listStr.Add(new SqlParameter("@txtType", "%" + this.txtType.Text.Trim() + "%"));
|
||||
//}
|
||||
if (!string.IsNullOrWhiteSpace(this.drpType.SelectedValue) && this.drpType.SelectedValue != Const._Null)
|
||||
{
|
||||
sb.Append("and Type = @Type ");
|
||||
listStr.Add(new SqlParameter("@Type", this.drpType.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtAccidentDateStart.Text.Trim()))
|
||||
{
|
||||
sb.Append("and AccidentDate >= @AccidentDateStart ");
|
||||
|
|
@ -91,6 +97,17 @@ namespace FineUIPro.Web.Accident
|
|||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事故类型下拉触发事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void drpType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
|
||||
#region 分页 排序
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
|
|
|
|||
|
|
@ -68,6 +68,15 @@ namespace FineUIPro.Web.Accident
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtSearch;
|
||||
|
||||
/// <summary>
|
||||
/// drpType 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpType;
|
||||
|
||||
/// <summary>
|
||||
/// txtAccidentDateStart 控件。
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace FineUIPro.Web.Accident
|
|||
conn.Close();
|
||||
conn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0], 6);
|
||||
AddDatasetToSQL(ds.Tables[0], 8);
|
||||
hdCheckResult.Text = "1";
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
|
@ -180,10 +180,10 @@ namespace FineUIPro.Web.Accident
|
|||
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故类型", Reason = "此项为必填项!" });
|
||||
}
|
||||
string row2 = pds.Rows[i][2].ToString();
|
||||
if (string.IsNullOrEmpty(row2))
|
||||
{
|
||||
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" });
|
||||
}
|
||||
//if (string.IsNullOrEmpty(row2))
|
||||
//{
|
||||
// errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" });
|
||||
//}
|
||||
string row3 = pds.Rows[i][3].ToString();
|
||||
if (!string.IsNullOrEmpty(row3))
|
||||
{
|
||||
|
|
@ -202,7 +202,7 @@ namespace FineUIPro.Web.Accident
|
|||
}
|
||||
if (!string.IsNullOrWhiteSpace(row0) && !string.IsNullOrWhiteSpace(row1) && !string.IsNullOrWhiteSpace(row2) && !string.IsNullOrWhiteSpace(row3))
|
||||
{
|
||||
var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.Type == row2 && x.AccidentDate == Convert.ToDateTime(row2.Trim()));
|
||||
var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.Type == row2 && x.AccidentDate == Convert.ToDateTime(row3.Trim()));
|
||||
if (acc.Any())
|
||||
{
|
||||
errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故标题", Reason = "此项事故已存在!" });
|
||||
|
|
@ -293,7 +293,7 @@ namespace FineUIPro.Web.Accident
|
|||
conn.Close();
|
||||
conn.Dispose();
|
||||
|
||||
AddDatasetToSQL2(ds.Tables[0], 6);
|
||||
AddDatasetToSQL2(ds.Tables[0], 8);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@
|
|||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtType" runat="server" Label="事故类型" LabelAlign="Right" ShowRedStar="true" Required="true" MaxLength="50">
|
||||
</f:TextBox>
|
||||
<%--<f:TextBox ID="txtType" runat="server" Label="事故类型" LabelAlign="Right" ShowRedStar="true" Required="true" MaxLength="50">
|
||||
</f:TextBox>--%>
|
||||
<f:DropDownList runat="server" EnableSimulateTree="True" LabelAlign="Right" Label="事故类型" ID="drpType" ShowRedStar="true" Required="true" >
|
||||
</f:DropDownList>
|
||||
<f:DatePicker ID="txtAccidentDate" runat="server" Label="事故日期" LabelAlign="Right" ShowRedStar="true" Required="true" EnableEdit="true">
|
||||
</f:DatePicker>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using BLL;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.Accident
|
||||
|
|
@ -36,6 +38,7 @@ namespace FineUIPro.Web.Accident
|
|||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
|
||||
BLL.AccidentWarningService.InitAccidentTypeDropDownList(this.drpType, true);
|
||||
this.Id = Request.Params["Id"];
|
||||
if (!string.IsNullOrEmpty(this.Id))
|
||||
{
|
||||
|
|
@ -45,7 +48,10 @@ namespace FineUIPro.Web.Accident
|
|||
this.txtCode.Text = model.Code;
|
||||
this.txtTitle.Text = model.Title;
|
||||
this.txtContent.Text = model.Content;
|
||||
//this.txtType.Text = model.Type;
|
||||
this.drpType.SelectedValue = model.Type;
|
||||
this.txtAddress.Text = model.Address;
|
||||
this.txtSource.Text = model.Source;
|
||||
this.txtResponsibleUnit.Text = model.ResponsibleUnit;
|
||||
this.txtRemarks.Text = model.Remarks;
|
||||
if (model.AccidentDate != null)
|
||||
|
|
@ -79,6 +85,11 @@ namespace FineUIPro.Web.Accident
|
|||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.drpType.SelectedValue) || this.drpType.SelectedValue == Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择事故类型", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
this.SaveData();
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
|
@ -92,7 +103,8 @@ namespace FineUIPro.Web.Accident
|
|||
model.Code = this.txtCode.Text.Trim();
|
||||
model.Title = this.txtTitle.Text.Trim();
|
||||
model.Content = this.txtContent.Text.Trim();
|
||||
model.Type = this.txtType.Text.Trim();
|
||||
//model.Type = this.txtType.Text.Trim();
|
||||
model.Type = this.drpType.SelectedValue;
|
||||
model.Address = this.txtAddress.Text.Trim();
|
||||
model.Source = this.txtSource.Text.Trim();
|
||||
model.ResponsibleUnit = this.txtResponsibleUnit.Text.Trim();
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@ namespace FineUIPro.Web.Accident
|
|||
protected global::FineUIPro.TextBox txtTitle;
|
||||
|
||||
/// <summary>
|
||||
/// txtType 控件。
|
||||
/// drpType 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtType;
|
||||
protected global::FineUIPro.DropDownList drpType;
|
||||
|
||||
/// <summary>
|
||||
/// txtAccidentDate 控件。
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue