diff --git a/HJGL_DS/BLL/JGZL/MaterialQualityCertificateDocService.cs b/HJGL_DS/BLL/JGZL/MaterialQualityCertificateDocService.cs index dd38a0c..48389f3 100644 --- a/HJGL_DS/BLL/JGZL/MaterialQualityCertificateDocService.cs +++ b/HJGL_DS/BLL/JGZL/MaterialQualityCertificateDocService.cs @@ -88,5 +88,16 @@ namespace BLL db.SubmitChanges(); } } + + public static void DeleteListByProjectId(string projectId) + { + SGGLDB db = Funs.DB; + var q = (from x in db.JGZL_MaterialQualityCertificateDoc where x.ProjectId == projectId select x).ToList(); + if (q.Count>0) + { + db.JGZL_MaterialQualityCertificateDoc.DeleteAllOnSubmit(q); + db.SubmitChanges(); + } + } } } diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/材料质量证明文件一览表.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/材料质量证明文件一览表.frx index 504cc79..6c12c78 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/材料质量证明文件一览表.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/材料质量证明文件一览表.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -63,7 +63,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx index b5aca16..ea723da 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx @@ -40,6 +40,7 @@ + @@ -49,52 +50,84 @@ + EnableTextSelection="True" AutoScroll="true" OnPreDataBound="Grid1_PreDataBound"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - @@ -113,30 +146,10 @@ - - - - - - - - diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.cs index 5583563..1aad690 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.cs @@ -1,18 +1,52 @@ using BLL; +using Model; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.Data.SqlClient; using System.Data; +using System.Data.SqlClient; +using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -using System.IO; namespace FineUIPro.Web.JGZL { public partial class MaterialQualityCertificateDoc : PageBase { + #region 定义项 + /// + /// 主键 + /// + private string MaterialId + { + get + { + return (string)ViewState["MaterialId"]; + } + set + { + ViewState["MaterialId"] = value; + } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载页面 /// /// 加载页面 @@ -35,6 +69,7 @@ namespace FineUIPro.Web.JGZL this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId; this.InitTreeMenu();//加载树 this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue; + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -83,6 +118,7 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -94,19 +130,9 @@ namespace FineUIPro.Web.JGZL /// private void BindGrid() { - //string projectIds = BLL.Base_ProjectService.GetStrOnProjectIds(this.CurrUser.UserId, "1"); - string strSql = @"SELECT * from JGZL_MaterialQualityCertificateDoc where 1=1"; + string strSql = @"SELECT * from JGZL_MaterialQualityCertificateDoc where ProjectId = @ProjectId order by CompileDate asc"; List listStr = new List(); - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - strSql += " AND ProjectId = @ProjectId"; - listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID)); - } - //else - //{ - // strSql += " AND CHARINDEX(ProjectId,@ProjectId)>0 "; - // listStr.Add(new SqlParameter("@ProjectId", projectIds)); - //} + listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); // 2.获取当前分页数据 @@ -165,7 +191,9 @@ namespace FineUIPro.Web.JGZL /// protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e) { + this.ProjectId = this.drpProjectId.SelectedValue; this.InitTreeMenu(); + this.tvControlItem.SelectedNodeID = this.ProjectId; this.BindGrid(); } @@ -196,7 +224,7 @@ namespace FineUIPro.Web.JGZL string rootPath = Server.MapPath("~/"); BLL.Common.FastReportService.ResetData(); - string strSql = @"SELECT * from JGZL_MaterialQualityCertificateDoc where ProjectId = @ProjectId order by MaterialCode desc"; + string strSql = @"SELECT * from JGZL_MaterialQualityCertificateDoc where ProjectId = @ProjectId order by CompileDate asc"; List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", projectId)); SqlParameter[] parameter = listStr.ToArray(); @@ -267,7 +295,36 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialQualityCertificateDocEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - "))); + JArray teamGroupData = Grid1.GetMergedData(); + List list = new List(); + foreach (JObject teamGroupRow in teamGroupData) + { + JObject values = teamGroupRow.Value("values"); + list.Add(values); + } + JObject defaultObj = new JObject + { + { "MaterialId", Guid.NewGuid() }, + { "MaterialName", ""}, + { "MaterialCode", "" }, + { "SerialCode", "" }, + { "Material", "" }, + { "Specification", "" }, + { "Manufacturer", "" }, + { "Unit", "" }, + { "TotalNum", "" }, + { "ReInspectionReportCode", "" }, + { "ReceivingUnit", "" }, + { "DrawNum", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); } else { @@ -276,139 +333,83 @@ namespace FineUIPro.Web.JGZL } } - /// - /// 双击编辑 - /// - /// - /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + protected void Grid1_PreDataBound(object sender, EventArgs e) { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MaterialQualityCertificateDocMenuId, BLL.Const.BtnModify)) - { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) - { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialQualityCertificateDocEdit.aspx?materialId={0}", this.Grid1.SelectedRowID, "编辑 - "))); - } - else - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - } - else - { - Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); - return; - } - } - else - { - ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } + // 设置LinkButtonField的点击客户端事件 + LinkButtonField deleteField = Grid1.FindColumn("Delete3") as LinkButtonField; + deleteField.OnClientClick = GetDeleteScriptGrid1(); } /// - /// 右键编辑 - /// - /// - /// - protected void btnMenuEdit_Click(object sender, EventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MaterialQualityCertificateDocMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialQualityCertificateDocEdit.aspx?materialId={0}", Grid1.SelectedRowID, "维护 - "))); - } - else - { - Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } - - /// - /// 右键删除 - /// - /// - /// - protected void btnMenuDelete_Click(object sender, EventArgs e) - { - if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_MaterialQualityCertificateDocMenuId, Const.BtnDelete)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - - bool isShow = true; - if (Grid1.SelectedRowIndexArray.Length > 1) - { - isShow = false; - } - bool isDelete = false; - foreach (int rowIndex in Grid1.SelectedRowIndexArray) - { - string rowID = Grid1.DataKeys[rowIndex][0].ToString(); - if (judgementDelete(rowID, isShow)) - { - isDelete = true; - BLL.MaterialQualityCertificateDocService.DeleteMaterialQualityCertificateDocById(rowID); - BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除材料质量证明文件一览表"); - } - } - if (isDelete) - { - ShowNotify("删除成功!", MessageBoxIcon.Success); - } - this.BindGrid(); - } - else - { - Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } - - #region 判断是否可删除 - /// - /// 判断是否可以删除 + /// 删除提示 /// /// - private bool judgementDelete(string id, bool isShow) + private string GetDeleteScriptGrid1() { - string content = string.Empty; - - if (string.IsNullOrEmpty(content)) - { - return true; - } - else - { - if (isShow) - { - Alert.ShowInTop(content, MessageBoxIcon.Error); - } - return false; - } + return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, + Grid1.GetDeleteSelectedRowsReference(), String.Empty); } - #endregion - #endregion + #endregion - #region 关闭弹出窗口及刷新页面 + #region 保存 /// - /// 关闭弹出窗口 + /// 保存按钮 /// /// /// - protected void Window1_Close(object sender, WindowCloseEventArgs e) + protected void btnSave_Click(object sender, EventArgs e) { - this.InitTreeMenu();//加载树 - this.BindGrid(); + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, + Const.JGZL_MaterialQualityCertificateDocMenuId, Const.BtnSave)) + { + BLL.MaterialQualityCertificateDocService.DeleteListByProjectId(this.ProjectId); + List lists = new List(); + JArray teamGroupData = Grid1.GetMergedData(); + foreach (JObject teamGroupRow in teamGroupData) + { + JObject values = teamGroupRow.Value("values"); + int rowIndex = teamGroupRow.Value("index"); + Model.JGZL_MaterialQualityCertificateDoc newDetail = new Model.JGZL_MaterialQualityCertificateDoc + { + MaterialId = values.Value("MaterialId"), + ProjectId = this.ProjectId, + MaterialName = values.Value("MaterialName"), + MaterialCode = values.Value("MaterialCode"), + SerialCode = values.Value("SerialCode"), + Material = values.Value("Material"), + Specification = values.Value("Specification"), + Manufacturer = values.Value("Manufacturer"), + Unit = values.Value("Unit"), + TotalNum = Funs.GetNewInt(values.Value("TotalNum")), + ReInspectionReportCode = values.Value("ReInspectionReportCode"), + ReceivingUnit = values.Value("ReceivingUnit"), + DrawNum = Funs.GetNewInt(values.Value("DrawNum")), + CompileMan = this.CurrUser.UserId, + CompileDate = DateTime.Now, + Reviewer = this.CurrUser.UserId, + RevieweDate = DateTime.Now + }; + lists.Add(newDetail); + } + try + { + if (lists.Count > 0) + { + Funs.DB.JGZL_MaterialQualityCertificateDoc.InsertAllOnSubmit(lists); + ShowNotify("保存成功!", MessageBoxIcon.Success); + } + Funs.DB.SubmitChanges(); + } + catch (Exception) + { + return; + } + } + else + { + Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } } #endregion } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.designer.cs index bda3843..674daf6 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/MaterialQualityCertificateDoc.aspx.designer.cs @@ -113,6 +113,15 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Button btnAdd; + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + /// /// btnPrint 控件。 /// @@ -131,6 +140,105 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Grid Grid1; + /// + /// txtMaterialName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterialName; + + /// + /// txtMaterialCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterialCode; + + /// + /// txtSerialCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSerialCode; + + /// + /// txtMaterial 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterial; + + /// + /// txtSpecification 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecification; + + /// + /// txtManufacturer 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtManufacturer; + + /// + /// txtUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUnit; + + /// + /// txtTotalNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTotalNum; + + /// + /// txtReInspectionReportCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtReInspectionReportCode; + + /// + /// txtReceivingUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtReceivingUnit; + + /// + /// txtDrawNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDrawNum; + /// /// ToolbarSeparator1 控件。 /// @@ -158,15 +266,6 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.DropDownList ddlPageSize; - /// - /// Window1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window Window1; - /// /// WindowPrint 控件。 /// @@ -175,32 +274,5 @@ namespace FineUIPro.Web.JGZL /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window WindowPrint; - - /// - /// Menu1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Menu Menu1; - - /// - /// btnMenuEdit 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuEdit; - - /// - /// btnMenuDelete 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuDelete; } } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx index 518e266..31ec204 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx @@ -50,7 +50,7 @@ @@ -180,12 +180,12 @@ Height="600px"> - + + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs index 003d84b..18376d4 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs @@ -1,15 +1,12 @@ using BLL; using Model; using Newtonsoft.Json.Linq; -using NPOI.SS.UserModel; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.IO; using System.Linq; -using System.Web; -using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.JGZL @@ -46,6 +43,11 @@ namespace FineUIPro.Web.JGZL ViewState["ProjectId"] = value; } } + + /// + /// 定义集合 + /// + private static List list = new List(); #endregion #region 加载页面 @@ -130,7 +132,7 @@ namespace FineUIPro.Web.JGZL /// private void BindGrid() { - string strSql = @"SELECT * from JGZL_PipeFittingInspectionRecord where ProjectId=@projectId"; + string strSql = @"SELECT * from JGZL_PipeFittingInspectionRecord where ProjectId=@projectId order by CompileDate "; List listStr = new List(); listStr.Add(new SqlParameter("@projectId", this.ProjectId)); SqlParameter[] parameter = listStr.ToArray(); @@ -139,7 +141,7 @@ namespace FineUIPro.Web.JGZL Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; - Grid1.DataBind(); + Grid1.DataBind(); } #endregion @@ -301,30 +303,29 @@ namespace FineUIPro.Web.JGZL JObject values = teamGroupRow.Value("values"); list.Add(values); } - JObject defaultObj = new JObject - { - { "RecordId", Guid.NewGuid() }, - { "Name", ""}, - { "ContractNo", "" }, - { "ArrivalUnit", "" }, - { "ArrivalNum", "" }, - { "MaterialCertificateNumber", "" }, - { "Material", "" }, - { "Specifications", "" }, - { "InspectionNum", "" }, - { "ODVariation", "" }, - { "IDVariation", "" }, - { "WallVariation", "" }, - { "OtherVariation", "" }, - { "AppearanceQuality", "" }, - { "Result", "" }, { - "Delete3", - String.Format("", - GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) - } - }; + { "RecordId", Guid.NewGuid() }, + { "Name", ""}, + { "ContractNo", "" }, + { "ArrivalUnit", "" }, + { "ArrivalNum", "" }, + { "MaterialCertificateNumber", "" }, + { "Material", "" }, + { "Specifications", "" }, + { "InspectionNum", "" }, + { "ODVariation", "" }, + { "IDVariation", "" }, + { "WallVariation", "" }, + { "OtherVariation", "" }, + { "AppearanceQuality", "" }, + { "Result", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; list.Add(defaultObj); Grid1.DataSource = list; Grid1.DataBind(); @@ -399,6 +400,8 @@ namespace FineUIPro.Web.JGZL { Funs.DB.JGZL_PipeFittingInspectionRecord.InsertAllOnSubmit(lists); ShowNotify("保存成功!", MessageBoxIcon.Success); + this.Grid1.DataSource = lists; + this.Grid1.DataBind(); } Funs.DB.SubmitChanges(); } @@ -415,6 +418,12 @@ namespace FineUIPro.Web.JGZL } #endregion + #region 复制 + /// + /// 复制 + /// + /// + /// protected void btnCopy_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) @@ -426,30 +435,55 @@ namespace FineUIPro.Web.JGZL JObject values = teamGroupRow.Value("values"); list.Add(values); } + // 1. 获取选中行索引并校验 int index = Grid1.SelectedRowIndex; - JObject defaultObj = new JObject - { - { "RecordId", Guid.NewGuid() }, - { "Name", Grid1.Rows[index].Values[1].ToString()}, - { "ContractNo", Grid1.Rows[index].Values[2].ToString()}, - { "ArrivalUnit", Grid1.Rows[index].Values[4].ToString() }, - { "ArrivalNum", Grid1.Rows[index].Values[5].ToString() }, - { "MaterialCertificateNumber", Grid1.Rows[index].Values[6].ToString() }, - { "Material", Grid1.Rows[index].Values[7].ToString() }, - { "Specifications", Grid1.Rows[index].Values[8].ToString() }, - { "InspectionNum", Grid1.Rows[index].Values[9].ToString()}, - { "ODVariation", Grid1.Rows[index].Values[11].ToString() }, - { "IDVariation", Grid1.Rows[index].Values[12].ToString() }, - { "WallVariation", Grid1.Rows[index].Values[13].ToString() }, - { "OtherVariation", Grid1.Rows[index].Values[14].ToString() }, - { "AppearanceQuality", Grid1.Rows[index].Values[15].ToString() }, - { "Result", Grid1.Rows[index].Values[16].ToString()}, + if (index < 0 || index >= Grid1.Rows.Count) { - "Delete3", - String.Format("", - GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + Alert.ShowInTop("请选中要复制的数据行!", MessageBoxIcon.Warning); + return; } - }; + string name = Grid1.Rows[index].Values[1].ToString() ?? ""; + string contractNo = Grid1.Rows[index].Values[2].ToString() ?? ""; + string arrivalUnit = Grid1.Rows[index].Values[4].ToString() ?? ""; + string arrivalNum = Grid1.Rows[index].Values[5].ToString() ?? ""; + string materialCertificateNumber = Grid1.Rows[index].Values[6].ToString() ?? ""; + string material = Grid1.Rows[index].Values[7].ToString() ?? ""; + string specifications = Grid1.Rows[index].Values[8].ToString() ?? ""; + string inspectionNum = Grid1.Rows[index].Values[9].ToString() ?? ""; + string oDVariation = Grid1.Rows[index].Values[11].ToString() ?? ""; + string iDVariation = Grid1.Rows[index].Values[12].ToString() ?? ""; + string wallVariation = Grid1.Rows[index].Values[13].ToString() ?? ""; + string otherVariation = Grid1.Rows[index].Values[14].ToString() ?? ""; + string appearanceQuality = Grid1.Rows[index].Values[15].ToString() ?? ""; + string result = Grid1.Rows[index].Values[16].ToString() ?? ""; + if (string.IsNullOrEmpty(name) && string.IsNullOrEmpty(contractNo) && string.IsNullOrEmpty(arrivalUnit) && string.IsNullOrEmpty(arrivalNum) && string.IsNullOrEmpty(materialCertificateNumber) && string.IsNullOrEmpty(material) && string.IsNullOrEmpty(specifications) && string.IsNullOrEmpty(inspectionNum) && string.IsNullOrEmpty(oDVariation) && string.IsNullOrEmpty(iDVariation) && string.IsNullOrEmpty(wallVariation) && string.IsNullOrEmpty(otherVariation) && string.IsNullOrEmpty(appearanceQuality) && string.IsNullOrEmpty(result)) + { + Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning); + return; + } + JObject defaultObj = new JObject + { + { "RecordId", Guid.NewGuid() }, + { "Name",name}, + { "ContractNo",contractNo}, + { "ArrivalUnit",arrivalUnit }, + { "ArrivalNum",arrivalNum }, + { "MaterialCertificateNumber", materialCertificateNumber}, + { "Material",material }, + { "Specifications", specifications }, + { "InspectionNum",inspectionNum }, + { "ODVariation",oDVariation}, + { "IDVariation",iDVariation }, + { "WallVariation",wallVariation }, + { "OtherVariation", otherVariation}, + { "AppearanceQuality", appearanceQuality }, + { "Result",result }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; list.Add(defaultObj); Grid1.DataSource = list; Grid1.DataBind(); @@ -460,8 +494,6 @@ namespace FineUIPro.Web.JGZL return; } } - - - + #endregion } } \ No newline at end of file