This commit is contained in:
2024-01-26 17:18:25 +08:00
82 changed files with 8199 additions and 1120 deletions
@@ -0,0 +1,67 @@
alter table DriverSub_DriverSubPlan add DriverSubNames varchar(100);
go;
alter table DriverSub_DriverSubContact add DriverSubPlanId varchar(100);
go;
alter table DriverSub_DriverSubContact add DriverSubContractorsId varchar(100);
go;
alter table DriverSub_DriverSubContact add SubcontractingType varchar(100);
go;
create table DriverSub_DriverSubContractors
(
DriverSubContractorsId varchar(100) primary key,
SubUnitName varchar(500),
EnterpriseNature varchar(500),
SubcontractingType varchar(500),
CollCropCode varchar(500),
SafetyProductionLicense varchar(500),
QualificationCertificateNumber varchar(500),
QualificationType varchar(500),
QualificationLevel varchar(500),
Province varchar(100),
City varchar(100),
IsUse bit default 1,
);
go;
exec sp_addextendedproperty 'MS_Description', N'企业名称', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'SubUnitName'
go
exec sp_addextendedproperty 'MS_Description', N'企业性质', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'EnterpriseNature'
go
exec sp_addextendedproperty 'MS_Description', N'分包类别(催化剂装填:1,烘炉:2,化学:3,清洗开车队:4)', 'SCHEMA', 'dbo',
'TABLE', 'DriverSub_DriverSubContractors', 'COLUMN', 'SubcontractingType'
go
exec sp_addextendedproperty 'MS_Description', N'统一社会信用代码', 'SCHEMA', 'dbo', 'TABLE',
'DriverSub_DriverSubContractors', 'COLUMN', 'CollCropCode'
go
exec sp_addextendedproperty 'MS_Description', N'安全生产许可证', 'SCHEMA', 'dbo', 'TABLE',
'DriverSub_DriverSubContractors', 'COLUMN', 'SafetyProductionLicense'
go
exec sp_addextendedproperty 'MS_Description', N'资质证书编号', 'SCHEMA', 'dbo', 'TABLE',
'DriverSub_DriverSubContractors', 'COLUMN', 'QualificationCertificateNumber'
go
exec sp_addextendedproperty 'MS_Description', N'资质类别', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'QualificationType'
go
exec sp_addextendedproperty 'MS_Description', N'资质等级', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'QualificationLevel'
go
exec sp_addextendedproperty 'MS_Description', N'省份', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'Province'
go
exec sp_addextendedproperty 'MS_Description', N'城市', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'City'
go
exec sp_addextendedproperty 'MS_Description', N'是否使用', 'SCHEMA', 'dbo', 'TABLE', 'DriverSub_DriverSubContractors',
'COLUMN', 'IsUse'
go
File diff suppressed because one or more lines are too long
+1
View File
@@ -745,6 +745,7 @@
<Compile Include="TestRun\DriverRun\DriverRunService.cs" />
<Compile Include="TestRun\DriverSchemeService.cs" />
<Compile Include="TestRun\DriverSub\DriverSubContactService.cs" />
<Compile Include="TestRun\DriverSub\DriverSubContractorsService.cs" />
<Compile Include="TestRun\DriverSub\DriverSubPlanService.cs" />
<Compile Include="TestRun\DriverSub\DriverSubService.cs" />
<Compile Include="TestRun\DriverSummary\DriverSummaryService.cs" />
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
+7
View File
@@ -3210,6 +3210,13 @@ namespace BLL
/// ProjectSetup导入模版文件原始的虚拟路径
/// </summary>
public const string ProjectSetupDataInUrl = "File\\Excel\\DataIn\\ProjectSetup导入模板.xls";
/// <summary>
/// 开车分包联络单模板文件原始虚拟路径
/// </summary>
public const string DriverSubContactTemplateUrl = "File\\Excel\\TestRun\\开车合作单位名录.xlsx";
#endregion
#region
+11
View File
@@ -195,6 +195,17 @@
list[6] = new ListItem("保运人员一览", "07");
return list;
}
//开车分包名称下拉框
public static ListItem[] drpDriverSubNameList()
{
ListItem[] list = new ListItem[4];
list[0] = new ListItem("催化剂装填", "1");
list[1] = new ListItem("烘炉", "2");
list[2] = new ListItem("化学清洗", "3");
list[3] = new ListItem("开车队", "4");
return list;
}
#endregion
/// <summary>
@@ -1,4 +1,5 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
@@ -17,6 +18,16 @@ namespace BLL
return Funs.DB.DriverSub_DriverSubContact.FirstOrDefault(e => e.DriverSubContactId == DriverSubContactId);
}
public static List<Model.DriverSub_DriverSubContact> GetDriverSubContactByProjectid(string projectId)
{
return Funs.DB.DriverSub_DriverSubContact.Where(e => e.ProjectId == projectId).ToList();
}
public static List<Model.DriverSub_DriverSubContact> GetDriverSubContactByDriverSubPlanId(
string DriverSubPlanId)
{
return Funs.DB.DriverSub_DriverSubContact.Where(e => e.DriverSubPlanId == DriverSubPlanId).ToList();
}
/// <summary>
/// 添加开车分包联络信息
/// </summary>
@@ -36,6 +47,9 @@ namespace BLL
newDriverSubContact.OutTime = DriverSubContact.OutTime;
newDriverSubContact.AttachUrl = DriverSubContact.AttachUrl;
newDriverSubContact.Remark = DriverSubContact.Remark;
newDriverSubContact.DriverSubPlanId= DriverSubContact.DriverSubPlanId;
newDriverSubContact.DriverSubContractorsId = DriverSubContact.DriverSubContractorsId;
newDriverSubContact.SubcontractingType = DriverSubContact.SubcontractingType;
Funs.DB.DriverSub_DriverSubContact.InsertOnSubmit(newDriverSubContact);
Funs.DB.SubmitChanges();
}
@@ -59,6 +73,9 @@ namespace BLL
newDriverSubContact.OutTime = DriverSubContact.OutTime;
newDriverSubContact.AttachUrl = DriverSubContact.AttachUrl;
newDriverSubContact.Remark = DriverSubContact.Remark;
newDriverSubContact.DriverSubPlanId = DriverSubContact.DriverSubPlanId;
newDriverSubContact.DriverSubContractorsId = DriverSubContact.DriverSubContractorsId;
newDriverSubContact.SubcontractingType = DriverSubContact.SubcontractingType;
Funs.DB.SubmitChanges();
}
}
@@ -80,5 +97,22 @@ namespace BLL
Funs.DB.SubmitChanges();
}
}
public static void DeleteDriverSubContactByDriverSubPlanId(string DriverSubPlanId)
{
List<Model.DriverSub_DriverSubContact> DriverSubContact = Funs.DB.DriverSub_DriverSubContact.Where(e => e.DriverSubPlanId == DriverSubPlanId).ToList();
if (DriverSubContact != null)
{
foreach (var item in DriverSubContact)
{
if (!string.IsNullOrEmpty(item.AttachUrl))
{
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, item.AttachUrl);//删除附件
}
Funs.DB.DriverSub_DriverSubContact.DeleteOnSubmit(item);
Funs.DB.SubmitChanges();
}
}
}
}
}
@@ -0,0 +1,173 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class DriversubcontractorsService
{
#region
/// <summary>
/// 记录数
/// </summary>
public static int Count
{
get;
set;
}
public static IQueryable<Model.DriverSub_DriverSubContractors> GetDriverSub_DriverSubContractorsByModle(Model.DriverSub_DriverSubContractors table)
{
var q = from x in Funs.DB.DriverSub_DriverSubContractors
where
(string.IsNullOrEmpty(table.DriverSubContractorsId) || x.DriverSubContractorsId.Contains(table.DriverSubContractorsId)) &&
(string.IsNullOrEmpty(table.SubUnitName) || x.SubUnitName.Contains(table.SubUnitName)) &&
(string.IsNullOrEmpty(table.EnterpriseNature) || x.EnterpriseNature.Contains(table.EnterpriseNature)) &&
(string.IsNullOrEmpty(table.SubcontractingType) || x.SubcontractingType.Contains(table.SubcontractingType)) &&
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
(string.IsNullOrEmpty(table.SafetyProductionLicense) || x.SafetyProductionLicense.Contains(table.SafetyProductionLicense)) &&
(string.IsNullOrEmpty(table.QualificationCertificateNumber) || x.QualificationCertificateNumber.Contains(table.QualificationCertificateNumber)) &&
(string.IsNullOrEmpty(table.QualificationType) || x.QualificationType.Contains(table.QualificationType)) &&
(string.IsNullOrEmpty(table.QualificationLevel) || x.QualificationLevel.Contains(table.QualificationLevel)) &&
(string.IsNullOrEmpty(table.Province) || x.Province.Contains(table.Province)) &&
(string.IsNullOrEmpty(table.City) || x.City.Contains(table.City))
select x
;
return q;
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="table"></param>
/// <param name="grid1"></param>
/// <returns></returns>
public static IEnumerable GetListData(Model.DriverSub_DriverSubContractors table, Grid grid1)
{
var q = GetDriverSub_DriverSubContractorsByModle(table);
Count = q.Count();
if (Count == 0)
{
return null;
}
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize) ;
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.DriverSubContractorsId,
x.SubUnitName,
x.EnterpriseNature,
x.SubcontractingType,
x.CollCropCode,
x.SafetyProductionLicense,
x.QualificationCertificateNumber,
x.QualificationType,
x.QualificationLevel,
x.Province,
x.City,
x.IsUse
};
}
#endregion
public static Model.DriverSub_DriverSubContractors GetDriverSub_DriverSubContractorsById(string DriverSubContractorsId)
{
return Funs.DB.DriverSub_DriverSubContractors.FirstOrDefault(x => x.DriverSubContractorsId == DriverSubContractorsId);
}
public static Model.DriverSub_DriverSubContractors GetDriverSubContractorsByCollCropCode(
string CollCropCode)
{
return Funs.DB.DriverSub_DriverSubContractors.FirstOrDefault(e => e.CollCropCode == CollCropCode);
}
public static void AddDriverSub_DriverSubContractors(Model.DriverSub_DriverSubContractors newtable)
{
Model.DriverSub_DriverSubContractors table = new Model.DriverSub_DriverSubContractors
{
DriverSubContractorsId = newtable.DriverSubContractorsId,
SubUnitName = newtable.SubUnitName,
EnterpriseNature = newtable.EnterpriseNature,
SubcontractingType = newtable.SubcontractingType,
CollCropCode = newtable.CollCropCode,
SafetyProductionLicense = newtable.SafetyProductionLicense,
QualificationCertificateNumber = newtable.QualificationCertificateNumber,
QualificationType = newtable.QualificationType,
QualificationLevel = newtable.QualificationLevel,
Province = newtable.Province,
City = newtable.City,
IsUse = newtable.IsUse
};
Funs.DB.DriverSub_DriverSubContractors.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
}
/// <summary>
///
/// </summary>
/// <param name="newtable"></param>
public static void UpdateDriverSub_DriverSubContractors(Model.DriverSub_DriverSubContractors newtable)
{
Model.DriverSub_DriverSubContractors table = Funs.DB.DriverSub_DriverSubContractors.FirstOrDefault(x => x.DriverSubContractorsId == newtable.DriverSubContractorsId);
if (table != null)
{
table.DriverSubContractorsId = newtable.DriverSubContractorsId;
table.SubUnitName = newtable.SubUnitName;
table.EnterpriseNature = newtable.EnterpriseNature;
table.SubcontractingType = newtable.SubcontractingType;
table.CollCropCode = newtable.CollCropCode;
table.SafetyProductionLicense = newtable.SafetyProductionLicense;
table.QualificationCertificateNumber = newtable.QualificationCertificateNumber;
table.QualificationType = newtable.QualificationType;
table.QualificationLevel = newtable.QualificationLevel;
table.Province = newtable.Province;
table.City = newtable.City;
table.IsUse = newtable.IsUse;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 将所有的IsUse设置为false
/// </summary>
public static void UpdateDriverSub_DriverSubContractorsIsUse()
{
var list = Funs.DB.DriverSub_DriverSubContractors.ToList();
foreach (var item in list)
{
item.IsUse = false;
}
Funs.DB.SubmitChanges();
}
/// <summary>
/// 删除
/// </summary>
/// <param name="DriverSubContractorsId"></param>
public static void DeleteDriverSub_DriverSubContractorsById(string DriverSubContractorsId)
{
Model.DriverSub_DriverSubContractors table = Funs.DB.DriverSub_DriverSubContractors.FirstOrDefault(x => x.DriverSubContractorsId == DriverSubContractorsId);
if (table != null)
{
Funs.DB.DriverSub_DriverSubContractors.DeleteOnSubmit(table);
Funs.DB.SubmitChanges();
}
}
}
}
@@ -1,8 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FineUIPro;
namespace BLL
{
@@ -11,6 +13,74 @@ namespace BLL
/// </summary>
public static class DriverSubPlanService
{
#region
/// <summary>
/// 记录数
/// </summary>
public static int Count
{
get;
set;
}
public static IQueryable<Model.DriverSub_DriverSubPlan> GetDriverSub_DriverSubPlanByModle(Model.DriverSub_DriverSubPlan table)
{
var q = from x in Funs.DB.DriverSub_DriverSubPlan
where
(string.IsNullOrEmpty(table.DriverSubPlanId) || x.DriverSubPlanId.Contains(table.DriverSubPlanId)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.Code) || x.Code.Contains(table.Code)) &&
(string.IsNullOrEmpty(table.SubUnitId) || x.SubUnitId.Contains(table.SubUnitId)) &&
(string.IsNullOrEmpty(table.Introductions) || x.Introductions.Contains(table.Introductions)) &&
(string.IsNullOrEmpty(table.Achievement) || x.Achievement.Contains(table.Achievement)) &&
(string.IsNullOrEmpty(table.Cooperation) || x.Cooperation.Contains(table.Cooperation)) &&
(string.IsNullOrEmpty(table.InstallationIds) || x.InstallationIds.Contains(table.InstallationIds)) &&
(string.IsNullOrEmpty(table.InstallationNames) || x.InstallationNames.Contains(table.InstallationNames)) &&
(string.IsNullOrEmpty(table.AttachUrl) || x.AttachUrl.Contains(table.AttachUrl)) &&
(string.IsNullOrEmpty(table.Remark) || x.Remark.Contains(table.Remark)) &&
(string.IsNullOrEmpty(table.DriverSubNames) || x.DriverSubNames.Contains(table.DriverSubNames))
select x
;
return q;
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="table"></param>
/// <param name="grid1"></param>
/// <returns></returns>
public static IQueryable GetListData(Model.DriverSub_DriverSubPlan table, Grid grid1)
{
var q = GetDriverSub_DriverSubPlanByModle(table);
Count = q.Count() ;
if (Count == 0)
{
return null;
}
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.DriverSubPlanId,
x.ProjectId,
x.Code,
x.SubUnitId,
x.Introductions,
x.Achievement,
x.Cooperation,
x.InstallationIds,
x.InstallationNames,
x.IsInvited,
x.AttachUrl,
x.Remark,
x.DriverSubNames,
};
}
#endregion
/// <summary>
/// 根据主键获取开车分包计划信息
/// </summary>
@@ -20,7 +90,10 @@ namespace BLL
{
return Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlanId);
}
public static List<Model.DriverSub_DriverSubPlan> GetDriverSubPlanByProjectid(string projectId)
{
return Funs.DB.DriverSub_DriverSubPlan.Where(e => e.ProjectId == projectId).ToList();
}
/// <summary>
/// 添加开车分包计划信息
/// </summary>
@@ -40,6 +113,7 @@ namespace BLL
newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited;
newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl;
newDriverSubPlan.Remark = DriverSubPlan.Remark;
newDriverSubPlan.DriverSubNames= DriverSubPlan.DriverSubNames;
Funs.DB.DriverSub_DriverSubPlan.InsertOnSubmit(newDriverSubPlan);
Funs.DB.SubmitChanges();
}
@@ -63,6 +137,8 @@ namespace BLL
newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited;
newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl;
newDriverSubPlan.Remark = DriverSubPlan.Remark;
newDriverSubPlan.DriverSubNames = DriverSubPlan.DriverSubNames;
Funs.DB.SubmitChanges();
}
}
@@ -84,5 +160,16 @@ namespace BLL
Funs.DB.SubmitChanges();
}
}
public static void InitSubPlanDropDownList(FineUIPro.DropDownList dropName,string projectid, bool isShowPlease)
{
dropName.DataValueField = "DriverSubPlanId";
dropName.DataTextField = "Code";
dropName.DataSource = GetDriverSubPlanByProjectid(projectid);
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,75 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataImportControl.ascx.cs" Inherits="FineUIPro.Web.Controls.DataImportControl" %>
<f:Panel ID="Panel1" runat="server" BodyPadding="0px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" ConfirmText="确定下载导入模板吗?" >
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="数据导入" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:Panel>
<script>
function showControlInfo(infoClientID) {
F.notify({
message: F(infoClientID).getValue(),
messageIcon: 'information',
target: '_top',
header: false,
displayMilliseconds: 2000,
positionX: 'center',
positionY: 'center'
});
}
</script>
@@ -0,0 +1,141 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.UI;
namespace FineUIPro.Web.Controls
{
public partial class DataImportControl : UserControl
{
public delegate void userEvent(object sender, EventArgs arg); //定义事件委托
public event userEvent Audit_Click; //定义审核事件
public event userEvent Import_Click; //定义导入事件
/// <summary>
/// 模板路径
/// </summary>
public string TemplatePath
{
get
{
return (string)ViewState["Template"];
}
set
{
ViewState["Template"] = value;
}
}
/// <summary>
/// 上传文件Url
/// </summary>
public string UpLoadAttachUrl
{
get
{
return (string)ViewState["UpLoadAttachUrl"];
}
set
{
ViewState["UpLoadAttachUrl"] = value;
}
}
//错误集合
public List<Model.ErrorInfo> ErrorInfoList
{
get
{
return (List<Model.ErrorInfo>)Session["ErrorInfoList"];
}
set
{
Session["ErrorInfoList"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (ErrorInfoList != null)
{
ErrorInfoList.Clear();
}
}
}
//方法用于绑定Grid
public void BindGrid()
{
this.gvErrorInfo.DataSource = ErrorInfoList;
this.gvErrorInfo.DataBind();
}
protected void btnAudit_Click(object sender, EventArgs e)
{
if (this.Audit_Click != null)
{
if (this.fuAttachUrl.HasFile == false)
{
String.Format("showControlInfo('{0}');", "请您选择Excel文件");
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
String.Format("showControlInfo('{0}');", "只可以选择Excel文件!");
return;
}
if (ErrorInfoList != null)
{
ErrorInfoList.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + Const.ExcelUrl;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
this.Audit_Click(this, e);
}
}
protected void btnImport_Click(object sender, EventArgs e)
{
if (this.Import_Click != null)
{
this.Import_Click(this, e);
}
}
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + TemplatePath;
string filePath = TemplatePath;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
#endregion
}
}
@@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Controls
{
public partial class DataImportControl
{
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}
+73 -25
View File
@@ -1756,6 +1756,9 @@
<Content Include="TestRun\DriverSub\DriverSub.aspx" />
<Content Include="TestRun\DriverSub\DriverSubContact.aspx" />
<Content Include="TestRun\DriverSub\DriverSubContactEdit.aspx" />
<Content Include="TestRun\DriverSub\DriverSubContactIn.aspx" />
<Content Include="TestRun\DriverSub\DriverSubContactorEdit.aspx" />
<Content Include="TestRun\DriverSub\DriverSubContactorList.aspx" />
<Content Include="TestRun\DriverSub\DriverSubEdit.aspx" />
<Content Include="TestRun\DriverSub\DriverSubPlan.aspx" />
<Content Include="TestRun\DriverSub\DriverSubPlanEdit.aspx" />
@@ -1832,16 +1835,19 @@
<Content Include="Transfer\ElectricalDataIn.aspx" />
<Content Include="Transfer\Firefighting.aspx" />
<Content Include="Transfer\FirefightingDataIn.aspx" />
<Content Include="Transfer\HVAC.aspx" />
<Content Include="Transfer\HVACDataIn.aspx" />
<Content Include="Transfer\Instrumentation.aspx" />
<Content Include="Transfer\InstrumentationDataIn.aspx" />
<Content Include="Transfer\Piping.aspx" />
<Content Include="Transfer\PipingDataIn.aspx" />
<Content Include="Transfer\Plumbing.aspx" />
<Content Include="Transfer\PlumbingDataIn.aspx" />
<Content Include="Transfer\ProjectSetup.aspx" />
<Content Include="Transfer\ProjectSetupDataIn.aspx" />
<Content Include="Transfer\RotatingEquipment.aspx" />
<Content Include="Transfer\RotatingEquipmentDataIn.aspx" />
<Content Include="Transfer\StaticEquipment.aspx" />
<Content Include="Transfer\StaticEquipmentDataIn.aspx" />
<Content Include="Transfer\PunchlistFrom.aspx" />
<Content Include="Transfer\PunchlistFromDataIn.aspx" />
<Content Include="Transfer\Telecom.aspx" />
<Content Include="Transfer\TelecomDataIn.aspx" />
<Content Include="Video\Video.aspx" />
<Content Include="ZHGL\DataIn\AccidentCauseReportBar.aspx" />
<Content Include="ZHGL\DataIn\AccidentCauseReportBarIn.aspx" />
@@ -15817,6 +15823,27 @@
<Compile Include="TestRun\DriverSub\DriverSubContactEdit.aspx.designer.cs">
<DependentUpon>DriverSubContactEdit.aspx</DependentUpon>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactIn.aspx.cs">
<DependentUpon>DriverSubContactIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactIn.aspx.designer.cs">
<DependentUpon>DriverSubContactIn.aspx</DependentUpon>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactorEdit.aspx.cs">
<DependentUpon>DriverSubContactorEdit.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactorEdit.aspx.designer.cs">
<DependentUpon>DriverSubContactorEdit.aspx</DependentUpon>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactorList.aspx.cs">
<DependentUpon>DriverSubContactorList.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubContactorList.aspx.designer.cs">
<DependentUpon>DriverSubContactorList.aspx</DependentUpon>
</Compile>
<Compile Include="TestRun\DriverSub\DriverSubEdit.aspx.cs">
<DependentUpon>DriverSubEdit.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -16356,6 +16383,20 @@
<Compile Include="Transfer\FirefightingDataIn.aspx.designer.cs">
<DependentUpon>FirefightingDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\HVAC.aspx.cs">
<DependentUpon>HVAC.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\HVAC.aspx.designer.cs">
<DependentUpon>HVAC.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\HVACDataIn.aspx.cs">
<DependentUpon>HVACDataIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\HVACDataIn.aspx.designer.cs">
<DependentUpon>HVACDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\Instrumentation.aspx.cs">
<DependentUpon>Instrumentation.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -16377,12 +16418,19 @@
<Compile Include="Transfer\Piping.aspx.designer.cs">
<DependentUpon>Piping.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\PipingDataIn.aspx.cs">
<DependentUpon>PipingDataIn.aspx</DependentUpon>
<Compile Include="Transfer\Plumbing.aspx.cs">
<DependentUpon>Plumbing.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\PipingDataIn.aspx.designer.cs">
<DependentUpon>PipingDataIn.aspx</DependentUpon>
<Compile Include="Transfer\Plumbing.aspx.designer.cs">
<DependentUpon>Plumbing.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\PlumbingDataIn.aspx.cs">
<DependentUpon>PlumbingDataIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\PlumbingDataIn.aspx.designer.cs">
<DependentUpon>PlumbingDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\ProjectSetup.aspx.cs">
<DependentUpon>ProjectSetup.aspx</DependentUpon>
@@ -16398,33 +16446,33 @@
<Compile Include="Transfer\ProjectSetupDataIn.aspx.designer.cs">
<DependentUpon>ProjectSetupDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\RotatingEquipment.aspx.cs">
<DependentUpon>RotatingEquipment.aspx</DependentUpon>
<Compile Include="Transfer\PunchlistFrom.aspx.cs">
<DependentUpon>PunchlistFrom.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\RotatingEquipment.aspx.designer.cs">
<DependentUpon>RotatingEquipment.aspx</DependentUpon>
<Compile Include="Transfer\PunchlistFrom.aspx.designer.cs">
<DependentUpon>PunchlistFrom.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\RotatingEquipmentDataIn.aspx.cs">
<DependentUpon>RotatingEquipmentDataIn.aspx</DependentUpon>
<Compile Include="Transfer\PunchlistFromDataIn.aspx.cs">
<DependentUpon>PunchlistFromDataIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\RotatingEquipmentDataIn.aspx.designer.cs">
<DependentUpon>RotatingEquipmentDataIn.aspx</DependentUpon>
<Compile Include="Transfer\PunchlistFromDataIn.aspx.designer.cs">
<DependentUpon>PunchlistFromDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\StaticEquipment.aspx.cs">
<DependentUpon>StaticEquipment.aspx</DependentUpon>
<Compile Include="Transfer\Telecom.aspx.cs">
<DependentUpon>Telecom.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\StaticEquipment.aspx.designer.cs">
<DependentUpon>StaticEquipment.aspx</DependentUpon>
<Compile Include="Transfer\Telecom.aspx.designer.cs">
<DependentUpon>Telecom.aspx</DependentUpon>
</Compile>
<Compile Include="Transfer\StaticEquipmentDataIn.aspx.cs">
<DependentUpon>StaticEquipmentDataIn.aspx</DependentUpon>
<Compile Include="Transfer\TelecomDataIn.aspx.cs">
<DependentUpon>TelecomDataIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Transfer\StaticEquipmentDataIn.aspx.designer.cs">
<DependentUpon>StaticEquipmentDataIn.aspx</DependentUpon>
<Compile Include="Transfer\TelecomDataIn.aspx.designer.cs">
<DependentUpon>TelecomDataIn.aspx</DependentUpon>
</Compile>
<Compile Include="Video\Video.aspx.cs">
<DependentUpon>Video.aspx</DependentUpon>
@@ -9,6 +9,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
@@ -9,7 +9,7 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" />
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1"/>
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="HBox" BoxConfigAlign="Stretch">
<Items>
@@ -9,20 +9,19 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" />
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="HBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="开车分包联络" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="DriverSubContactId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="DriverSubContactId" AllowSorting="true" SortField="Code"
runat="server" BoxFlex="1" DataKeyNames="DriverSubPlanId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="DriverSubPlanId" AllowSorting="true" SortField="Code"
SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="True" OnRowCommand="Grid1_RowCommand" OnRowDoubleClick="Grid1_RowDoubleClick">
EnableRowDoubleClickEvent="true" EnableTextSelection="True" OnRowCommand="Grid1_RowCommand" OnRowDoubleClick="Grid1_RowDoubleClick" ForceFit="True">
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:DropDownList ID="drpSubUnitId" runat="server" Label="开车分包单位" LabelAlign="Right" LabelWidth="130px" Width="400px"></f:DropDownList>
<f:Button ID="btnSearch" Icon="SystemSearch" ToolTip="搜索"
EnablePostBack="true" runat="server" OnClick="btnSearch_Click">
<f:Button ID="btnSubContractors" Icon="Table" ToolTip="分包商目录" Text="分包商目录" EnablePostBack="false" runat="server">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" Icon="Add" ToolTip="新增" EnablePostBack="false" runat="server" Hidden="true">
@@ -32,34 +31,13 @@
</Toolbars>
<Columns>
<f:RenderField ColumnID="Code" DataField="Code"
FieldType="String" HeaderText="号" HeaderTextAlign="Center" Width="55px">
FieldType="String" HeaderText="分包计划编号" HeaderTextAlign="Center" TextAlign="Center" >
</f:RenderField>
<f:RenderField ColumnID="SubUnitName" DataField="SubUnitName"
FieldType="String" HeaderText="开车分包单位名称" HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="ContactInfo" DataField="ContactInfo"
FieldType="String" HeaderText="单位联络人/电话" HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="ChargeManInfo" DataField="ChargeManInfo"
FieldType="String" HeaderText="五环负责人/电话" HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="ContactContent" DataField="ContactContent"
FieldType="String" HeaderText="联络内容" HeaderTextAlign="Center" Width="180px">
</f:RenderField>
<f:RenderField ColumnID="Result" DataField="Result"
FieldType="String" HeaderText="结果描述" HeaderTextAlign="Center" Width="160px">
</f:RenderField>
<f:RenderField ColumnID="IntTime" DataField="IntTime"
FieldType="Date" Renderer="Date" HeaderText="进场时间" HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField ColumnID="OutTime" DataField="OutTime"
FieldType="Date" Renderer="Date" HeaderText="离场时间" HeaderTextAlign="Center" Width="100px">
</f:RenderField>
<f:RenderField ColumnID="Remark" DataField="Remark"
FieldType="String" HeaderText="备注" HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:LinkButtonField HeaderText="附件" ConfirmTarget="Top" Width="80px" CommandName="AttachUrl" ColumnID="AttachUrl"
TextAlign="Center" ToolTip="附件查看" Icon="Find" />
<f:TemplateField HeaderText="开车分包类别" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# GetDriverSubName(Eval("DriverSubNames")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
@@ -82,7 +60,7 @@
</f:Panel>
<f:Window ID="Window1" Title="开车分包联络" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
Width="900px" Height="610px">
Width="1000px" Height="710px">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.UI.DataVisualization.Charting;
namespace FineUIPro.Web.TestRun.DriverSub
{
@@ -17,7 +18,7 @@ namespace FineUIPro.Web.TestRun.DriverSub
GetButtonPower();
BindGrid();
btnNew.OnClientClick = Window1.GetShowReference("DriverSubContactEdit.aspx") + "return false;";
BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
btnSubContractors.OnClientClick = Window1.GetShowReference("DriverSubContactorList.aspx") + "return false;";
}
}
#endregion
@@ -26,36 +27,49 @@ namespace FineUIPro.Web.TestRun.DriverSub
//加载列表
public void BindGrid()
{
string strSql = @"SELECT sub.DriverSubContactId,
sub.ProjectId,
sub.Code,
sub.SubUnitId,
sub.ContactInfo,
sub.ChargeManInfo,
sub.ContactContent,
sub.Result,
sub.IntTime,
sub.OutTime,
sub.AttachUrl,
sub.Remark,
Unit.UnitName AS SubUnitName"
+ @" FROM DriverSub_DriverSubContact AS sub"
+ @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = sub.SubUnitId WHERE sub.ProjectId=@projectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.drpSubUnitId.SelectedValue) && this.drpSubUnitId.SelectedValue != BLL.Const._Null)
var q=from x in Funs.DB.DriverSub_DriverSubContact where x.ProjectId==this.CurrUser.LoginProjectId
select x.DriverSubPlanId;
var table = from x in Funs.DB.DriverSub_DriverSubPlan
where x.ProjectId == this.CurrUser.LoginProjectId && q.Contains(x.DriverSubPlanId)
select new
{
strSql += " AND sub.SubUnitId=@subUnitId";
listStr.Add(new SqlParameter("@subUnitId", this.drpSubUnitId.SelectedValue));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
x.DriverSubPlanId,
x.Code,
x.SubUnitId,
x.Introductions,
x.Achievement,
x.Cooperation,
x.InstallationIds,
x.InstallationNames,
x.AttachUrl,
x.Remark,
x.DriverSubNames,
};
table = table.Skip(Grid1.PageSize * Grid1.PageIndex).Take(Grid1.PageSize);
Grid1.DataSource = table;
Grid1.DataBind();
}
public string GetDriverSubName(object str)
{
string strName = "";
if (str != null)
{
string[] strArr = str.ToString().Split(',');
foreach (string s in strArr)
{
foreach (System.Web.UI.WebControls.ListItem item in DropListService.drpDriverSubNameList())
{
if (item.Value == s)
{
strName += item.Text + ",";
}
}
}
}
return strName.TrimEnd(',');
}
#endregion
#region
@@ -139,7 +153,7 @@ namespace FineUIPro.Web.TestRun.DriverSub
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSubContactEdit.aspx?id={0}", Grid1.SelectedRowID, "编辑 - ")));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSubContactEdit.aspx?DriverSubPlanId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
#endregion
@@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub {
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContact {
public partial class DriverSubContact
{
/// <summary>
/// form1 控件。
@@ -58,22 +60,13 @@ namespace FineUIPro.Web.TestRun.DriverSub {
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// drpSubUnitId 控件。
/// btnSubContractors 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSubUnitId;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
protected global::FineUIPro.Button btnSubContractors;
/// <summary>
/// btnNew 控件。
@@ -84,6 +77,15 @@ namespace FineUIPro.Web.TestRun.DriverSub {
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑开车分包联络</title>
</head>
<body>
@@ -26,81 +26,164 @@
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<f:FormRow runat="server">
<Items>
<f:ContentPanel ID="ContentPanel2" ShowBorder="true"
BodyPadding="10px" EnableCollapse="true" ShowHeader="false" AutoScroll="true"
runat="server">
<f:Form ID="Form2" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtCode" runat="server" Label="序号" LabelAlign="Right" LabelWidth="150px" MaxLength="50" Required="true" ShowRedStar="true">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpSubUnitId" runat="server" Label="开车分包单位" LabelAlign="Right" LabelWidth="150px" Required="true" ShowRedStar="true"></f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtContactInfo" runat="server" Label="单位联络人/电话" LabelAlign="Right" LabelWidth="150px" MaxLength="200">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtChargeManInfo" runat="server" Label="五环负责人/电话" LabelAlign="Right" LabelWidth="150px" MaxLength="200">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtContactContent" runat="server" Label="联络内容" LabelAlign="Right" LabelWidth="150px" MaxLength="500">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtResult" runat="server" Label="结果描述" LabelAlign="Right" LabelWidth="150px" MaxLength="500">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker ID="txtIntTime" runat="server" Label="进场时间" LabelAlign="Right" LabelWidth="150px"></f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker ID="txtOutTime" runat="server" Label="离场时间" LabelAlign="Right" LabelWidth="150px"></f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" LabelAlign="Right" LabelWidth="150px" MaxLength="500">
</f:TextArea>
<f:DropDownList ID="drpSubPlanCode" runat="server" Label="分包计划编号" EnableEdit="true" OnSelectedIndexChanged="drpSubPlanCode_OnSelectedIndexChanged" labelWidth="130px" LabelAlign="Right"
AutoPostBack="true" Required="true" ShowRedStar="true" AutoSelectFirstItem="false">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow runat="server">
<Items>
<f:Panel ID="Panel3" Width="300px" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
<Items>
<f:Label ID="lblAttach" runat="server" Label="上传附件"
LabelWidth="150px">
</f:Label>
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="附件" runat="server" OnClick="btnAttach_Click">
</f:Button>
</Items>
</f:Panel>
<f:CheckBoxList ID="DriverSubName" Label="开车分包类别" runat="server" LabelAlign="Right" LabelWidth="130px" Readonly="True" ></f:CheckBoxList>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</f:ContentPanel>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="drpCatalystLoading" EmptyText="请从下拉表格中选择" EnableMultiSelect="true" MatchFieldWidth="false" Label="催化剂装填" LabelWidth="130px" LabelAlign="Right" Required="True" ShowRedStar="True" Hidden="True">
<PopPanel>
<f:Grid ID="Grid1" Width="650px" Height="300px" Hidden="true"
DataIDField="DriverSubContractorsId" DataTextField="SubUnitName" EnableMultiSelect="true" KeepCurrentSelection="true"
PageSize="10" ShowBorder="true" ShowHeader="false"
AllowPaging="true" IsDatabasePaging="true" runat="server" EnableCheckBoxSelect="true"
DataKeyNames="DriverSubContractorsId" OnPageIndexChange="Grid1_PageIndexChange"
AllowSorting="true" SortField="SubUnitName" SortDirection="ASC">
<Columns>
<f:BoundField Width="100px" DataField="SubUnitName" SortField="SubUnitName" DataFormatString="{0}" HeaderText="企业名称" />
<f:BoundField Width="100px" DataField="EnterpriseNature" SortField="EnterpriseNature" DataFormatString="{0}" HeaderText="企业性质" />
<f:BoundField Width="100px" DataField="CollCropCode" SortField="CollCropCode" DataFormatString="{0}" HeaderText="统一社会信用代码" />
<f:BoundField Width="100px" DataField="SafetyProductionLicense" SortField="SafetyProductionLicense" DataFormatString="{0}" HeaderText="安全生产许可证" />
<f:BoundField Width="100px" DataField="QualificationCertificateNumber" SortField="QualificationCertificateNumber" DataFormatString="{0}" HeaderText="资质证书编号" />
<f:BoundField Width="100px" DataField="QualificationType" SortField="QualificationType" DataFormatString="{0}" HeaderText="资质类别" />
<f:BoundField Width="100px" DataField="QualificationLevel" SortField="QualificationLevel" DataFormatString="{0}" HeaderText="资质等级" />
<f:BoundField Width="100px" DataField="Province" SortField="Province" DataFormatString="{0}" HeaderText="省份" />
<f:BoundField Width="100px" DataField="City" SortField="City" DataFormatString="{0}" HeaderText="城市" />
</Columns>
<Toolbars>
<f:Toolbar runat="server" Position="Top">
<Items>
<f:TwinTriggerBox Width="300px" runat="server" EmptyText="在企业名称中查找" ShowLabel="false" ID="ttbSearch1"
ShowTrigger1="false" OnTrigger1Click="ttbSearch1_Trigger1Click" OnTrigger2Click="ttbSearch1_Trigger2Click"
Trigger1Icon="Clear" Trigger2Icon="Search">
</f:TwinTriggerBox>
</Items>
</f:Toolbar>
</Toolbars>
</f:Grid>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="drpOven" EmptyText="请从下拉表格中选择" EnableMultiSelect="true" MatchFieldWidth="false" Label="烘炉" LabelWidth="130px" LabelAlign="Right" Required="True" ShowRedStar="True" Hidden="True">
<PopPanel>
<f:Grid ID="Grid2" Width="650px" Height="300px" Hidden="true"
DataIDField="DriverSubContractorsId" DataTextField="SubUnitName" EnableMultiSelect="true" KeepCurrentSelection="true"
PageSize="10" ShowBorder="true" ShowHeader="false"
AllowPaging="true" IsDatabasePaging="true" runat="server" EnableCheckBoxSelect="true"
DataKeyNames="DriverSubContractorsId" OnPageIndexChange="Grid2_PageIndexChange"
AllowSorting="true" SortField="SubUnitName" SortDirection="ASC">
<Columns>
<f:BoundField Width="100px" DataField="SubUnitName" SortField="SubUnitName" DataFormatString="{0}" HeaderText="企业名称" />
<f:BoundField Width="100px" DataField="EnterpriseNature" SortField="EnterpriseNature" DataFormatString="{0}" HeaderText="企业性质" />
<f:BoundField Width="100px" DataField="CollCropCode" SortField="CollCropCode" DataFormatString="{0}" HeaderText="统一社会信用代码" />
<f:BoundField Width="100px" DataField="SafetyProductionLicense" SortField="SafetyProductionLicense" DataFormatString="{0}" HeaderText="安全生产许可证" />
<f:BoundField Width="100px" DataField="QualificationCertificateNumber" SortField="QualificationCertificateNumber" DataFormatString="{0}" HeaderText="资质证书编号" />
<f:BoundField Width="100px" DataField="QualificationType" SortField="QualificationType" DataFormatString="{0}" HeaderText="资质类别" />
<f:BoundField Width="100px" DataField="QualificationLevel" SortField="QualificationLevel" DataFormatString="{0}" HeaderText="资质等级" />
<f:BoundField Width="100px" DataField="Province" SortField="Province" DataFormatString="{0}" HeaderText="省份" />
<f:BoundField Width="100px" DataField="City" SortField="City" DataFormatString="{0}" HeaderText="城市" />
</Columns>
<Toolbars>
<f:Toolbar runat="server" Position="Top">
<Items>
<f:TwinTriggerBox Width="300px" runat="server" EmptyText="在企业名称中查找" ShowLabel="false" ID="ttbSearch2"
ShowTrigger1="false" OnTrigger1Click="ttbSearch2_Trigger1Click" OnTrigger2Click="ttbSearch2_Trigger2Click"
Trigger1Icon="Clear" Trigger2Icon="Search">
</f:TwinTriggerBox>
</Items>
</f:Toolbar>
</Toolbars>
</f:Grid>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="drpChemicalCleaning" EmptyText="请从下拉表格中选择" EnableMultiSelect="true" MatchFieldWidth="false" Label="化学清洗" LabelWidth="130px" LabelAlign="Right" Required="True" ShowRedStar="True" Hidden="True">
<PopPanel>
<f:Grid ID="Grid3" Width="650px" Height="300px" Hidden="true"
DataIDField="DriverSubContractorsId" DataTextField="SubUnitName" EnableMultiSelect="true" KeepCurrentSelection="true"
PageSize="10" ShowBorder="true" ShowHeader="false"
AllowPaging="true" IsDatabasePaging="true" runat="server" EnableCheckBoxSelect="true"
DataKeyNames="DriverSubContractorsId" OnPageIndexChange="Grid3_PageIndexChange"
AllowSorting="true" SortField="SubUnitName" SortDirection="ASC">
<Columns>
<f:BoundField Width="100px" DataField="SubUnitName" SortField="SubUnitName" DataFormatString="{0}" HeaderText="企业名称" />
<f:BoundField Width="100px" DataField="EnterpriseNature" SortField="EnterpriseNature" DataFormatString="{0}" HeaderText="企业性质" />
<f:BoundField Width="100px" DataField="CollCropCode" SortField="CollCropCode" DataFormatString="{0}" HeaderText="统一社会信用代码" />
<f:BoundField Width="100px" DataField="SafetyProductionLicense" SortField="SafetyProductionLicense" DataFormatString="{0}" HeaderText="安全生产许可证" />
<f:BoundField Width="100px" DataField="QualificationCertificateNumber" SortField="QualificationCertificateNumber" DataFormatString="{0}" HeaderText="资质证书编号" />
<f:BoundField Width="100px" DataField="QualificationType" SortField="QualificationType" DataFormatString="{0}" HeaderText="资质类别" />
<f:BoundField Width="100px" DataField="QualificationLevel" SortField="QualificationLevel" DataFormatString="{0}" HeaderText="资质等级" />
<f:BoundField Width="100px" DataField="Province" SortField="Province" DataFormatString="{0}" HeaderText="省份" />
<f:BoundField Width="100px" DataField="City" SortField="City" DataFormatString="{0}" HeaderText="城市" />
</Columns>
<Toolbars>
<f:Toolbar runat="server" Position="Top">
<Items>
<f:TwinTriggerBox Width="300px" runat="server" EmptyText="在企业名称中查找" ShowLabel="false" ID="ttbSearch3"
ShowTrigger1="false" OnTrigger1Click="ttbSearch3_Trigger1Click" OnTrigger2Click="ttbSearch3_Trigger2Click"
Trigger1Icon="Clear" Trigger2Icon="Search">
</f:TwinTriggerBox>
</Items>
</f:Toolbar>
</Toolbars>
</f:Grid>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="drpDrivingTeam" EmptyText="请从下拉表格中选择" EnableMultiSelect="true" MatchFieldWidth="false" Label="开车队" LabelWidth="130px" LabelAlign="Right" Required="True" ShowRedStar="True" Hidden="True">
<PopPanel>
<f:Grid ID="Grid4" Width="650px" Height="300px" Hidden="true"
DataIDField="DriverSubContractorsId" DataTextField="SubUnitName" EnableMultiSelect="true" KeepCurrentSelection="true"
PageSize="10" ShowBorder="true" ShowHeader="false"
AllowPaging="true" IsDatabasePaging="true" runat="server" EnableCheckBoxSelect="true"
DataKeyNames="DriverSubContractorsId" OnPageIndexChange="Grid4_PageIndexChange"
AllowSorting="true" SortField="SubUnitName" SortDirection="ASC">
<Columns>
<f:BoundField Width="100px" DataField="SubUnitName" SortField="SubUnitName" DataFormatString="{0}" HeaderText="企业名称" />
<f:BoundField Width="100px" DataField="EnterpriseNature" SortField="EnterpriseNature" DataFormatString="{0}" HeaderText="企业性质" />
<f:BoundField Width="100px" DataField="CollCropCode" SortField="CollCropCode" DataFormatString="{0}" HeaderText="统一社会信用代码" />
<f:BoundField Width="100px" DataField="SafetyProductionLicense" SortField="SafetyProductionLicense" DataFormatString="{0}" HeaderText="安全生产许可证" />
<f:BoundField Width="100px" DataField="QualificationCertificateNumber" SortField="QualificationCertificateNumber" DataFormatString="{0}" HeaderText="资质证书编号" />
<f:BoundField Width="100px" DataField="QualificationType" SortField="QualificationType" DataFormatString="{0}" HeaderText="资质类别" />
<f:BoundField Width="100px" DataField="QualificationLevel" SortField="QualificationLevel" DataFormatString="{0}" HeaderText="资质等级" />
<f:BoundField Width="100px" DataField="Province" SortField="Province" DataFormatString="{0}" HeaderText="省份" />
<f:BoundField Width="100px" DataField="City" SortField="City" DataFormatString="{0}" HeaderText="城市" />
</Columns>
<Toolbars>
<f:Toolbar runat="server" Position="Top">
<Items>
<f:TwinTriggerBox Width="300px" runat="server" EmptyText="在企业名称中查找" ShowLabel="false" ID="ttbSearch4"
ShowTrigger1="false" OnTrigger1Click="ttbSearch4_Trigger1Click" OnTrigger2Click="ttbSearch4_Trigger2Click"
Trigger1Icon="Clear" Trigger2Icon="Search">
</f:TwinTriggerBox>
</Items>
</f:Toolbar>
</Toolbars>
</f:Grid>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
</Rows>
@@ -1,9 +1,11 @@
using BLL;
using NPOI.POIFS.Crypt.Dsig;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.TestRun.DriverSub
@@ -20,28 +22,19 @@ namespace FineUIPro.Web.TestRun.DriverSub
{
if (!IsPostBack)
{
BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
DriverSubPlanService.InitSubPlanDropDownList(drpSubPlanCode,this.CurrUser.LoginProjectId,true);
DriverSubName.DataSource = DropListService.drpDriverSubNameList();
DriverSubName.DataTextField = "Text";
DriverSubName.DataValueField = "Value";
DriverSubName.DataBind();
string driverSubPlanId = Request.Params["DriverSubPlanId"];
if (!string.IsNullOrEmpty(driverSubPlanId))
{
Model.DriverSub_DriverSubContact data = BLL.DriverSubContactService.GetDriverSubContactById(id);
if (data != null)
{
this.hdId.Text = id;
this.txtCode.Text = data.Code;
if (!string.IsNullOrEmpty(data.SubUnitId))
{
this.drpSubUnitId.SelectedValue = data.SubUnitId;
}
this.txtContactInfo.Text = data.ContactInfo;
this.txtChargeManInfo.Text = data.ChargeManInfo;
this.txtContactContent.Text = data.ContactContent;
this.txtResult.Text = data.Result;
this.txtIntTime.Text = data.IntTime.HasValue ? string.Format("{0:yyyy-MM-dd}", data.IntTime) : "";
this.txtOutTime.Text = data.OutTime.HasValue ? string.Format("{0:yyyy-MM-dd}", data.OutTime) : "";
this.txtRemark.Text = data.Remark;
}
drpSubPlanCode.SelectedValue= driverSubPlanId;
drpSubPlanCode_OnSelectedIndexChanged(null, null);
}
}
}
#endregion
@@ -70,47 +63,191 @@ namespace FineUIPro.Web.TestRun.DriverSub
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpSubUnitId.SelectedValue == BLL.Const._Null)
if (string.IsNullOrEmpty(drpSubPlanCode.SelectedValue) || drpSubPlanCode.SelectedValue == Const._Null)
{
Alert.ShowInTop("请选择开车分包单位", MessageBoxIcon.Warning);
ShowNotify("请选择分包计划", MessageBoxIcon.Warning);
return;
}
string id = Request.Params["id"];
Model.DriverSub_DriverSubContact newData = new Model.DriverSub_DriverSubContact();
newData.Code = this.txtCode.Text.Trim();
if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
{
newData.SubUnitId = this.drpSubUnitId.SelectedValue;
}
newData.ContactInfo = this.txtContactInfo.Text.Trim();
newData.ChargeManInfo = this.txtChargeManInfo.Text.Trim();
newData.ContactContent = this.txtContactContent.Text.Trim();
newData.Result = this.txtResult.Text.Trim();
newData.IntTime = Funs.GetNewDateTime(this.txtIntTime.Text.Trim());
newData.OutTime = Funs.GetNewDateTime(this.txtOutTime.Text.Trim());
newData.Remark = this.txtRemark.Text.Trim();
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
newData.DriverSubContactId = id;
BLL.DriverSubContactService.UpdateDriverSubContact(newData);
}
else
{
if (!string.IsNullOrEmpty(this.hdId.Text))
{
newData.DriverSubContactId = this.hdId.Text.Trim();
}
else
{
newData.DriverSubContactId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContact));
this.hdId.Text = newData.DriverSubContactId;
}
BLL.DriverSubContactService.AddDriverSubContact(newData);
}
DriverSubContactService.DeleteDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue);
GridSave(drpCatalystLoading.Values,"1");
GridSave(drpOven.Values,"2");
GridSave(drpChemicalCleaning.Values,"3");
GridSave(drpDrivingTeam.Values,"4");
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
void GridSave(string[] DriverSubContractorsIdArray,string type )
{
string id = drpSubPlanCode.SelectedValue;
foreach (var item in DriverSubContractorsIdArray)
{
Model.DriverSub_DriverSubContact newData = new Model.DriverSub_DriverSubContact();
newData.DriverSubContactId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContact));
newData.ProjectId = this.CurrUser.LoginProjectId;
newData.DriverSubPlanId = id;
newData.DriverSubContractorsId = item;
newData.SubcontractingType = type;
BLL.DriverSubContactService.AddDriverSubContact(newData);
}
}
#endregion
void BindGrid(Grid grid, string type, string driverSubPlanId, string subUnitName)
{
//使用linq 查询DriverSub_DriverSubContact表 DriverSubPlanId下关联的分包经销商信息
var q = from x in Funs.DB.DriverSub_DriverSubContractors
where x.IsUse == true && x.SubcontractingType== type
select x;
if (!string.IsNullOrEmpty(subUnitName))
{
q = q.Where(x => x.SubUnitName.Contains(subUnitName));
}
int count = q.Count();
q = q.Skip(grid.PageSize * grid.PageIndex).Take(grid.PageSize);
grid.RecordCount= count;
grid.DataSource = q;
grid.DataBind();
}
#region
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid(Grid1,"1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
}
protected void ttbSearch1_Trigger1Click(object sender, EventArgs e)
{
ttbSearch1.Text = String.Empty;
ttbSearch1.ShowTrigger1 = false;
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
}
protected void ttbSearch1_Trigger2Click(object sender, EventArgs e)
{
ttbSearch1.ShowTrigger1 = true;
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
}
protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
}
protected void ttbSearch2_Trigger1Click(object sender, EventArgs e)
{
ttbSearch2.Text = String.Empty;
ttbSearch2.ShowTrigger1 = false;
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
}
protected void ttbSearch2_Trigger2Click(object sender, EventArgs e)
{
ttbSearch2.ShowTrigger1 = true;
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
}
protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
}
protected void ttbSearch3_Trigger1Click(object sender, EventArgs e)
{
ttbSearch3.Text = String.Empty;
ttbSearch3.ShowTrigger1 = false;
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
}
protected void ttbSearch3_Trigger2Click(object sender, EventArgs e)
{
ttbSearch3.ShowTrigger1 = true;
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
}
protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
}
protected void ttbSearch4_Trigger1Click(object sender, EventArgs e)
{
ttbSearch4.Text = String.Empty;
ttbSearch4.ShowTrigger1 = false;
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
}
protected void ttbSearch4_Trigger2Click(object sender, EventArgs e)
{
ttbSearch4.ShowTrigger1 = true;
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
}
#endregion
#region
protected void drpSubPlanCode_OnSelectedIndexChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(drpSubPlanCode.SelectedValue)|| drpSubPlanCode.SelectedValue==Const._Null)
{
drpCatalystLoading.Hidden = true;
drpOven.Hidden = true;
drpChemicalCleaning.Hidden = true;
drpDrivingTeam.Hidden = true;
DriverSubName.SelectedValueArray=null;
return;
}
var model = BLL.DriverSubPlanService.GetDriverSubPlanById(drpSubPlanCode.SelectedValue);
if (model!=null)
{
BindGrid(Grid1, "1", drpSubPlanCode.SelectedValue, ttbSearch1.Text);
BindGrid(Grid2, "2", drpSubPlanCode.SelectedValue, ttbSearch2.Text);
BindGrid(Grid3, "3", drpSubPlanCode.SelectedValue, ttbSearch3.Text);
BindGrid(Grid4, "4", drpSubPlanCode.SelectedValue, ttbSearch4.Text);
this.DriverSubName.SelectedValueArray = model.DriverSubNames.Split(',');
foreach (string item in DriverSubName.SelectedValueArray)
{
if (item.Contains("1"))
{
drpCatalystLoading.Hidden = false;
drpCatalystLoading.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
.Where(x => x.SubcontractingType == "1").Select(x => x.DriverSubContractorsId).ToArray();
}
else if (item.Contains("2"))
{
drpOven.Hidden = false;
drpOven.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
.Where(x => x.SubcontractingType == "2").Select(x => x.DriverSubContractorsId).ToArray();
}
else if (item.Contains("3"))
{
drpChemicalCleaning.Hidden = false;
drpChemicalCleaning.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
.Where(x => x.SubcontractingType == "3").Select(x => x.DriverSubContractorsId).ToArray();
}
else if (item.Contains("4"))
{
drpDrivingTeam.Hidden= false;
drpDrivingTeam.Values = DriverSubContactService.GetDriverSubContactByDriverSubPlanId(drpSubPlanCode.SelectedValue)
.Where(x => x.SubcontractingType == "4").Select(x => x.DriverSubContractorsId).ToArray();
}
}
}
}
#endregion
}
}
@@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub {
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactEdit {
public partial class DriverSubContactEdit
{
/// <summary>
/// form1 控件。
@@ -85,130 +87,130 @@ namespace FineUIPro.Web.TestRun.DriverSub {
protected global::FineUIPro.HiddenField hdId;
/// <summary>
/// ContentPanel2 控件。
/// drpSubPlanCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ContentPanel ContentPanel2;
protected global::FineUIPro.DropDownList drpSubPlanCode;
/// <summary>
/// Form2 控件。
/// DriverSubName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form Form2;
protected global::FineUIPro.CheckBoxList DriverSubName;
/// <summary>
/// txtCode 控件。
/// drpCatalystLoading 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCode;
protected global::FineUIPro.DropDownBox drpCatalystLoading;
/// <summary>
/// drpSubUnitId 控件。
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSubUnitId;
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// txtContactInfo 控件。
/// ttbSearch1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtContactInfo;
protected global::FineUIPro.TwinTriggerBox ttbSearch1;
/// <summary>
/// txtChargeManInfo 控件。
/// drpOven 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtChargeManInfo;
protected global::FineUIPro.DropDownBox drpOven;
/// <summary>
/// txtContactContent 控件。
/// Grid2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtContactContent;
protected global::FineUIPro.Grid Grid2;
/// <summary>
/// txtResult 控件。
/// ttbSearch2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtResult;
protected global::FineUIPro.TwinTriggerBox ttbSearch2;
/// <summary>
/// txtIntTime 控件。
/// drpChemicalCleaning 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtIntTime;
protected global::FineUIPro.DropDownBox drpChemicalCleaning;
/// <summary>
/// txtOutTime 控件。
/// Grid3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtOutTime;
protected global::FineUIPro.Grid Grid3;
/// <summary>
/// txtRemark 控件。
/// ttbSearch3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
protected global::FineUIPro.TwinTriggerBox ttbSearch3;
/// <summary>
/// Panel3 控件。
/// drpDrivingTeam 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel3;
protected global::FineUIPro.DropDownBox drpDrivingTeam;
/// <summary>
/// lblAttach 控件。
/// Grid4 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lblAttach;
protected global::FineUIPro.Grid Grid4;
/// <summary>
/// btnAttach 控件。
/// ttbSearch4 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAttach;
protected global::FineUIPro.TwinTriggerBox ttbSearch4;
/// <summary>
/// WindowAtt 控件。
@@ -0,0 +1,36 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DriverSubContactIn.aspx.cs" Inherits="FineUIPro.Web.TestRun.DriverSub.DriverSubContactIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导入</title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Toolbars>
<f:Toolbar ID="Toolbar1" runat="server" Position="Bottom">
<Items>
<f:Label runat="server" Text="分包类别分为:催化剂装填,烘炉,化学清洗,开车队"/>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnImport" Icon="DoorIn" runat="server" Text="导入" ToolTip="数据导入" ValidateForms="SimpleForm1"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板" ToolTip="下载模板" OnClick="btnDownLoad_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="请选择导入的Eexce文件" Width="500px">
</f:FileUpload>
<f:HiddenField ID="hdFileName" runat="server"></f:HiddenField>
</Items>
</f:Panel>
</form>
</body>
</html>
@@ -0,0 +1,259 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactIn : PageBase
{
public string ContractId
{
get
{
return (string)ViewState["ContractId"];
}
set
{
ViewState["ContractId"] = value;
}
}
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private readonly string initPath = Const.ExcelUrl; //"File\\Excel\\DataIn\\";
/// <summary>
/// 错误集合
/// </summary>
public static string errorInfos = string.Empty;
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ContractId = Request.Params["ContractId"];
}
}
protected void btnImport_Click(object sender, EventArgs e)
{
errorInfos = string.Empty;
if (fuAttachUrl.HasFile == false)
{
ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning);
return;
}
var IsXls = Path.GetExtension(fuAttachUrl.FileName).Trim().ToLower();
if (IsXls != ".xlsx")
{
ShowNotify("只能选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(errorInfos)) errorInfos = string.Empty;
var rootPath = Server.MapPath("~/");
var initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath)) Directory.CreateDirectory(initFullPath);
//指定上传文件名称
hdFileName.Text = Funs.GetNewFileName() + IsXls;
//上传文件路径
var filePath = initFullPath + hdFileName.Text;
//文件上传服务器
fuAttachUrl.PostedFile.SaveAs(filePath);
//文件上传服务器后的名称
var fileName = rootPath + initPath + hdFileName.Text;
//读取Excel
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
File.Delete(fileName);
//将ds数据转换成 List<Model.DriverSub_DriverSubContractors>
var list = new List<Model.DriverSub_DriverSubContractors>();
if (ds == null)
{
this.fuAttachUrl.Reset();
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrWhiteSpace(message))
{
ShowNotify(message, MessageBoxIcon.Warning);
return;
}
if (ds.Tables[0].Rows.Count > 1)
{
var fileVerify = VerifyFile(ds);
if (!fileVerify)
{
this.fuAttachUrl.Reset();
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
return;
}
for (var i = 1; i < ds.Tables[0].Rows.Count; i++)
{
if (string.IsNullOrEmpty(ds.Tables[0].Rows[i][1].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][2].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][3].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][4].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][5].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][6].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][7].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][8].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][9].ToString()) ||
string.IsNullOrEmpty(ds.Tables[0].Rows[i][10].ToString()) )
{
errorInfos += "第" + (i + 1) + "行数据不完整,请检查!";
continue;
}
var model = new Model.DriverSub_DriverSubContractors();
model.DriverSubContractorsId = Guid.NewGuid().ToString();
model.SubUnitName = ds.Tables[0].Rows[i][1].ToString();
model.EnterpriseNature = ds.Tables[0].Rows[i][2].ToString();
model.SubcontractingType = ds.Tables[0].Rows[i][3].ToString();
model.CollCropCode = ds.Tables[0].Rows[i][4].ToString();
model.SafetyProductionLicense = ds.Tables[0].Rows[i][5].ToString();
model.QualificationCertificateNumber = ds.Tables[0].Rows[i][6].ToString();
model.QualificationType = ds.Tables[0].Rows[i][7].ToString();
model.QualificationLevel = ds.Tables[0].Rows[i][8].ToString();
model.Province = ds.Tables[0].Rows[i][9].ToString();
model.City = ds.Tables[0].Rows[i][10].ToString();
model.IsUse = true;
var subcontractingType = model.SubcontractingType;
var subcontractingTypeList = BLL.DropListService.drpDriverSubNameList();
var typemodel= subcontractingTypeList.Where(x => x.Text == subcontractingType).FirstOrDefault();
if (typemodel==null)
{
errorInfos += "第" + (i + 1) + "行分包类别不存在,请检查!";
}
else
{
model.SubcontractingType= typemodel.Value;
}
list.Add(model);
}
if (string.IsNullOrEmpty(errorInfos))
{
DriversubcontractorsService.UpdateDriverSub_DriverSubContractorsIsUse();
AddOrUpdate(list);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify(errorInfos, MessageBoxIcon.Warning);
}
}
}
/// <summary>
/// 插入或更新数据
/// </summary>
/// <param name="list"></param>
private void AddOrUpdate(List<Model.DriverSub_DriverSubContractors> list)
{
foreach (var item in list)
{
var model = BLL.DriversubcontractorsService.GetDriverSubContractorsByCollCropCode(item.CollCropCode);
if (model != null)
{
model.SubUnitName = item.SubUnitName;
model.EnterpriseNature = item.EnterpriseNature;
model.SubcontractingType = item.SubcontractingType;
model.CollCropCode = item.CollCropCode;
model.SafetyProductionLicense = item.SafetyProductionLicense;
model.QualificationCertificateNumber = item.QualificationCertificateNumber;
model.QualificationType = item.QualificationType;
model.QualificationLevel = item.QualificationLevel;
model.Province = item.Province;
model.City = item.City;
model.IsUse = item.IsUse;
BLL.DriversubcontractorsService.UpdateDriverSub_DriverSubContractors(model);
}
else
{
BLL.DriversubcontractorsService.AddDriverSub_DriverSubContractors(item);
}
}
}
private bool VerifyFile(DataSet ds)
{
var result = true;
if (ds.Tables[0].Rows[1][0].ToString().Contains("序号")) result = false;
if (ds.Tables[0].Rows[1][1].ToString().Contains("企业名称")) result = false;
if (ds.Tables[0].Rows[1][2].ToString().Contains("企业性质")) result = false;
if (ds.Tables[0].Rows[1][3].ToString().Contains("分包类别")) result = false;
if (ds.Tables[0].Rows[1][4].ToString().Contains("统一社会信用代码")) result = false;
if (ds.Tables[0].Rows[1][5].ToString().Contains("安全生产许可证")) result = false;
if (ds.Tables[0].Rows[1][6].ToString().Contains("资质证书编号")) result = false;
if (ds.Tables[0].Rows[1][7].ToString().Contains("资质类别")) result = false;
if (ds.Tables[0].Rows[1][8].ToString().Contains("资质等级")) result = false;
if (ds.Tables[0].Rows[1][9].ToString().Contains("省份")) result = false;
if (ds.Tables[0].Rows[1][10].ToString().Contains("城市")) result = false;
return result;
}
#region
/// <summary>
/// 模板下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定要下载模板吗?", string.Empty,
MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"),
PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
var rootPath = Server.MapPath("~/");
var uploadfilepath = rootPath + Const.DriverSubContactTemplateUrl;
var filePath = Const.DriverSubContactTemplateUrl;
var fileName = Path.GetFileName(filePath);
var info = new FileInfo(uploadfilepath);
var fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition",
"attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}
@@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
}
}
@@ -0,0 +1,103 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DriverSubContactorEdit.aspx.cs" Inherits="FineUIPro.Web.TestRun.DriverSub.DriverSubContactorEdit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="~/res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtSubUnitName" runat="server" Label="企业名称" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtEnterpriseNature" runat="server" Label="企业性质" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="DrpSubcontractingType" Label="分包类别" runat="server" Required="True" ShowRedStar="True" ></f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtCollCropCode" runat="server" Label="统一社会信用代码" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtSafetyProductionLicense" runat="server" Label="安全生产许可证" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtQualificationCertificateNumber" runat="server" Label="资质证书编号" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtQualificationType" runat="server" Label="资质类别" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtQualificationLevel" runat="server" Label="资质等级" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtProvince" runat="server" Label="省份" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtCity" runat="server" Label="城市" MaxLength="200" Required="True" ShowRedStar="True">
</f:TextBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" Text="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:Window ID="Window1" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</form>
</body>
</html>
@@ -0,0 +1,96 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactorEdit
: PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string DriverSubContractorsId
{
get
{
return (string)ViewState["DriverSubContractorsId"];
}
set
{
ViewState["DriverSubContractorsId"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
DrpSubcontractingType.DataSource = DropListService.drpDriverSubNameList();
DrpSubcontractingType.DataTextField = "Text";
DrpSubcontractingType.DataValueField = "Value";
DrpSubcontractingType.DataBind();
this.DriverSubContractorsId = Request.Params["DriverSubContractorsId"];
if (!string.IsNullOrEmpty(this.DriverSubContractorsId))
{
Model.DriverSub_DriverSubContractors model = BLL.DriversubcontractorsService.GetDriverSub_DriverSubContractorsById(this.DriverSubContractorsId);
if (model != null)
{
this.txtSubUnitName.Text = model.SubUnitName;
this.txtEnterpriseNature.Text = model.EnterpriseNature;
this.DrpSubcontractingType.SelectedValue = model.SubcontractingType;
this.txtCollCropCode.Text = model.CollCropCode;
this.txtSafetyProductionLicense.Text = model.SafetyProductionLicense;
this.txtQualificationCertificateNumber.Text = model.QualificationCertificateNumber;
this.txtQualificationType.Text = model.QualificationType;
this.txtQualificationLevel.Text = model.QualificationLevel;
this.txtProvince.Text = model.Province;
this.txtCity.Text = model.City;
}
}
}
}
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.DriverSub_DriverSubContractors table = new Model.DriverSub_DriverSubContractors();
table.SubUnitName = this.txtSubUnitName.Text;
table.EnterpriseNature = this.txtEnterpriseNature.Text;
table.SubcontractingType = this.DrpSubcontractingType.SelectedValue;
table.CollCropCode = this.txtCollCropCode.Text;
table.SafetyProductionLicense = this.txtSafetyProductionLicense.Text;
table.QualificationCertificateNumber = this.txtQualificationCertificateNumber.Text;
table.QualificationType = this.txtQualificationType.Text;
table.QualificationLevel = this.txtQualificationLevel.Text;
table.Province = this.txtProvince.Text;
table.City = this.txtCity.Text;
if (string.IsNullOrEmpty(this.DriverSubContractorsId))
{
table.DriverSubContractorsId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContractors));
BLL.DriversubcontractorsService.AddDriverSub_DriverSubContractors(table);
}
else
{
table.DriverSubContractorsId = this.DriverSubContractorsId;
BLL.DriversubcontractorsService.UpdateDriverSub_DriverSubContractors(table);
}
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
}
}
@@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactorEdit
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtSubUnitName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSubUnitName;
/// <summary>
/// txtEnterpriseNature 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtEnterpriseNature;
/// <summary>
/// DrpSubcontractingType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList DrpSubcontractingType;
/// <summary>
/// txtCollCropCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCollCropCode;
/// <summary>
/// txtSafetyProductionLicense 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSafetyProductionLicense;
/// <summary>
/// txtQualificationCertificateNumber 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtQualificationCertificateNumber;
/// <summary>
/// txtQualificationType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtQualificationType;
/// <summary>
/// txtQualificationLevel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtQualificationLevel;
/// <summary>
/// txtProvince 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtProvince;
/// <summary>
/// txtCity 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCity;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
}
}
@@ -0,0 +1,147 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DriverSubContactorList.aspx.cs" Inherits="FineUIPro.Web.TestRun.DriverSub.DriverSubContactorList" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.f-grid-row .f-grid-cell-inner {
white-space: normal;
word-break: break-all;
}
.f-grid-row.yellow
{
background-color: YellowGreen;
background-image: none;
}
.f-grid-row.red
{
background-color: Yellow;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false" AutoScroll="true"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="DriverSubContractorsId" AllowCellEditing="true"
ClicksToEdit="2" DataIDField="DriverSubContractorsId" AllowSorting="true" SortField="DriverSubContractorsId"
SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:TextBox runat="server" ID="txtSubUnitName" LabelAlign="Right" LabelWidth="130px" Label="企业名称"/>
<f:DropDownList ID="drpSubcontractingType" runat="server" Label="分包类别" LabelAlign="Right" LabelWidth="130px" ></f:DropDownList>
<f:Button ID="btnSearch" Icon="SystemSearch" ToolTip="搜索"
EnablePostBack="true" runat="server" OnClick="btnSearch_Click" >
</f:Button>
<f:Button ID="btnReset" Icon="ArrowUndo" ToolTip="重置"
EnablePostBack="true" runat="server" OnClick="btnReset_Click" />
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnImport" runat="server" OnClick="btnImport_Click" Text="导入"></f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField ColumnID="tfNumber" Width="50px" HeaderText="序号" HeaderTextAlign="Center"
TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="150px" ColumnID="SubUnitName" DataField="SubUnitName" SortField="SubUnitName"
FieldType="String" HeaderText="企业名称" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="EnterpriseNature" DataField="EnterpriseNature" SortField="EnterpriseNature"
FieldType="String" HeaderText="企业性质" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:TemplateField HeaderText="分包类别" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# GetDriverSubName(Eval("SubcontractingType")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="150px" ColumnID="CollCropCode" DataField="CollCropCode" SortField="CollCropCode"
FieldType="String" HeaderText="统一社会信用代码" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="SafetyProductionLicense" DataField="SafetyProductionLicense" SortField="SafetyProductionLicense"
FieldType="String" HeaderText="安全生产许可证" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="QualificationCertificateNumber" DataField="QualificationCertificateNumber" SortField="QualificationCertificateNumber"
FieldType="String" HeaderText="资质证书编号" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="QualificationType" DataField="QualificationType" SortField="QualificationType"
FieldType="String" HeaderText="资质类别" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="QualificationLevel" DataField="QualificationLevel" SortField="QualificationLevel"
FieldType="String" HeaderText="资质等级" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="Province" DataField="Province" SortField="Province"
FieldType="String" HeaderText="省份" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
<f:RenderField Width="150px" ColumnID="City" DataField="City" SortField="City"
FieldType="String" HeaderText="城市" TextAlign="Left" HeaderTextAlign="Center" >
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" runat="server" Hidden="true" ShowHeader="true"
IsModal="true" Target="Parent" EnableMaximize="true" EnableResize="true" OnClose="Window1_Close"
Title="编辑" EnableIFrame="true" Height="650px"
Width="600px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnEdit_Click" EnablePostBack="true"
runat="server" Text="编辑" Icon="TableEdit" >
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnDelete_Click" EnablePostBack="true" Icon="Delete"
ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,274 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactorList : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
drpSubcontractingType.DataSource = DropListService.drpDriverSubNameList();
drpSubcontractingType.DataTextField = "Text";
drpSubcontractingType.DataValueField = "Value";
drpSubcontractingType.DataBind();
Funs.FineUIPleaseSelect(drpSubcontractingType);
// 绑定表格
this.BindGrid();
}
}
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
Model.DriverSub_DriverSubContractors table = new Model.DriverSub_DriverSubContractors();
if (!string.IsNullOrEmpty(txtSubUnitName.Text))
{
table.SubUnitName = txtSubUnitName.Text.Trim();
}
if (drpSubcontractingType.SelectedValue!= Const._Null)
{
table.SubcontractingType = drpSubcontractingType.SelectedValue;
}
var tb = BLL.DriversubcontractorsService.GetListData(table, Grid1);
Grid1.RecordCount = DriversubcontractorsService.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
Grid1.DataSource = tb;
Grid1.DataBind();
}
public string GetDriverSubName(object str)
{
string strName = "";
if (str != null)
{
string[] strArr = str.ToString().Split(',');
foreach (string s in strArr)
{
foreach (System.Web.UI.WebControls.ListItem item in DropListService.drpDriverSubNameList())
{
if (item.Value == s)
{
strName += item.Text + ",";
}
}
}
}
return strName.TrimEnd(',');
}
#endregion
#region GV
/// <summary>
/// 过滤表头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void Grid1_FilterChange(object sender, EventArgs e)
//{
// this.BindGrid();
//}
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
this.Grid1.PageIndex = e.NewPageIndex;
this.BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
this.Grid1.SortDirection = e.SortDirection;
this.Grid1.SortField = e.SortField;
this.BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 编辑按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string ID = Grid1.SelectedRowID;
var model = BLL.DriversubcontractorsService.GetDriverSub_DriverSubContractorsById(ID);
if (model != null) ///已上报时不能删除
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSubContactorEdit.aspx?DriverSubContractorsId={0}", ID, "编辑 - ")));
}
}
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.btnEdit_Click(null, null);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var model = BLL.DriversubcontractorsService.GetDriverSub_DriverSubContractorsById(rowID);
if (model != null)
{
BLL.DriversubcontractorsService.DeleteDriverSub_DriverSubContractorsById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region
#endregion
#region
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = 500;
this.BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
/// <summary>
/// 导出方法
/// </summary>
/// <param name="grid"></param>
/// <returns></returns>
private string GetGridTableHtml(Grid grid)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
string html = row.Values[column.ColumnIndex].ToString();
if (column.ColumnID == "tfNumber")
{
html = (row.FindControl("lblNumber") as System.Web.UI.WebControls.Label).Text;
}
sb.AppendFormat("<td>{0}</td>", html);
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
#endregion
#region
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSubContactIn.aspx", "编辑 - ")));
}
#endregion
#region
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
protected void btnReset_Click(object sender, EventArgs e)
{
txtSubUnitName.Text = null;
drpSubcontractingType.SelectedValue = Const._Null;
BindGrid();
}
#endregion
}
}
@@ -0,0 +1,197 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubContactorList
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// txtSubUnitName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSubUnitName;
/// <summary>
/// drpSubcontractingType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSubcontractingType;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnReset 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnReset;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// lblNumber 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumber;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -9,20 +9,20 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" />
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="HBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="开车分包计划" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="DriverSubPlanId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="DriverSubPlanId" AllowSorting="true" SortField="Code"
SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="True" OnRowCommand="Grid1_RowCommand" OnRowDoubleClick="Grid1_RowDoubleClick">
EnableRowDoubleClickEvent="true" EnableTextSelection="True" OnRowCommand="Grid1_RowCommand" OnRowDoubleClick="Grid1_RowDoubleClick" ForceFit="True" >
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:DropDownList ID="drpSubUnitId" runat="server" Label="开车分包单位" LabelAlign="Right" LabelWidth="130px" Width="400px"></f:DropDownList>
<f:DropDownList ID="drpSubUnitId" runat="server" Label="开车分包单位" LabelAlign="Right" LabelWidth="130px" Width="400px" Hidden="True"></f:DropDownList>
<f:Button ID="btnSearch" Icon="SystemSearch" ToolTip="搜索"
EnablePostBack="true" runat="server" OnClick="btnSearch_Click">
EnablePostBack="true" runat="server" OnClick="btnSearch_Click" Hidden="True">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" Icon="Add" ToolTip="新增" EnablePostBack="false" runat="server" Hidden="true">
@@ -32,31 +32,18 @@
</Toolbars>
<Columns>
<f:RenderField ColumnID="Code" DataField="Code"
FieldType="String" HeaderText="号" HeaderTextAlign="Center" Width="55px">
FieldType="String" HeaderText="号" HeaderTextAlign="Center" TextAlign="Center" Width="55px">
</f:RenderField>
<f:RenderField ColumnID="SubUnitName" DataField="SubUnitName"
FieldType="String" HeaderText="开车分包单位名称" HeaderTextAlign="Center" Width="210px">
</f:RenderField>
<f:RenderField ColumnID="Introductions" DataField="Introductions"
FieldType="String" HeaderText="企业情况简介" HeaderTextAlign="Center" Width="220px">
</f:RenderField>
<f:RenderField ColumnID="Achievement" DataField="Achievement"
FieldType="String" HeaderText="类似操作业绩" HeaderTextAlign="Center" Width="220px">
</f:RenderField>
<f:RenderField ColumnID="Cooperation" DataField="Cooperation"
FieldType="String" HeaderText="与五环合作历史" HeaderTextAlign="Center" Width="220px">
</f:RenderField>
<f:RenderField ColumnID="InstallationNames" DataField="InstallationNames"
FieldType="String" HeaderText="意向分包装置或单元" HeaderTextAlign="Center" Width="260px">
</f:RenderField>
<f:RenderField ColumnID="IsInvitedName" DataField="IsInvitedName"
FieldType="String" HeaderText="是否拟邀" HeaderTextAlign="Center" Width="90px">
</f:RenderField>
<f:RenderField ColumnID="Remark" DataField="Remark"
FieldType="String" HeaderText="备注" HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:LinkButtonField HeaderText="附件" ConfirmTarget="Top" Width="80px" CommandName="AttachUrl" ColumnID="AttachUrl"
<f:TemplateField HeaderText="开车分包类别" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# GetDriverSubName(Eval("DriverSubNames")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:LinkButtonField HeaderText="附件" ConfirmTarget="Top" CommandName="AttachUrl" ColumnID="AttachUrl"
TextAlign="Center" ToolTip="附件查看" Icon="Find" />
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
@@ -26,36 +26,63 @@ namespace FineUIPro.Web.TestRun.DriverSub
//加载列表
public void BindGrid()
{
string strSql = @"SELECT subPlan.DriverSubPlanId,
subPlan.ProjectId,
subPlan.Code,
subPlan.SubUnitId,
subPlan.Introductions,
subPlan.Achievement,
subPlan.Cooperation,
subPlan.InstallationIds,
subPlan.InstallationNames,
(CASE WHEN subPlan.IsInvited=1 THEN '是' ELSE '否' END) AS IsInvitedName,
subPlan.AttachUrl,
subPlan.Remark,
Unit.UnitName AS SubUnitName"
+ @" FROM DriverSub_DriverSubPlan AS subPlan"
+ @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = subPlan.SubUnitId WHERE subPlan.ProjectId=@projectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.drpSubUnitId.SelectedValue)&&this.drpSubUnitId.SelectedValue!=BLL.Const._Null)
{
strSql += " AND subPlan.SubUnitId=@subUnitId";
listStr.Add(new SqlParameter("@subUnitId", this.drpSubUnitId.SelectedValue));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
//string strSql = @"SELECT subPlan.DriverSubPlanId,
// subPlan.ProjectId,
// subPlan.Code,
// subPlan.SubUnitId,
// subPlan.Introductions,
// subPlan.Achievement,
// subPlan.Cooperation,
// subPlan.InstallationIds,
// subPlan.InstallationNames,
// (CASE WHEN subPlan.IsInvited=1 THEN '是' ELSE '否' END) AS IsInvitedName,
// subPlan.AttachUrl,
// subPlan.Remark,
// Unit.UnitName AS SubUnitName"
// + @" FROM DriverSub_DriverSubPlan AS subPlan"
// + @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = subPlan.SubUnitId WHERE subPlan.ProjectId=@projectId";
//List<SqlParameter> listStr = new List<SqlParameter>();
//listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
//if (!string.IsNullOrEmpty(this.drpSubUnitId.SelectedValue)&&this.drpSubUnitId.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND subPlan.SubUnitId=@subUnitId";
// listStr.Add(new SqlParameter("@subUnitId", this.drpSubUnitId.SelectedValue));
//}
//SqlParameter[] parameter = listStr.ToArray();
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
//Grid1.RecordCount = tb.Rows.Count;
////tb = GetFilteredTable(Grid1.FilteredData, tb);
//var table = this.GetPagedDataTable(Grid1, tb);
//Grid1.DataSource = table;
//Grid1.DataBind();
Model.DriverSub_DriverSubPlan querymodel = new Model.DriverSub_DriverSubPlan();
querymodel.ProjectId = this.CurrUser.LoginProjectId;
Grid1.DataSource = DriverSubPlanService.GetListData(querymodel, Grid1);
Grid1.DataBind();
}
public string GetDriverSubName(object str)
{
string strName = "";
if (str != null)
{
string[] strArr = str.ToString().Split(',');
foreach (string s in strArr)
{
foreach (System.Web.UI.WebControls.ListItem item in DropListService.drpDriverSubNameList())
{
if (item.Value == s)
{
strName += item.Text + ",";
}
}
}
}
return strName.TrimEnd(',');
}
#endregion
#region
@@ -129,6 +156,7 @@ namespace FineUIPro.Web.TestRun.DriverSub
EditData();
}
/// <summary>
/// 编辑
/// </summary>
@@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub {
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubPlan {
public partial class DriverSubPlan
{
/// <summary>
/// form1 控件。
@@ -84,6 +86,15 @@ namespace FineUIPro.Web.TestRun.DriverSub {
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -36,11 +36,11 @@
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtCode" runat="server" Label="号" LabelAlign="Right" LabelWidth="150px" MaxLength="50" Required="true" ShowRedStar="true">
<f:TextBox ID="txtCode" runat="server" Label="号" LabelAlign="Right" LabelWidth="150px" MaxLength="50" Required="true" ShowRedStar="true">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<%-- <f:FormRow>
<Items>
<f:DropDownList ID="drpSubUnitId" runat="server" Label="开车分包单位" LabelAlign="Right" LabelWidth="150px" Required="true" ShowRedStar="true"></f:DropDownList>
</Items>
@@ -67,20 +67,25 @@
<Items>
<f:DropDownList ID="drpUnitWorkIds" runat="server" Label="意向分包装置或单元" LabelAlign="Right" LabelWidth="150px" EnableMultiSelect="true" EnableCheckBoxSelect="true"></f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
</f:FormRow>--%>
<%-- <f:FormRow>
<Items>
<f:RadioButtonList ID="rblIsInvited" runat="server" Label="是否拟邀" LabelAlign="Right" LabelWidth="150px">
<f:RadioItem Value="True" Text="是" Selected="true" />
<f:RadioItem Value="False" Text="否" />
</f:RadioButtonList>
</Items>
</f:FormRow>
<f:FormRow>
</f:FormRow>--%>
<%-- <f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" LabelAlign="Right" LabelWidth="150px" MaxLength="500">
</f:TextArea>
</Items>
</f:FormRow>--%>
<f:FormRow runat="server">
<Items>
<f:CheckBoxList ID="DriverSubName" Label="开车分包类别" runat="server" LabelAlign="Right" LabelWidth="150px" Required="True" ShowRedStar="True" ></f:CheckBoxList>
</Items>
</f:FormRow>
<f:FormRow runat="server">
<Items>
@@ -15,9 +15,13 @@ namespace FineUIPro.Web.TestRun.DriverSub
{
if (!IsPostBack)
{
BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true);
//BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true);
//BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true);
string id = Request.Params["id"];
DriverSubName.DataSource=DropListService.drpDriverSubNameList();
DriverSubName.DataTextField = "Text";
DriverSubName.DataValueField = "Value";
DriverSubName.DataBind();
if (!string.IsNullOrEmpty(id))
{
Model.DriverSub_DriverSubPlan data = BLL.DriverSubPlanService.GetDriverSubPlanById(id);
@@ -25,16 +29,17 @@ namespace FineUIPro.Web.TestRun.DriverSub
{
this.hdId.Text = id;
this.txtCode.Text = data.Code;
if (!string.IsNullOrEmpty(data.SubUnitId))
{
this.drpSubUnitId.SelectedValue = data.SubUnitId;
}
this.txtIntroductions.Text = data.Introductions;
this.txtAchievement.Text = data.Achievement;
this.txtCooperation.Text = data.Cooperation;
this.drpUnitWorkIds.SelectedValueArray = data.InstallationIds.Split(',');
this.rblIsInvited.SelectedValue = data.IsInvited.ToString();
this.txtRemark.Text = data.Remark;
this.DriverSubName.SelectedValueArray= data.DriverSubNames.Split(',');
//if (!string.IsNullOrEmpty(data.SubUnitId))
//{
// this.drpSubUnitId.SelectedValue = data.SubUnitId;
//}
//this.txtIntroductions.Text = data.Introductions;
//this.txtAchievement.Text = data.Achievement;
//this.txtCooperation.Text = data.Cooperation;
//this.drpUnitWorkIds.SelectedValueArray = data.InstallationIds.Split(',');
//this.rblIsInvited.SelectedValue = data.IsInvited.ToString();
//this.txtRemark.Text = data.Remark;
}
}
}
@@ -65,40 +70,41 @@ namespace FineUIPro.Web.TestRun.DriverSub
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpSubUnitId.SelectedValue==BLL.Const._Null)
{
Alert.ShowInTop("请选择开车分包单位!", MessageBoxIcon.Warning);
return;
}
//if (this.drpSubUnitId.SelectedValue==BLL.Const._Null)
//{
// Alert.ShowInTop("请选择开车分包单位!", MessageBoxIcon.Warning);
// return;
//}
string id = Request.Params["id"];
Model.DriverSub_DriverSubPlan newData = new Model.DriverSub_DriverSubPlan();
newData.Code = this.txtCode.Text.Trim();
if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
{
newData.SubUnitId = this.drpSubUnitId.SelectedValue;
}
newData.Introductions = this.txtIntroductions.Text.Trim();
newData.Achievement = this.txtAchievement.Text.Trim();
newData.Cooperation = this.txtCooperation.Text.Trim();
if (!string.IsNullOrEmpty(this.drpUnitWorkIds.SelectedValue))
{
newData.InstallationIds = GetStringByArray(this.drpUnitWorkIds.SelectedValueArray);
string unitWorkNames = string.Empty;
foreach (var item in this.drpUnitWorkIds.SelectedValueArray)
{
var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(item);
if (unitWork!=null)
{
unitWorkNames += unitWork.UnitWorkName + ",";
}
}
if (!string.IsNullOrEmpty(unitWorkNames))
{
newData.InstallationNames = unitWorkNames.Substring(0, unitWorkNames.LastIndexOf(","));
}
}
newData.IsInvited = Convert.ToBoolean(this.rblIsInvited.SelectedValue);
newData.Remark = this.txtRemark.Text.Trim();
newData.DriverSubNames= GetStringByArray(this.DriverSubName.SelectedValueArray);
//if (this.drpSubUnitId.SelectedValue != BLL.Const._Null)
//{
// newData.SubUnitId = this.drpSubUnitId.SelectedValue;
//}
//newData.Introductions = this.txtIntroductions.Text.Trim();
//newData.Achievement = this.txtAchievement.Text.Trim();
//newData.Cooperation = this.txtCooperation.Text.Trim();
//if (!string.IsNullOrEmpty(this.drpUnitWorkIds.SelectedValue))
//{
// newData.InstallationIds = GetStringByArray(this.drpUnitWorkIds.SelectedValueArray);
// string unitWorkNames = string.Empty;
// foreach (var item in this.drpUnitWorkIds.SelectedValueArray)
// {
// var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(item);
// if (unitWork!=null)
// {
// unitWorkNames += unitWork.UnitWorkName + ",";
// }
// }
// if (!string.IsNullOrEmpty(unitWorkNames))
// {
// newData.InstallationNames = unitWorkNames.Substring(0, unitWorkNames.LastIndexOf(","));
// }
//}
//newData.IsInvited = Convert.ToBoolean(this.rblIsInvited.SelectedValue);
//newData.Remark = this.txtRemark.Text.Trim();
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
@@ -122,6 +128,13 @@ namespace FineUIPro.Web.TestRun.DriverSub
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 获取字符串
/// </summary>
/// <param name="array"></param>
/// <returns></returns>
private string GetStringByArray(string[] array)
{
string str = string.Empty;
@@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.TestRun.DriverSub {
namespace FineUIPro.Web.TestRun.DriverSub
{
public partial class DriverSubPlanEdit {
public partial class DriverSubPlanEdit
{
/// <summary>
/// form1 控件。
@@ -112,67 +114,13 @@ namespace FineUIPro.Web.TestRun.DriverSub {
protected global::FineUIPro.TextBox txtCode;
/// <summary>
/// drpSubUnitId 控件。
/// DriverSubName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSubUnitId;
/// <summary>
/// txtIntroductions 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtIntroductions;
/// <summary>
/// txtAchievement 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtAchievement;
/// <summary>
/// txtCooperation 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCooperation;
/// <summary>
/// drpUnitWorkIds 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUnitWorkIds;
/// <summary>
/// rblIsInvited 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rblIsInvited;
/// <summary>
/// txtRemark 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
protected global::FineUIPro.CheckBoxList DriverSubName;
/// <summary>
/// Panel3 控件。
@@ -15,8 +15,7 @@
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Test_Package_START"
SortDirection="DESC" OnSort="Grid1_Sort"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
@@ -50,6 +50,7 @@ namespace FineUIPro.Web.Transfer
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by Civil_Structure ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -56,6 +56,10 @@ namespace FineUIPro.Web.Transfer
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
@@ -162,7 +166,7 @@ namespace FineUIPro.Web.Transfer
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 0; i < ir; i++)
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
+1 -2
View File
@@ -15,8 +15,7 @@
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Test_Package_START"
SortDirection="DESC" OnSort="Grid1_Sort"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
@@ -50,6 +50,9 @@ namespace FineUIPro.Web.Transfer
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by ELECTRICAL ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -55,6 +55,10 @@ namespace FineUIPro.Web.Transfer
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
@@ -161,7 +165,7 @@ namespace FineUIPro.Web.Transfer
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 0; i < ir; i++)
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
@@ -15,8 +15,7 @@
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Test_Package_START"
SortDirection="DESC" OnSort="Grid1_Sort"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
@@ -50,6 +50,9 @@ namespace FineUIPro.Web.Transfer
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by Firefighting ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -56,6 +56,10 @@ namespace FineUIPro.Web.Transfer
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
@@ -162,7 +166,7 @@ namespace FineUIPro.Web.Transfer
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 0; i < ir; i++)
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
+117
View File
@@ -0,0 +1,117 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HVAC.aspx.cs" Inherits="FineUIPro.Web.Transfer.HVAC" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Test_Package_START"
SortDirection="DESC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtHVAC" Label="HVAC" LabelWidth="80px" LabelAlign="Right"></f:TextBox>
<f:DatePicker runat="server" Label="Test_Package_START" ID="txtStarTime" LabelAlign="Right" LabelWidth="150px"
Width="280px">
</f:DatePicker>
<f:Label ID="Label1" runat="server" Text="至">
</f:Label>
<f:DatePicker runat="server" ID="txtEndTime" LabelAlign="Right" Width="150px">
</f:DatePicker>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<%-- <f:Button ID="btnNew" Icon="Add" EnablePostBack="true" runat="server" OnClick="btnNew_Click" ToolTip="新增" Hidden="true">
</f:Button>--%>
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:GroupField HeaderText="HVAC" TextAlign="Center" MinWidth="200px">
<Columns>
<f:BoundField Width="200px" TextAlign="Center" ColumnID="HVAC" DataField="HVAC" HeaderText="HVAC" />
</Columns>
</f:GroupField>
<f:GroupField HeaderText="SYSTEM AND TEST PACKAGE SELECTION" TextAlign="Center" MinWidth="450">
<Columns>
<f:BoundField Width="150px" ColumnID="SystemName" DataField="SystemName" HeaderText="SYSTEM" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Subsystem" DataField="Subsystem" HeaderText="Subsystem" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Test_Package" DataField="Test_Package" HeaderText="Test Package" TextAlign="Center"/>
</Columns>
</f:GroupField>
<f:GroupField HeaderText="Test Package Schedule" TextAlign="Center" MinWidth="400px">
<Columns>
<f:RenderField Width="200px" ColumnID="Test_Package_START" DataField="Test_Package_START" HeaderText="Test Package START" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
<f:RenderField Width="200px" ColumnID="Test_Package_FINISH" DataField="Test_Package_FINISH" HeaderText="Test Package FINISH" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
</Columns>
</f:GroupField>
<f:BoundField MinWidth="200px" ColumnID="FINAL_Status" DataField="FINAL_Status" HeaderText="FINAL Status" TextAlign="Center"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="560px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<%--<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">
</f:MenuButton>--%>
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
OnClick="btnMenuDel_Click" Hidden="true">
</f:MenuButton>
</Items>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
</script>
</body>
</html>
+201
View File
@@ -0,0 +1,201 @@
using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Transfer
{
public partial class HVAC : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
BindGrid();
}
}
/// <summary>
/// 数据绑定
/// </summary>
public void BindGrid()
{
string strSql = @"select*from Transfer_HVAC
where ProjectId = @ProjectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.txtHVAC.Text.Trim()))
{
strSql += " AND Plumbing like @Plumbing";
listStr.Add(new SqlParameter("@Plumbing", "%" + this.txtHVAC.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND Test_Package_START >= @InspectionDateA";
listStr.Add(new SqlParameter("@InspectionDateA", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by HVAC ";
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();
}
#endregion
#region
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDel_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
Model.Transfer_HVAC model = Funs.DB.Transfer_HVAC.FirstOrDefault(x => x.Id == rowID);
if (model != null)
{
Funs.DB.Transfer_HVAC.DeleteOnSubmit(model);
Funs.DB.SubmitChanges();
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("HVACDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HVACMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
//this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
//this.btnMenuModify.Hidden = false;
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid1.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDel.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnImport.Hidden = false;
}
}
}
#endregion
}
}
+161
View File
@@ -0,0 +1,161 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class HVAC
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ToolSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtHVAC 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtHVAC;
/// <summary>
/// txtStarTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStarTime;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// txtEndTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndTime;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDel;
}
}
@@ -0,0 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HVACDataIn.aspx.cs" Inherits="FineUIPro.Web.Transfer.HVACDataIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="人员报验" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,420 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.Transfer
{
public partial class HVACDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 7);
hdCheckResult.Text = "1";
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
finally
{
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row4.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package START" + "," + "[" + row4 + "]错误!不是日期格式!" + "|";
}
}
string row5 = pds.Rows[i][5].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row5.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package FINISH" + "," + "[" + row5 + "]错误!不是日期格式!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos.Clear();
if (!string.IsNullOrEmpty(result))
{
string results = result;
List<string> errorInfoList = results.Split('|').ToList();
foreach (var item in errorInfoList)
{
string[] errors = item.Split(',');
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = errors[0];
errorInfo.Column = errors[1];
errorInfo.Reason = errors[2];
errorInfos.Add(errorInfo);
}
if (errorInfos.Count > 0)
{
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 7);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
List<Model.Transfer_HVAC> list = new List<Model.Transfer_HVAC>();
for (int i = 1; i < ir; i++)
{
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_HVAC.FirstOrDefault(x => x.HVAC == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId == CurrUser.LoginProjectId);
if (modelOnly == null)
{
Model.Transfer_HVAC model = new Model.Transfer_HVAC();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.HVAC = pds.Rows[i][0].ToString().Trim();
model.SystemName = pds.Rows[i][1].ToString().Trim();
model.Subsystem = pds.Rows[i][2].ToString().Trim();
model.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.Test_Package_FINISH = t2;
model.FINAL_Status = pds.Rows[i][6].ToString().Trim();
list.Add(model);
}
else
{
//修改
modelOnly.HVAC = pds.Rows[i][0].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][1].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][2].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
modelOnly.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
modelOnly.Test_Package_FINISH = t2;
modelOnly.FINAL_Status = pds.Rows[i][6].ToString().Trim();
Funs.DB.SubmitChanges();
}
}
if (list.Count > 0)
{
Funs.DB.Transfer_HVAC.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + "File\\Excel\\DataIn\\HVAC导入模板.xls";
string filePath = "File\\Excel\\DataIn\\HVAC导入模板.xls";
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}
+125
View File
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class HVACDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}
@@ -15,8 +15,7 @@
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Test_Package_START"
SortDirection="DESC" OnSort="Grid1_Sort"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
@@ -50,6 +50,9 @@ namespace FineUIPro.Web.Transfer
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by INSTRUMENTATION ";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -56,6 +56,10 @@ namespace FineUIPro.Web.Transfer
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
@@ -162,7 +166,7 @@ namespace FineUIPro.Web.Transfer
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 0; i < ir; i++)
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
+116
View File
@@ -0,0 +1,116 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Plumbing.aspx.cs" Inherits="FineUIPro.Web.Transfer.Plumbing" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtPlumbing" Label="Plumbing" LabelWidth="120px" LabelAlign="Right"></f:TextBox>
<f:DatePicker runat="server" Label="Test_Package_START" ID="txtStarTime" LabelAlign="Right" LabelWidth="150px"
Width="280px">
</f:DatePicker>
<f:Label ID="Label1" runat="server" Text="至">
</f:Label>
<f:DatePicker runat="server" ID="txtEndTime" LabelAlign="Right" Width="150px">
</f:DatePicker>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<%-- <f:Button ID="btnNew" Icon="Add" EnablePostBack="true" runat="server" OnClick="btnNew_Click" ToolTip="新增" Hidden="true">
</f:Button>--%>
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:GroupField HeaderText="Plumbing" TextAlign="Center" MinWidth="200px">
<Columns>
<f:BoundField Width="200px" TextAlign="Center" ColumnID="Plumbing" DataField="Plumbing" HeaderText="Plumbing" />
</Columns>
</f:GroupField>
<f:GroupField HeaderText="SYSTEM AND TEST PACKAGE SELECTION" TextAlign="Center" MinWidth="450">
<Columns>
<f:BoundField Width="150px" ColumnID="SystemName" DataField="SystemName" HeaderText="SYSTEM" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Subsystem" DataField="Subsystem" HeaderText="Subsystem" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Test_Package" DataField="Test_Package" HeaderText="Test Package" TextAlign="Center"/>
</Columns>
</f:GroupField>
<f:GroupField HeaderText="Test Package Schedule" TextAlign="Center" MinWidth="400px">
<Columns>
<f:RenderField Width="200px" ColumnID="Test_Package_START" DataField="Test_Package_START" HeaderText="Test Package START" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
<f:RenderField Width="200px" ColumnID="Test_Package_FINISH" DataField="Test_Package_FINISH" HeaderText="Test Package FINISH" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
</Columns>
</f:GroupField>
<f:BoundField MinWidth="200px" ColumnID="FINAL_Status" DataField="FINAL_Status" HeaderText="FINAL Status" TextAlign="Center"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="560px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<%--<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">
</f:MenuButton>--%>
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
OnClick="btnMenuDel_Click" Hidden="true">
</f:MenuButton>
</Items>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
</script>
</body>
</html>
@@ -0,0 +1,202 @@
using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Transfer
{
public partial class Plumbing : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
BindGrid();
}
}
/// <summary>
/// 数据绑定
/// </summary>
public void BindGrid()
{
string strSql = @"select*from Transfer_Plumbing
where ProjectId = @ProjectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.txtPlumbing.Text.Trim()))
{
strSql += " AND Plumbing like @Plumbing";
listStr.Add(new SqlParameter("@Plumbing", "%" + this.txtPlumbing.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND Test_Package_START >= @InspectionDateA";
listStr.Add(new SqlParameter("@InspectionDateA", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by Plumbing ";
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();
}
#endregion
#region
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDel_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
Model.Transfer_Plumbing model = Funs.DB.Transfer_Plumbing.FirstOrDefault(x => x.Id == rowID);
if (model != null)
{
Funs.DB.Transfer_Plumbing.DeleteOnSubmit(model);
Funs.DB.SubmitChanges();
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PlumbingDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PlumbingMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
//this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
//this.btnMenuModify.Hidden = false;
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid1.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDel.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnImport.Hidden = false;
}
}
}
#endregion
}
}
+161
View File
@@ -0,0 +1,161 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class Plumbing
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ToolSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtPlumbing 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPlumbing;
/// <summary>
/// txtStarTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStarTime;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// txtEndTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndTime;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDel;
}
}
@@ -0,0 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PlumbingDataIn.aspx.cs" Inherits="FineUIPro.Web.Transfer.PlumbingDataIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="人员报验" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,421 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.Transfer
{
public partial class PlumbingDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 7);
hdCheckResult.Text = "1";
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
finally
{
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row4.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package START" + "," + "[" + row4 + "]错误!不是日期格式!" + "|";
}
}
string row5 = pds.Rows[i][5].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row5.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package FINISH" + "," + "[" + row5 + "]错误!不是日期格式!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos.Clear();
if (!string.IsNullOrEmpty(result))
{
string results = result;
List<string> errorInfoList = results.Split('|').ToList();
foreach (var item in errorInfoList)
{
string[] errors = item.Split(',');
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = errors[0];
errorInfo.Column = errors[1];
errorInfo.Reason = errors[2];
errorInfos.Add(errorInfo);
}
if (errorInfos.Count > 0)
{
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 7);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
List<Model.Transfer_Plumbing> list = new List<Model.Transfer_Plumbing>();
for (int i = 1; i < ir; i++)
{
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_Plumbing.FirstOrDefault(x => x.Plumbing == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId == CurrUser.LoginProjectId);
if (modelOnly == null)
{
Model.Transfer_Plumbing model = new Model.Transfer_Plumbing();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.Plumbing = pds.Rows[i][0].ToString().Trim();
model.SystemName = pds.Rows[i][1].ToString().Trim();
model.Subsystem = pds.Rows[i][2].ToString().Trim();
model.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.Test_Package_FINISH = t2;
model.FINAL_Status = pds.Rows[i][6].ToString().Trim();
list.Add(model);
}
else
{
//修改
modelOnly.Plumbing = pds.Rows[i][0].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][1].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][2].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
modelOnly.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
modelOnly.Test_Package_FINISH = t2;
modelOnly.FINAL_Status = pds.Rows[i][6].ToString().Trim();
Funs.DB.SubmitChanges();
}
}
if (list.Count > 0)
{
Funs.DB.Transfer_Plumbing.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + "File\\Excel\\DataIn\\Plumbing导入模板.xls";
string filePath = "File\\Excel\\DataIn\\Plumbing导入模板.xls";
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class PlumbingDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}
@@ -0,0 +1,144 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PunchlistFrom.aspx.cs" Inherits="FineUIPro.Web.Transfer.PunchlistFrom" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtPunch_No" Label="Punch_No" LabelWidth="80px" LabelAlign="Right"></f:TextBox>
<f:DatePicker runat="server" Label="PUNCH_ITEM_FINISH_DATE" ID="txtStarTime" LabelAlign="Right" LabelWidth="200px"
Width="280px">
</f:DatePicker>
<f:Label ID="Label1" runat="server" Text="至">
</f:Label>
<f:DatePicker runat="server" ID="txtEndTime" LabelAlign="Right" Width="150px">
</f:DatePicker>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<%-- <f:Button ID="btnNew" Icon="Add" EnablePostBack="true" runat="server" OnClick="btnNew_Click" ToolTip="新增" Hidden="true">
</f:Button>--%>
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:GroupField HeaderText="PUNCH LIST FORM" TextAlign="Center">
<Columns>
<f:BoundField Width="80px" TextAlign="Center" ColumnID="Item_No" DataField="Item_No" HeaderText="Item No." />
<f:BoundField Width="100px" TextAlign="Center" ColumnID="Punch_No" DataField="Punch_No" HeaderText="Punch No" />
<f:BoundField Width="120px" TextAlign="Center" ColumnID="SystemName" DataField="SystemName" HeaderText="SYSTEM" />
<f:BoundField Width="150px" ColumnID="Subsystem" DataField="Subsystem" HeaderText="SUBSYSTEM" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Test_Package" DataField="Test_Package" HeaderText="Test Package" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Discipline" DataField="Discipline" HeaderText="Discipline" TextAlign="Center"/>
<f:BoundField Width="250px" ColumnID="DESCRIPTION" DataField="DESCRIPTION" HeaderText="PUNCH LIST ITEM DESCRIPTION" TextAlign="Center"/>
<f:BoundField Width="180px" ColumnID="Identified" DataField="Identified" HeaderText="Identified during/by" TextAlign="Center"/>
<f:BoundField Width="250px" ColumnID="Category" DataField="Category" HeaderText="Select Punch List Category" TextAlign="Center"/>
<f:RenderField Width="200px" ColumnID="PUNCH_ITEM_FINISH_DATE" DataField="PUNCH_ITEM_FINISH_DATE"
HeaderText="PUNCH ITEM FINISH DATE" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
<f:BoundField Width="150px" ColumnID="Action_By" DataField="Action_By" HeaderText="Action By" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Required_By" DataField="Required_By" HeaderText="Required By" TextAlign="Center"/>
<f:BoundField Width="250px" ColumnID="PUNCH_ITEM_STATUS" DataField="PUNCH_ITEM_STATUS" HeaderText="PUNCH ITEM STATUS" TextAlign="Center"/>
<f:BoundField Width="250px" ColumnID="Comments" DataField="Comments" HeaderText="Comments" TextAlign="Center"/>
</Columns>
</f:GroupField>
<%--<f:GroupField HeaderText="SYSTEM AND TEST PACKAGE SELECTION" TextAlign="Center" MinWidth="450">
<Columns>
<f:BoundField Width="150px" ColumnID="SystemName" DataField="SystemName" HeaderText="SYSTEM" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Subsystem" DataField="Subsystem" HeaderText="Subsystem" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Test_Package" DataField="Test_Package" HeaderText="Test Package" TextAlign="Center"/>
</Columns>
</f:GroupField>
<f:GroupField HeaderText="Test Package Schedule" TextAlign="Center" MinWidth="400px">
<Columns>
<f:RenderField Width="200px" ColumnID="Test_Package_START" DataField="Test_Package_START" HeaderText="Test Package START" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
<f:RenderField Width="200px" ColumnID="Test_Package_FINISH" DataField="Test_Package_FINISH" HeaderText="Test Package FINISH" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
</Columns>
</f:GroupField>
<f:BoundField MinWidth="200px" ColumnID="FINAL_Status" DataField="FINAL_Status" HeaderText="FINAL Status" TextAlign="Center"/>--%>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="560px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<%--<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">
</f:MenuButton>--%>
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
OnClick="btnMenuDel_Click" Hidden="true">
</f:MenuButton>
</Items>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
</script>
</body>
</html>
@@ -0,0 +1,200 @@
using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Transfer
{
public partial class PunchlistFrom : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
BindGrid();
}
}
/// <summary>
/// 数据绑定
/// </summary>
public void BindGrid()
{
string strSql = @"select*from Transfer_PunchlistFrom
where ProjectId = @ProjectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.txtPunch_No.Text.Trim()))
{
strSql += " AND Punch_No like @Punch_No";
listStr.Add(new SqlParameter("@Punch_No", "%" + this.txtPunch_No.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND PUNCH_ITEM_FINISH_DATE >= @InspectionDateA";
listStr.Add(new SqlParameter("@InspectionDateA", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND PUNCH_ITEM_FINISH_DATE <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by Punch_No ";
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();
}
#endregion
#region
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDel_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
Model.Transfer_PunchlistFrom model = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(x => x.Id == rowID);
if (model != null)
{
Funs.DB.Transfer_PunchlistFrom.DeleteOnSubmit(model);
Funs.DB.SubmitChanges();
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PunchlistFromDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PunchlistFromMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
//this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
//this.btnMenuModify.Hidden = false;
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid1.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDel.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnImport.Hidden = false;
}
}
}
#endregion
}
}
+161
View File
@@ -0,0 +1,161 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class PunchlistFrom
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ToolSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtPunch_No 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPunch_No;
/// <summary>
/// txtStarTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStarTime;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// txtEndTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndTime;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDel;
}
}
@@ -0,0 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PunchlistFromDataIn.aspx.cs" Inherits="FineUIPro.Web.Transfer.PunchlistFromDataIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="人员报验" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,425 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.Transfer
{
public partial class PunchlistFromDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 14);
hdCheckResult.Text = "1";
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
finally
{
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][9].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row4.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "PUNCH ITEM FINISH DATE" + "," + "[" + row4 + "]错误!不是日期格式!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos.Clear();
if (!string.IsNullOrEmpty(result))
{
string results = result;
List<string> errorInfoList = results.Split('|').ToList();
foreach (var item in errorInfoList)
{
string[] errors = item.Split(',');
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = errors[0];
errorInfo.Column = errors[1];
errorInfo.Reason = errors[2];
errorInfos.Add(errorInfo);
}
if (errorInfos.Count > 0)
{
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 14);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
List<Model.Transfer_PunchlistFrom> list = new List<Model.Transfer_PunchlistFrom>();
for (int i = 1; i < ir; i++)
{
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(x => x.Punch_No == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId == CurrUser.LoginProjectId);
if (modelOnly == null)
{
Model.Transfer_PunchlistFrom model = new Model.Transfer_PunchlistFrom();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.Item_No = pds.Rows[i][0].ToString().Trim();
model.Punch_No = pds.Rows[i][1].ToString().Trim();
model.SystemName = pds.Rows[i][2].ToString().Trim();
model.Subsystem = pds.Rows[i][3].ToString().Trim();
model.Test_Package = pds.Rows[i][4].ToString().Trim();
model.Discipline = pds.Rows[i][5].ToString().Trim();
model.DESCRIPTION = pds.Rows[i][6].ToString().Trim();
model.Identified = pds.Rows[i][7].ToString().Trim();
model.Category = pds.Rows[i][8].ToString().Trim();
DateTime t1;
if (DateTime.TryParse(pds.Rows[i][9].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][9].ToString()))
model.PUNCH_ITEM_FINISH_DATE = t1;
model.Action_By = pds.Rows[i][10].ToString().Trim();
model.Required_By = pds.Rows[i][11].ToString().Trim();
model.PUNCH_ITEM_STATUS = pds.Rows[i][12].ToString().Trim();
model.Comments = pds.Rows[i][13].ToString().Trim();
list.Add(model);
}
else
{
//修改
modelOnly.Item_No = pds.Rows[i][0].ToString().Trim();
modelOnly.Punch_No = pds.Rows[i][1].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][2].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][3].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][4].ToString().Trim();
modelOnly.Discipline = pds.Rows[i][5].ToString().Trim();
modelOnly.DESCRIPTION = pds.Rows[i][6].ToString().Trim();
modelOnly.Identified = pds.Rows[i][7].ToString().Trim();
modelOnly.Category = pds.Rows[i][8].ToString().Trim();
DateTime t1;
if (DateTime.TryParse(pds.Rows[i][9].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][9].ToString()))
modelOnly.PUNCH_ITEM_FINISH_DATE = t1;
modelOnly.Action_By = pds.Rows[i][10].ToString().Trim();
modelOnly.Required_By = pds.Rows[i][11].ToString().Trim();
modelOnly.PUNCH_ITEM_STATUS = pds.Rows[i][12].ToString().Trim();
modelOnly.Comments = pds.Rows[i][13].ToString().Trim();
Funs.DB.SubmitChanges();
}
}
if (list.Count > 0)
{
Funs.DB.Transfer_PunchlistFrom.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + "File\\Excel\\DataIn\\PunchlistFrom导入模板.xls";
string filePath = "File\\Excel\\DataIn\\PunchlistFrom导入模板.xls";
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class PunchlistFromDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}
+116
View File
@@ -0,0 +1,116 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Telecom.aspx.cs" Inherits="FineUIPro.Web.Transfer.Telecom" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" EnableTextSelection="true">
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtTelecom" Label="Telecom" LabelWidth="120px" LabelAlign="Right"></f:TextBox>
<f:DatePicker runat="server" Label="Test_Package_START" ID="txtStarTime" LabelAlign="Right" LabelWidth="150px"
Width="280px">
</f:DatePicker>
<f:Label ID="Label1" runat="server" Text="至">
</f:Label>
<f:DatePicker runat="server" ID="txtEndTime" LabelAlign="Right" Width="150px">
</f:DatePicker>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<%-- <f:Button ID="btnNew" Icon="Add" EnablePostBack="true" runat="server" OnClick="btnNew_Click" ToolTip="新增" Hidden="true">
</f:Button>--%>
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:GroupField HeaderText="Telecom" TextAlign="Center" MinWidth="200px">
<Columns>
<f:BoundField Width="200px" TextAlign="Center" ColumnID="Telecom" DataField="Telecom" HeaderText="Telecom" />
</Columns>
</f:GroupField>
<f:GroupField HeaderText="SYSTEM AND TEST PACKAGE SELECTION" TextAlign="Center" MinWidth="450">
<Columns>
<f:BoundField Width="150px" ColumnID="SystemName" DataField="SystemName" HeaderText="SYSTEM" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Subsystem" DataField="Subsystem" HeaderText="Subsystem" TextAlign="Center"/>
<f:BoundField Width="150px" ColumnID="Test_Package" DataField="Test_Package" HeaderText="Test Package" TextAlign="Center"/>
</Columns>
</f:GroupField>
<f:GroupField HeaderText="Test Package Schedule" TextAlign="Center" MinWidth="400px">
<Columns>
<f:RenderField Width="200px" ColumnID="Test_Package_START" DataField="Test_Package_START" HeaderText="Test Package START" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
<f:RenderField Width="200px" ColumnID="Test_Package_FINISH" DataField="Test_Package_FINISH" HeaderText="Test Package FINISH" TextAlign="Center"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"/>
</Columns>
</f:GroupField>
<f:BoundField MinWidth="200px" ColumnID="FINAL_Status" DataField="FINAL_Status" HeaderText="FINAL Status" TextAlign="Center"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="700px" Height="560px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<%--<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">
</f:MenuButton>--%>
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
OnClick="btnMenuDel_Click" Hidden="true">
</f:MenuButton>
</Items>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
</script>
</body>
</html>
+203
View File
@@ -0,0 +1,203 @@
using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.Transfer
{
public partial class Telecom : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();
BindGrid();
}
}
/// <summary>
/// 数据绑定
/// </summary>
public void BindGrid()
{
string strSql = @"select*from Transfer_Telecom
where ProjectId = @ProjectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.txtTelecom.Text.Trim()))
{
strSql += " AND Telecom like @Telecom";
listStr.Add(new SqlParameter("@Telecom", "%" + this.txtTelecom.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND Test_Package_START >= @InspectionDateA";
listStr.Add(new SqlParameter("@InspectionDateA", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND Test_Package_START <= @InspectionDateZ";
listStr.Add(new SqlParameter("@InspectionDateZ", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
strSql += " order by Telecom ";
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();
}
#endregion
#region
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDel_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
Model.Transfer_Telecom model = Funs.DB.Transfer_Telecom.FirstOrDefault(x => x.Id == rowID);
if (model != null)
{
Funs.DB.Transfer_Telecom.DeleteOnSubmit(model);
Funs.DB.SubmitChanges();
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TelecomDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TelecomMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
//this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
//this.btnMenuModify.Hidden = false;
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid1.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDel.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnImport.Hidden = false;
}
}
}
#endregion
}
}
+161
View File
@@ -0,0 +1,161 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class Telecom
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ToolSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtTelecom 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTelecom;
/// <summary>
/// txtStarTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStarTime;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// txtEndTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndTime;
/// <summary>
/// btnSearch 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSearch;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDel;
}
}
@@ -0,0 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TelecomDataIn.aspx.cs" Inherits="FineUIPro.Web.Transfer.TelecomDataIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="人员报验" EnableCollapse="true"
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Row" HeaderText="错误行号">
</f:BoundField>
<f:BoundField DataField="Column" HeaderText="错误列">
</f:BoundField>
<f:BoundField DataField="Reason" HeaderText="错误类型">
</f:BoundField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,421 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.Transfer
{
public partial class TelecomDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdCheckResult.Text = string.Empty;
this.hdFileName.Text = string.Empty;
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
errorInfos.Clear();
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 7);
hdCheckResult.Text = "1";
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
finally
{
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
for (int i = 1; i < ir; i++)
{
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row4.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package START" + "," + "[" + row4 + "]错误!不是日期格式!" + "|";
}
}
string row5 = pds.Rows[i][5].ToString();
if (!string.IsNullOrEmpty(row4))
{
try
{
DateTime date = Convert.ToDateTime(row5.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "Test Package FINISH" + "," + "[" + row5 + "]错误!不是日期格式!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos.Clear();
if (!string.IsNullOrEmpty(result))
{
string results = result;
List<string> errorInfoList = results.Split('|').ToList();
foreach (var item in errorInfoList)
{
string[] errors = item.Split(',');
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = errors[0];
errorInfo.Column = errors[1];
errorInfo.Reason = errors[2];
errorInfos.Add(errorInfo);
}
if (errorInfos.Count > 0)
{
this.gvErrorInfo.DataSource = errorInfos;
this.gvErrorInfo.DataBind();
}
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 7);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
List<Model.Transfer_Telecom> list = new List<Model.Transfer_Telecom>();
for (int i = 1; i < ir; i++)
{
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_Telecom.FirstOrDefault(x => x.Telecom == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId == CurrUser.LoginProjectId);
if (modelOnly == null)
{
Model.Transfer_Telecom model = new Model.Transfer_Telecom();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.Telecom = pds.Rows[i][0].ToString().Trim();
model.SystemName = pds.Rows[i][1].ToString().Trim();
model.Subsystem = pds.Rows[i][2].ToString().Trim();
model.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.Test_Package_FINISH = t2;
model.FINAL_Status = pds.Rows[i][6].ToString().Trim();
list.Add(model);
}
else
{
//修改
modelOnly.Telecom = pds.Rows[i][0].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][1].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][2].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
modelOnly.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
modelOnly.Test_Package_FINISH = t2;
modelOnly.FINAL_Status = pds.Rows[i][6].ToString().Trim();
Funs.DB.SubmitChanges();
}
}
if (list.Count > 0)
{
Funs.DB.Transfer_Telecom.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + "File\\Excel\\DataIn\\Telecom导入模板.xls";
string filePath = "File\\Excel\\DataIn\\Telecom导入模板.xls";
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
}
}
+125
View File
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.Transfer
{
public partial class TelecomDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// gvErrorInfo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvErrorInfo;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
}
}
File diff suppressed because one or more lines are too long
+896 -601
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long