diff --git a/.gitignore b/.gitignore
index 53ee8024..27a0fc70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,5 @@
/SGGL/BLL/obj
/SGGL/FineUIPro.Web/obj
/SGGL/Model/obj
+/SGGL/FineUIPro.Web/web.config
+/SGGL/FineUIPro.Web/ErrLog.txt
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/Instrumentation导入模板.xls b/SGGL/FineUIPro.Web/File/Excel/DataIn/Instrumentation导入模板.xls
new file mode 100644
index 00000000..1949844b
Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/Instrumentation导入模板.xls differ
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index f4d327e2..b214300c 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -1826,6 +1826,8 @@
+
+
@@ -16298,6 +16300,20 @@
TestRunRecordUploadList.aspx
+
+ Instrumentation.aspx
+ ASPXCodeBehind
+
+
+ Instrumentation.aspx
+
+
+ InstrumentationDataIn.aspx
+ ASPXCodeBehind
+
+
+ InstrumentationDataIn.aspx
+
ProjectSetup.aspx
ASPXCodeBehind
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user
index c78536b4..5c318055 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user
@@ -1,7 +1,7 @@
- Release|Any CPU
+ Debug|Any CPU
true
false
diff --git a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx
new file mode 100644
index 00000000..e0286ad0
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx
@@ -0,0 +1,117 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Instrumentation.aspx.cs" Inherits="FineUIPro.Web.Transfer.Instrumentation" %>
+
+
+
+
+
+
+ Instrumentation
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs
new file mode 100644
index 00000000..f03ed819
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs
@@ -0,0 +1,199 @@
+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 Instrumentation : PageBase
+ {
+ #region 加载
+ ///
+ /// 加载页面
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ GetButtonPower();
+ BindGrid();
+ }
+ }
+
+ ///
+ /// 数据绑定
+ ///
+ public void BindGrid()
+ {
+ string strSql = @"select*from Transfer_Instrumentation
+ where ProjectId = @ProjectId";
+ List listStr = new List();
+ listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
+
+ if (!string.IsNullOrEmpty(this.txtINSTRUMENTATION.Text.Trim()))
+ {
+ strSql += " AND INSTRUMENTATION like @INSTRUMENTATION";
+ listStr.Add(new SqlParameter("@INSTRUMENTATION", "%" + this.txtINSTRUMENTATION.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())));
+ }
+ 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 分页、排序
+ ///
+ /// 分页下拉
+ ///
+ ///
+ ///
+ protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
+ BindGrid();
+ }
+
+ ///
+ /// 分页索引事件
+ ///
+ ///
+ ///
+ protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
+ {
+ BindGrid();
+ }
+
+ ///
+ /// 排序
+ ///
+ ///
+ ///
+ protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
+ {
+ Grid1.SortDirection = e.SortDirection;
+ Grid1.SortField = e.SortField;
+ BindGrid();
+ }
+ #endregion
+
+ #region 查询
+ ///
+ /// 查询
+ ///
+ ///
+ ///
+ protected void btnSearch_Click(object sender, EventArgs e)
+ {
+ BindGrid();
+ }
+ #endregion
+
+ #region 关闭弹出窗口
+ ///
+ /// 关闭弹出窗口
+ ///
+ ///
+ ///
+ protected void Window1_Close(object sender, WindowCloseEventArgs e)
+ {
+ BindGrid();
+ }
+ #endregion
+
+ #region 删除
+ ///
+ /// 右键删除
+ ///
+ ///
+ ///
+ 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_Instrumentation model = Funs.DB.Transfer_Instrumentation.FirstOrDefault(x=>x.Id==rowID);
+ if (model != null)
+ {
+ Funs.DB.Transfer_Instrumentation.DeleteOnSubmit(model);
+ Funs.DB.SubmitChanges();
+ }
+ }
+ BindGrid();
+ ShowNotify("删除数据成功!", MessageBoxIcon.Success);
+ }
+ }
+ #endregion
+
+ #region 导入
+ ///
+ /// 导入按钮
+ ///
+ ///
+ ///
+ protected void btnImport_Click(object sender, EventArgs e)
+ {
+ PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("InstrumentationDataIn.aspx", "导入 - ")));
+ }
+ #endregion
+
+ #region 获取按钮权限
+ ///
+ /// 获取按钮权限
+ ///
+ ///
+ ///
+ private void GetButtonPower()
+ {
+ if (Request.Params["value"] == "0")
+ {
+ return;
+ }
+ var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.InstrumentationMenuId);
+ 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
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.designer.cs
new file mode 100644
index 00000000..e7fd10a4
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.designer.cs
@@ -0,0 +1,161 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.Transfer
+{
+
+
+ public partial class Instrumentation
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// Panel1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel Panel1;
+
+ ///
+ /// Grid1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid1;
+
+ ///
+ /// ToolSearch 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar ToolSearch;
+
+ ///
+ /// txtINSTRUMENTATION 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtINSTRUMENTATION;
+
+ ///
+ /// txtStarTime 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DatePicker txtStarTime;
+
+ ///
+ /// Label1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Label Label1;
+
+ ///
+ /// txtEndTime 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DatePicker txtEndTime;
+
+ ///
+ /// btnSearch 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnSearch;
+
+ ///
+ /// btnImport 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImport;
+
+ ///
+ /// ToolbarText1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarText ToolbarText1;
+
+ ///
+ /// ddlPageSize 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DropDownList ddlPageSize;
+
+ ///
+ /// Window2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Window Window2;
+
+ ///
+ /// Menu1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Menu Menu1;
+
+ ///
+ /// btnMenuDel 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.MenuButton btnMenuDel;
+ }
+}
diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx
new file mode 100644
index 00000000..6149195d
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx
@@ -0,0 +1,68 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InstrumentationDataIn.aspx.cs" Inherits="FineUIPro.Web.Transfer.InstrumentationDataIn" %>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs
new file mode 100644
index 00000000..b91d78c9
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs
@@ -0,0 +1,408 @@
+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 InstrumentationDataIn : PageBase
+ {
+ #region 定义变量
+ ///
+ /// 上传预设的虚拟路径
+ ///
+ private string initPath = Const.ExcelUrl;
+
+
+ ///
+ /// 错误集合
+ ///
+ public static List errorInfos = new List();
+ #endregion
+
+ #region 加载
+ ///
+ /// 加载页面
+ ///
+ ///
+ ///
+ 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 审核
+ ///
+ /// 审核
+ ///
+ ///
+ ///
+ protected void btnAudit_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ 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提取数据
+ ///
+ /// 从Excel提取数据--》Dataset
+ ///
+ /// Excel文件路径名
+ 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的数据导入数据库
+ ///
+ /// 将Dataset的数据导入数据库
+ ///
+ /// 数据集
+ /// 数据集行数
+ ///
+ 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)
+ {
+ var oldViewInfos = from x in Funs.DB.Comprehensive_InspectionEquipment
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ select x;
+
+ var units = from x in Funs.DB.Base_Unit
+ join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
+ where y.ProjectId == this.CurrUser.LoginProjectId
+ select x;
+
+ var cns = from x in Funs.DB.Base_CNProfessional select x;
+
+ for (int i = 0; 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 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 导入
+ ///
+ /// 导入
+ ///
+ ///
+ ///
+ 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提取数据
+ ///
+ /// 从Excel提取数据--》Dataset
+ ///
+ /// Excel文件路径名
+ 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的数据导入数据库
+ ///
+ /// 将Dataset的数据导入数据库
+ ///
+ /// 数据集
+ /// 数据集列数
+ ///
+ 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 list = new List();
+ for (int i = 0; i < ir; i++)
+ {
+
+ Model.Transfer_Instrumentation model = new Model.Transfer_Instrumentation();
+ model.Id = Guid.NewGuid().ToString();
+ model.ProjectId = CurrUser.LoginProjectId;
+ model.INSTRUMENTATION= 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);
+ }
+ if (list.Count > 0)
+ {
+ Funs.DB.Transfer_Instrumentation.InsertAllOnSubmit(list);
+ Funs.DB.SubmitChanges();
+ }
+ }
+ else
+ {
+ ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
+ }
+ return true;
+ }
+ #endregion
+ #endregion
+
+ #region 下载模板
+ ///
+ /// 下载模板按钮
+ ///
+ ///
+ ///
+ 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")));
+ }
+
+ ///
+ /// 下载导入模板
+ ///
+ ///
+ ///
+ protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
+ {
+ if (e.EventArgument == "Confirm_OK")
+ {
+ string rootPath = Server.MapPath("~/");
+ string uploadfilepath = rootPath + "File\\Excel\\DataIn\\Instrumentation导入模板.xls";
+ string filePath = "File\\Excel\\DataIn\\Instrumentation导入模板.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
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.designer.cs
new file mode 100644
index 00000000..a4806eab
--- /dev/null
+++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.designer.cs
@@ -0,0 +1,125 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.Transfer
+{
+
+
+ public partial class InstrumentationDataIn
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// SimpleForm1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// hdFileName 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.HiddenField hdFileName;
+
+ ///
+ /// btnAudit 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnAudit;
+
+ ///
+ /// btnImport 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImport;
+
+ ///
+ /// btnDownLoad 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnDownLoad;
+
+ ///
+ /// hdCheckResult 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.HiddenField hdCheckResult;
+
+ ///
+ /// fuAttachUrl 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.FileUpload fuAttachUrl;
+
+ ///
+ /// gvErrorInfo 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid gvErrorInfo;
+
+ ///
+ /// lblPageIndex 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Label lblPageIndex;
+ }
+}