diff --git a/HJGL_DS/BLL/JGZL/ValveInspectionTestRecordService.cs b/HJGL_DS/BLL/JGZL/ValveInspectionTestRecordService.cs index 2362b2f..f9861e3 100644 --- a/HJGL_DS/BLL/JGZL/ValveInspectionTestRecordService.cs +++ b/HJGL_DS/BLL/JGZL/ValveInspectionTestRecordService.cs @@ -1,4 +1,5 @@ -using Model; +using FastReport.DevComponents.DotNetBar; +using Model; using System.Linq; namespace BLL @@ -94,5 +95,16 @@ namespace BLL db.SubmitChanges(); } } + + public static void DeleteListByProjectId(string projectId) + { + SGGLDB db = Funs.DB; + var q = (from x in db.JGZL_ValveInspectionTestRecord where x.ProjectId == projectId select x).ToList(); + if (q.Count > 0) + { + db.JGZL_ValveInspectionTestRecord.DeleteAllOnSubmit(q); + db.SubmitChanges(); + } + } } } diff --git a/HJGL_DS/BLL/JGZL/ValveTestConfirmationFormService.cs b/HJGL_DS/BLL/JGZL/ValveTestConfirmationFormService.cs index f198850..be3c234 100644 --- a/HJGL_DS/BLL/JGZL/ValveTestConfirmationFormService.cs +++ b/HJGL_DS/BLL/JGZL/ValveTestConfirmationFormService.cs @@ -86,5 +86,20 @@ namespace BLL db.SubmitChanges(); } } + + /// + /// 根据项目Id删除阀门试验确认表 + /// + /// + public static void DeleteListByProjectId(string projectId) + { + SGGLDB db = Funs.DB; + var q = (from x in db.JGZL_ValveTestConfirmationForm where x.ProjectId == projectId select x).ToList(); + if (q.Count>0) + { + db.JGZL_ValveTestConfirmationForm.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 977df20..79aa0b7 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/阀门检验试验记录.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/阀门检验试验记录.frx @@ -1,7 +1,48 @@  - + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + + private void Table3_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Data"); + // init the data source + rowData.Init(); + + // print the first table row - it is a header + + // now enumerate the data source and print the table body + while (rowData.HasMoreRows) + { + // print the table body + Table3.PrintRow(0); + Table3.PrintColumns(); + + // go next data source row + rowData.Next(); + } + } + } +} + - + @@ -101,7 +142,7 @@ - + diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/阀门试验确认表.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/阀门试验确认表.frx index 73bbd62..b039257 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; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs index b3e037d..4f21b1a 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs @@ -200,8 +200,9 @@ namespace FineUIPro.Web.JGZL /// protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e) { - this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue; + this.ProjectId = this.drpProjectId.SelectedValue; this.InitTreeMenu(); + this.tvControlItem.SelectedNodeID = this.ProjectId; BindGrid(); } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx index d88f52e..6fffc6a 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx @@ -40,6 +40,7 @@ + @@ -51,71 +52,118 @@ EnableColumnLines="true" ClicksToEdit="1" DataIDField="RecordId" AllowSorting="true" SortField="Code" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" - EnableTextSelection="True" AutoScroll="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"> + EnableTextSelection="True" AutoScroll="true" OnPreDataBound="Grid1_PreDataBound"> - - + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> + + + - + + + + - + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> + + + - + + + + - + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> + + + - + + + + - + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + + + - - - @@ -134,30 +182,10 @@ - - - - - - - - diff --git a/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx.cs index 6bb3aa9..ab8b175 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.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 ValveInspectionTestRecord : PageBase { + #region 定义项 + /// + /// 主键 + /// + private string RecordId + { + get + { + return (string)ViewState["RecordId"]; + } + set + { + ViewState["RecordId"] = value; + } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载页面 /// /// 加载页面 @@ -34,6 +68,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(); } } @@ -82,6 +117,7 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -164,7 +200,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(); } @@ -274,7 +312,41 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveInspectionTestRecordEdit.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 + { + { "RecordId", Guid.NewGuid() }, + { "Name", ""}, + { "SpecificationModel", "" }, + { "Code", "" }, + { "NominalPressure", "" }, + { "PressuretTestMedium", "" }, + { "PressuretTestPressure", "" }, + { "PressureTestTime", "" }, + { "SealTestMedium", "" }, + { "SealTestPressure", "" }, + { "SealTestTime", "" }, + { "UpperSealTestMedium", "" }, + { "UpperSealTestPressure", "" }, + { "UpperSealTestTime", "" }, + { "InspectionResults", "" }, + { "Remark", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); } else { @@ -282,140 +354,87 @@ namespace FineUIPro.Web.JGZL return; } } - - /// - /// 双击编辑 - /// - /// - /// - 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_ValveInspectionTestRecordMenuId, BLL.Const.BtnModify)) - { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) - { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveInspectionTestRecordEdit.aspx?recordId={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_ValveInspectionTestRecordMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveInspectionTestRecordEdit.aspx?recordId={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_ValveInspectionTestRecordMenuId, 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.ValveInspectionTestRecordService.DeleteValveInspectionTestRecordById(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 - #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_ValveInspectionTestRecordMenuId, Const.BtnSave)) + { + BLL.ValveInspectionTestRecordService.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_ValveInspectionTestRecord newDetail = new Model.JGZL_ValveInspectionTestRecord + { + RecordId = values.Value("RecordId"), + ProjectId = this.ProjectId, + Name = values.Value("Name"), + SpecificationModel = values.Value("SpecificationModel"), + Code = values.Value("Code"), + NominalPressure = values.Value("NominalPressure"), + PressuretTestMedium =values.Value("PressuretTestMedium"), + PressuretTestPressure = values.Value("PressuretTestPressure"), + PressureTestTime = values.Value("PressureTestTime"), + SealTestMedium = values.Value("SealTestMedium"), + SealTestPressure = values.Value("SealTestPressure"), + SealTestTime = values.Value("SealTestTime"), + UpperSealTestMedium = values.Value("UpperSealTestMedium"), + UpperSealTestPressure = values.Value("UpperSealTestPressure"), + UpperSealTestTime = values.Value("UpperSealTestTime"), + InspectionResults = values.Value("InspectionResults"), + Remark = values.Value("Remark"), + 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_ValveInspectionTestRecord.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/ValveInspectionTestRecord.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx.designer.cs index 41cec45..33bed51 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveInspectionTestRecord.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,141 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Grid Grid1; + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtSpecificationModel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecificationModel; + + /// + /// txtCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCode; + + /// + /// txtNominalPressure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtNominalPressure; + + /// + /// txtPressuretTestMedium 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPressuretTestMedium; + + /// + /// txtPressuretTestPressure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPressuretTestPressure; + + /// + /// txtPressureTestTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPressureTestTime; + + /// + /// txtSealTestMedium 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSealTestMedium; + + /// + /// txtSealTestPressure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSealTestPressure; + + /// + /// txtSealTestTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSealTestTime; + + /// + /// txtUpperSealTestMedium 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUpperSealTestMedium; + + /// + /// txtUpperSealTestPressure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUpperSealTestPressure; + + /// + /// txtUpperSealTestTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUpperSealTestTime; + + /// + /// txtInspectionResults 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtInspectionResults; + + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemark; + /// /// ToolbarSeparator1 控件。 /// @@ -158,15 +302,6 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.DropDownList ddlPageSize; - /// - /// Window1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window Window1; - /// /// WindowPrint 控件。 /// @@ -175,32 +310,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/ValveTestConfirmationForm.aspx b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx index 8eca65d..ca2a355 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx @@ -40,6 +40,7 @@ + @@ -51,47 +52,85 @@ EnableColumnLines="true" ClicksToEdit="1" DataIDField="RecordId" AllowSorting="true" SortField="Code" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" - EnableTextSelection="True" AutoScroll="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"> + EnableTextSelection="True" AutoScroll="true" OnPreDataBound="Grid1_PreDataBound"> - - + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" MinWidth="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + + + - + <%-- - + --%> @@ -110,30 +149,30 @@ - + --%> - + <%-- - + --%> - + --%> diff --git a/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.cs index 7e5d6d4..b90bd1e 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.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 ValveTestConfirmationForm : PageBase { + #region 定义项 + /// + /// 主键 + /// + private string RecordId + { + get + { + return (string)ViewState["RecordId"]; + } + set + { + ViewState["RecordId"] = value; + } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载页面 /// /// 加载页面 @@ -34,6 +68,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(); } } @@ -82,6 +117,7 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -164,7 +200,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(); } @@ -262,7 +300,38 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.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 + { + { "RecordId", Guid.NewGuid() }, + { "Name", ""}, + { "ModelNumber", "" }, + { "Specifications", "" }, + { "NominalPressure", "" }, + { "Num", "" }, + { "PressureTest", "" }, + { "SealTest", "" }, + { "UpperSealTest", "" }, + { "Code", "" }, + { "TestResults", "" }, + { "Remark", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); + //PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - "))); } else { @@ -270,127 +339,142 @@ namespace FineUIPro.Web.JGZL return; } } + protected void Grid1_PreDataBound(object sender, EventArgs e) + { + // 设置LinkButtonField的点击客户端事件 + LinkButtonField deleteField = Grid1.FindColumn("Delete3") as LinkButtonField; + deleteField.OnClientClick = GetDeleteScriptGrid1(); + } + /// + /// 删除提示 + /// + /// + private string GetDeleteScriptGrid1() + { + return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, + Grid1.GetDeleteSelectedRowsReference(), String.Empty); + } /// /// 双击编辑 /// /// /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_ValveTestConfirmationFormMenuId, BLL.Const.BtnModify)) - { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) - { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.aspx?recordId={0}", this.Grid1.SelectedRowID, "编辑 - "))); - } - else - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - } - else - { - Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); - return; - } - } - else - { - ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } + //protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + //{ + // if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_ValveTestConfirmationFormMenuId, BLL.Const.BtnModify)) + // { + // if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) + // { + // if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) + // { + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.aspx?recordId={0}", this.Grid1.SelectedRowID, "编辑 - "))); + // } + // else + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // } + // else + // { + // Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); + // return; + // } + // } + // else + // { + // ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + // } + //} /// /// 右键编辑 /// /// /// - protected void btnMenuEdit_Click(object sender, EventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_ValveTestConfirmationFormMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.aspx?recordId={0}", Grid1.SelectedRowID, "维护 - "))); - } - else - { - Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } + //protected void btnMenuEdit_Click(object sender, EventArgs e) + //{ + // if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_ValveTestConfirmationFormMenuId, BLL.Const.BtnModify)) + // { + // if (Grid1.SelectedRowIndexArray.Length == 0) + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ValveTestConfirmationFormEdit.aspx?recordId={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_ValveTestConfirmationFormMenuId, Const.BtnDelete)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } + //protected void btnMenuDelete_Click(object sender, EventArgs e) + //{ + // if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_ValveTestConfirmationFormMenuId, 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.ValveTestConfirmationFormService.DeleteValveTestConfirmationFormById(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); - } - } + // 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.ValveTestConfirmationFormService.DeleteValveTestConfirmationFormById(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) - { - string content = string.Empty; + //private bool judgementDelete(string id, bool isShow) + //{ + // string content = string.Empty; - if (string.IsNullOrEmpty(content)) - { - return true; - } - else - { - if (isShow) - { - Alert.ShowInTop(content, MessageBoxIcon.Error); - } - return false; - } - } + // if (string.IsNullOrEmpty(content)) + // { + // return true; + // } + // else + // { + // if (isShow) + // { + // Alert.ShowInTop(content, MessageBoxIcon.Error); + // } + // return false; + // } + //} #endregion #endregion @@ -400,11 +484,75 @@ namespace FineUIPro.Web.JGZL /// /// /// - protected void Window1_Close(object sender, WindowCloseEventArgs e) + //protected void Window1_Close(object sender, WindowCloseEventArgs e) + //{ + // this.InitTreeMenu();//加载树 + // this.BindGrid(); + //} + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) { - this.InitTreeMenu();//加载树 - this.BindGrid(); + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, + Const.JGZL_ValveTestConfirmationFormMenuId, Const.BtnSave)) + { + BLL.ValveTestConfirmationFormService.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_ValveTestConfirmationForm newDetail = new Model.JGZL_ValveTestConfirmationForm + { + RecordId = values.Value("RecordId"), + ProjectId = this.ProjectId, + Name = values.Value("Name"), + ModelNumber = values.Value("ModelNumber"), + Specifications = values.Value("Specifications"), + NominalPressure = values.Value("NominalPressure"), + Num = Funs.GetNewInt(values.Value("Num")), + PressureTest = values.Value("PressureTest"), + SealTest = values.Value("SealTest"), + UpperSealTest = values.Value("UpperSealTest"), + Code = values.Value("Code"), + TestResults = values.Value("TestResults"), + Remark = values.Value("Remark"), + 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_ValveTestConfirmationForm.InsertAllOnSubmit(lists); + ShowNotify("保存成功!", MessageBoxIcon.Success); + } + Funs.DB.SubmitChanges(); + } + catch (Exception) + { + return; + } + //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + else + { + Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } } #endregion + } } \ No newline at end of file diff --git a/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.designer.cs index 41e3631..1777f99 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/ValveTestConfirmationForm.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; + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtModelNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtModelNumber; + + /// + /// txtSpecifications 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecifications; + + /// + /// txtNominalPressure 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtNominalPressure; + + /// + /// txtNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtNum; + + /// + /// txtPressureTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPressureTest; + + /// + /// txtSealTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSealTest; + + /// + /// txtUpperSealTest 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUpperSealTest; + + /// + /// txtCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCode; + + /// + /// txtTestResults 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtTestResults; + + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemark; + /// /// 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; } }