3源代码-XX系统V1.0
更新时间:2024-06-29 06:09:01 阅读量: 综合文库 文档下载
XXXX系统V1.0
源代码
XXXX系统V1.0 1
using System;
using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web;
using System.Web.Security; using System.Web.UI;
using System.Web.UI.HtmlControls; using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Empiresoft.Data.DB;
using DevExpress.Web.ASPxTreeList; using System.Collections.Generic; namespace JNJGPT.DNCJJG {
public partial class AddFCJDB : System.Web.UI.Page {
#region 页面加载
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
if (Request.QueryString[\ {
ViewState[\ ViewState[\ }
DateTime _dtNow = GG.PubCommonMethod.GetNow(); if (Convert.ToInt16(ViewState[\Convert.ToInt16(ViewState[\ {
ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page),
\为了保证数据准确性,请不要提前新增电表!');window.opener=null;window.close();\ return; }
ViewState[\
if (((DataTable)ViewState[\ {
XXXX系统V1.0 3
InitTreeList();
GG.PubCommonControl.BASPxTreeList(this.ASPxTreeList1, (DataTable)ViewState[\ } else {
this.lblTitle.Text = \当前没有非数据采集电表,请先转到系统管理—>电表管理 添加!\\n 状态为无效的电表是非采集电表\
lblTitle.ForeColor = System.Drawing.Color.Red; return; } }
else GG.PubCommonControl.BASPxTreeList(this.ASPxTreeList1, (DataTable)ViewState[\ }
#endregion
#region 初始化树形结构 private void InitTreeList() {
this.ASPxTreeList1.Columns.Clear();
//this.ASPxTreeList1.Settings.ShowColumnHeaders = false; //建筑名称
GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \1, DevExpress.Web.ASPxClasses.DefaultBoolean.True,
HorizontalAlign.Center, HorizontalAlign.Left, true);
GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \1, DevExpress.Web.ASPxClasses.DefaultBoolean.True,
HorizontalAlign.Center, HorizontalAlign.Left, false); }
#endregion
#region 控制有非电表节点不加选择框
protected void treeList_DataBound(object sender, EventArgs e) {
TreeListNodeIterator iterator = ASPxTreeList1.CreateNodeIterator(); TreeListNode node; while (true) {
node = iterator.GetNext(); if (node == null) break;
node.AllowSelect = !node.HasChildren; } }
#endregion
#region 构建 建筑+非采集电表数据 private DataTable GetJZDB() {
DataTable dtTreeData = null; string strSqlJZ = string.Empty; string strSqlDB = string.Empty; DataTable dtJZ = null; DataTable dtDB = null;
strSqlJZ = \SJBH,JZMC,JZLX,JZBM \
XXXX系统V1.0 4
\ strSqlDB = @\
'J'+convert(varchar,b.JZBH) SJBH,DBMC JZMC,null JZLX,a.JZBM from \
\and a.ZT=4\
dtJZ = DbOpt.Execute_Query(strSqlJZ); dtDB = DbOpt.Execute_Query(strSqlDB); for (int i = dtJZ.Rows.Count - 1; i >= 0; i--) {
string strJZBM = dtJZ.Rows[i][\
DataRow[] dra = dtDB.Select(\strJZBM + \
if (dra == null || dra.Length == 0) {
dtJZ.Rows.RemoveAt(i); } }
dtTreeData = dtJZ.Copy();
for (int i = 0; i < dtDB.Rows.Count; i++) {
dtTreeData.Rows.Add(dtDB.Rows[i].ItemArray); }
return dtTreeData; }
#endregion
#region 将选中电表插入数据补录表
protected void btnSubmit_Click(object sender, EventArgs e) {
if (ASPxTreeList1.GetSelectedNodes().Count <= 0) return; DataTable SJdt = DbOpt.Execute_Query(\
s.BBH,s.nd,s.yd,s.cdl,s.mdl,s.ydl,s.ydje,d.bmbm,d.jzbm,d.ydlx,d.ydxz,d.jsdl,s.cbr,s.cbsj \ \d.bbh=s.bbh\
DataTable DBdt = DbOpt.Execute_Query(\from dncjjg..b_dbxx where zt = 4\
foreach (TreeListNode item in ASPxTreeList1.GetSelectedNodes()) {
ViewState[\
if (BoolQx(ViewState[\ {
DataRow dr = SJdt.NewRow();
dr[\ dr[\ dr[\
object a = DbOpt.ExecuteScalar(\DNCJJG..B_SJ_BL where BBH=\ if (a.ToString() !=\ dr[\ else dr[\
dr[\ViewState[\
dr[\ViewState[\
XXXX系统V1.0 5
dr[\ViewState[\
dr[\ViewState[\
dr[\ViewState[\ SJdt.Rows.Add(dr); } }
int result = DbOpt.Update(SJdt, \ if (result > 0) {
ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), \新增电表成功!');window.close();\ } else
ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.CurrentHandler, typeof(System.Web.UI.Page), \所选电表已存在!');\ }
#region 判断新增电表是否存在
private bool BoolQx(string BBH, DataTable dt) {
DataRow[] drow = dt.Select(\\
return drow.Length <= 0; }
#endregion
#region 拆分出树里面的电表编号 private string GetBBH(string ikey) {
string BBH = ikey.Substring(1, ikey.Length - 1); return BBH; }
#endregion #endregion } }
<%@ Page Language=\Inherits=\
MasterPageFile=\
<%@ Register Assembly=\Culture=neutral, PublicKeyToken=b88d1754d700e49a\
Namespace=\
Width=\ XXXX系统V1.0 6 ShowCollapseBackwardButton=\ EnableCallbacks=\OnFocusedNodeChanged=\ ClientInstanceName=\ ExpandCollapseAction=\/> OnRowValidating=\OnParseValue=\ ClientInstanceName=\OnCellEditorInitialize=\ var obj = new Object(); obj.BH=''; obj.MC=''; XXXX系统V1.0 7 showModalDialog('../GG/Form/FormJZBXZ.aspx?XT=DNCJJG',obj,'dialogHeight: 400px; dialogWidth: 340px;edge: Raised; center: Yes;resizable: No; status: No;help:No;scroll:No;location:no;'); if(obj.MC != '' && obj.BH != '') { var txt = s; txt.SetText(obj.MC); cbkFBBH.PerformCallback(obj.BH); } }\ var obj = new Object(); obj.BM=''; obj.QC=''; obj.BH=''; obj.MC=''; showModalDialog('DBXZSJ.aspx?ID=2',obj,'dialogHeight: 400px; dialogWidth: 340px;edge: Raised; center: Yes;resizable: No; status: No;help:No;scroll:No;location:no;'); if(obj.BM != '' && obj.QC != '') { var txt = s; txt.SetText(obj.MC); cbkJZBM.PerformCallback(obj.BM); cbkJZQC.PerformCallback(obj.QC); } }\ var obj = new Object(); obj.BM=''; XXXX系统V1.0 8 obj.QC=''; obj.BH=''; obj.MC=''; showModalDialog('DBXZSJ.aspx?ID=1',obj,'dialogHeight: 400px; dialogWidth: 340px;edge: Raised; center: Yes;resizable: No; status: No;help:No;scroll:No;location:no;'); if(obj.BM != '' && obj.MC != '') { var txt = s; txt.SetText(obj.MC); cbkBMBM.PerformCallback(obj.BM); } }\
XXXX系统V1.0 9
ClientInstanceName=\
ClientInstanceName=\
AutoPostBack=\ClientInstanceName=\ ClientInstanceName=\AutoPostBack=\ ASPxCallback1.PerformCallback(); }\ ClientInstanceName=\ btnChaXun.SetEnabled(true); ASPxButton1.SetText('刷新电表'); ASPxButton1.SetEnabled(true); }\ XXXX系统V1.0 10 using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Empiresoft.Data.DB; using DevExpress.Web.ASPxTreeList; using DevExpress.Web.ASPxGridView; using System.Text; using System.Text.RegularExpressions; using JNJGPT.GG; using System.Data.SqlClient; using System.Drawing; using DevExpress.Web.ASPxGridView.Export; using System.Collections.Generic; using DevExpress.Web.ASPxEditors; namespace JNJGPT.DNCJJG { public partial class B_DBGL : GG.Form.Form3 { #region 页面加载 protected new void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //根据分辨率设置ASPxSplitter的高度 GG.PubCommonWebHelper.SetASPxH(ASPxSplitter1, 444); //加载网关树 如果建筑下没网关 树不显示 InitTreeList(); //获取 TreeList 数据 ViewState[\ GG.PubCommonWebHelper.GetJZWG(\ //根据分辨率设置GridView的高度 GG.PubCommonWebHelper.SetGridViewH(ASPxGridView1, 344); //初始 Gridview 结构 DBInfoGridview(); } //绑定 TreeList 数据 GG.PubCommonControl.BASPxTreeList(this.ASPxTreeList1, (DataTable)ViewState[\ //设置 TreeList 图标 ASPxTreeList1.Templates.DataCell = new WHTreeLable(1); if (Session[\ { XXXX系统V1.0 11 InitBase(); _dt = (DataTable)Session[\ GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } else { InitBase(); this.OpenDataTable(\ GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } } #endregion #region 初始Sql语句 protected override void InitBase() { strSql = \ } #endregion #region 初始化区域树形结构 private void InitTreeList() { this.ASPxTreeList1.Columns.Clear(); this.ASPxTreeList1.Settings.ShowColumnHeaders = false; //建筑名称 GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \建筑名称\ HorizontalAlign.Center, HorizontalAlign.Left, true); GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \建筑编码\ HorizontalAlign.Center, HorizontalAlign.Left, false); } #endregion #region 初始化电表信息数据 private void DBInfoGridview() { #region 动态列 //电表编号 GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \编 号\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); //电表名称 GridViewDataColumn dbmc = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表名称\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); dbmc.EditFormSettings.VisibleIndex = 0; //所属网关 GridViewDataComboBoxColumn WGMC = GG.PubCommonControl.AddComboColumn2GridView(ASPxGridView1, \ DbOpt.Execute_Query(\\所属网关\ WGMC.Visible = false; WGMC.EditFormSettings.VisibleIndex = 9; XXXX系统V1.0 12 //多费率 GridViewDataCheckColumn DFL = GG.PubCommonControl.AddCheckColumn2GridView(ASPxGridView1, \多费率\DevExpress.Web.ASPxClasses.DefaultBoolean.True); DFL.EditFormSettings.VisibleIndex = 2; DFL.PropertiesCheckEdit.ValueUncheckedString = \ //电表生产厂家 GridViewDataColumn SCCJ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \生产厂家\11, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); SCCJ.EditFormSettings.VisibleIndex = 18; //倍率 GridViewDataColumn BL = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \倍 率\8, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, true); BL.EditFormSettings.VisibleIndex = 8; //电表型号 GridViewDataColumn dbxh = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表型号\5, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dbxh.EditFormSettings.VisibleIndex = 21; //用电类型 GridViewDataComboBoxColumn YDLX = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \用电类型\ YDLX.EditFormSettings.VisibleIndex = 7; //平电价 GridViewDataColumn pdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \平 电 价\7, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); pdj.EditFormSettings.VisibleIndex = 11; //用电性质 GridViewDataComboBoxColumn YDXZ = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \用电性质\ YDXZ.EditFormSettings.VisibleIndex = 10; //尖电价 GridViewDataColumn jdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \尖 电 价\10, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); jdj.EditFormSettings.VisibleIndex = 14; //电表地址 GridViewDataColumn dbdz = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \安装地址\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); dbdz.EditFormSettings.VisibleIndex = 15; //初始电量 XXXX系统V1.0 13 GridViewDataColumn csdl = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \初始电量\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); csdl.EditFormSettings.VisibleIndex = 19; //峰电价 GridViewDataColumn fdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \峰 电 价\13, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); fdj.EditFormSettings.VisibleIndex = 17; //电表编号路径 GridViewDataColumn BBHLJ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表编号路径\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); ////建筑编码 //GridViewDataColumn JZBM = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \建筑编码\ // HorizontalAlign.Center, HorizontalAlign.Left, 0, false); //用电人数 GridViewDataColumn YDRS = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \用电人数\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); YDRS.EditFormSettings.VisibleIndex = 16; //谷电价 GridViewDataColumn gdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \谷 电 价\16, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); gdj.EditFormSettings.VisibleIndex = 20; //电表通讯地址 GridViewDataColumn TXDZ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表通讯地址\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); TXDZ.EditFormSettings.VisibleIndex = 12; //固定电话 GridViewDataColumn dh = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \固定电话\18, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dh.EditFormSettings.VisibleIndex = 28; //异常控制 GridViewDataComboBoxColumn YCKZ = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \异常控制\ YCKZ.CellStyle.HorizontalAlign = HorizontalAlign.Center; YCKZ.EditFormSettings.VisibleIndex = 23; //负责人 GridViewDataColumn fzr = XXXX系统V1.0 14 GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \负 责 人\20, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); fzr.EditFormSettings.VisibleIndex = 22; //手机 GridViewDataColumn sj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \手机号码\21, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); sj.EditFormSettings.VisibleIndex = 25; //异常预警电量 GridViewDataColumn yjdl = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \异常预警电量\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); yjdl.EditFormSettings.VisibleIndex = 26; //状态 GridViewDataComboBoxColumn ZT = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \电表状态\ ZT.CellStyle.HorizontalAlign = HorizontalAlign.Center; ZT.EditFormSettings.VisibleIndex = 13; //备注 GridViewDataColumn bz = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \备 注\24, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); bz.EditFormSettings.VisibleIndex = 30; bz.EditFormSettings.ColumnSpan = 2; //计算电量 GridViewDataCheckColumn JSDL = GG.PubCommonControl.AddCheckColumn2GridView(ASPxGridView1, \计算电量\27, DevExpress.Web.ASPxClasses.DefaultBoolean.True); JSDL.Visible = false; JSDL.EditFormSettings.VisibleIndex = 5; //电表全称 GridViewDataColumn dbqc = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表全称\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dbqc.EditFormSettings.VisibleIndex = 29; dbqc.EditFormSettings.ColumnSpan = 2; //电表序号 GridViewDataColumn BXH = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表序号\28, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); BXH.EditFormSettings.VisibleIndex = 3; //换表末电量 GridViewDataColumn HBMDL = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \换表末电量\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); XXXX系统V1.0 15 HBMDL.EditFormSettings.VisibleIndex = 24; //换表倍率 GridViewDataColumn HBBL = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \换表倍率\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); HBBL.EditFormSettings.VisibleIndex = 27; //增 删 改 GG.PubCommonControl.AddCmdColumn2GridView(this.ASPxGridView1, true, true, true, 0); #endregion ASPxGridView1.SettingsEditing.EditFormColumnCount = 3;//编辑时显示的列数 GG.PubCommonWebHelper.SetWHGridViewTS(ASPxGridView1, 13);//分页时单页显示行数 } #endregion #region 获取建筑全称 protected void cbkJZQC_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取建筑编码 protected void cbkJZBM_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取部门编码 protected void cbkBMBM_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取父表编号 protected void cbkFBBH_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 增 删 改 #region 新增 protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { this.ASPxGridView_RowInserting(this.ASPxGridView1, e, false); } protected override bool ASPxGridView_RowInserting_User(ASPxGridView XXXX系统V1.0 16 ASPxGridView1, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { DataRow dr = _dt.NewRow(); dr[\DNCJJG..B_DBXX\ dr[\ dr[\ dr[\ if (Session[\ { dr[\ Session[\ } else throw new Exception(\获取父表名称失败,请重新选择!\ if (Convert.ToInt16(dr[\ dr[\没有父级表 表编号路径等于他本身 else { //有父级表 表编号路径等于上级表编号路径加','加上本身表编号 string SJBM = DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where BBH=\ dr[\ } dr[\ dr[\ dr[\ dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ dr[\ if (Session[\ { XXXX系统V1.0 17 dr[\ Session[\ } else throw new Exception(\获取所属建筑失败,请重新选择!\ if (Session[\ { dr[\ Session[\ } else throw new Exception(\获取所属部门失败,请重新选择!\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ { if (Session[\ dr[\e.NewValues[\ else dr[\ } else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ XXXX系统V1.0 18 dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ _dt.Rows.Add(dr); return true; } catch (Exception) { throw; return false; } } #endregion #region 删除 protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { this.ASPxGridView_RowDeleting(ASPxGridView1, e, false); } protected override bool ASPxGridView_RowDeleting_User(ASPxGridView ASPxGridView1, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string BBH = e.Keys[0].ToString(); int result = Convert.ToInt16(DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where FBBH='\ if (result > 0) { throw new Exception(\所选电表下还有子级表,请先删除子级电表再删本电表!\ return false; } else { DataRow[] dr = _dt.Select(\ if (dr.Length > 0) { dr[0].Delete(); } return true; } } #endregion #region 修改 protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { this.ASPxGridView_RowUpdating(this.ASPxGridView1, e, false); } protected override bool ASPxGridView_RowUpdating_User(ASPxGridView ASPxGridView1, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { XXXX系统V1.0 19 DataRow[] dr = _dt.Select(\ if (dr.Length > 0) { dr[0][\ dr[0][\ dr[0][\ if (Session[\ { dr[0][\ Session[\ if (Convert.ToInt16(dr[0][\ dr[0][\没有父级表 表编号路径等于他本身编号 else { //改变了父级表 更改表编号路径 string SJBM = DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where BBH=\ dr[0][\ //修改本表的下级表 GG.PubCommonData.BuildDNCJJG_DBLJ(DataQuery.QueryDataType.DNCJJG, SJBM, Convert.ToInt16(e.Keys[0]), dr[0][\ } } dr[0][\ dr[0][\ dr[0][\ dr[0][\ dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ XXXX系统V1.0 20 else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ //改变了所属建筑 更改电表全称 if (Session[\ Session[\ { //但没有更新电表全称 if (e.NewValues[\e.OldValues[\ { //更改电表全称 dr[0][\e.NewValues[\ } else dr[0][\自行更改了 等于更改值 } else dr[0][\ dr[0][\ if (Session[\ { dr[0][\ Session[\ } dr[0][\ if (Session[\ { dr[0][\ Session[\ } if (e.NewValues[\ XXXX系统V1.0 21 dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ } return true; } #endregion #endregion #region ASPxGridView验证 protected void ASPxGridView1_ParseValue(object sender, DevExpress.Web.Data.ASPxParseValueEventArgs e) { if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\电表通讯地址不能为空且只能为数字!请重新填写.\ else if (e.Value.ToString().Trim().Length > 12) throw new Exception(\电表通讯地址应为12位以内数字组成!\ } if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\倍率不能为空且只能为数字!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\平电价不能为空且只能为数字!\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\尖电价只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\峰电价只能为数字!请重新填写.\ XXXX系统V1.0 22 } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\谷电价只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\初始电量只能为数字!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\手机号码应为11位数字组成!请重新填写.\ else if (e.Value != null && e.Value.ToString().Length != 11) throw new Exception(\手机号码应为11位数字组成!请重新填写.\ } if (e.FieldName.Equals(\ { int yxrs = Convert.ToInt32(e.Value); if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\用电人数应为正整数!请重新填写.\ else if (e.Value != null && yxrs > 32767) throw new Exception(\用电人数不得大于32767!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\异常预警电量只能为数字!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\换表倍率只能为数字!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\换表末电量只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && (Regex.IsMatch(e.Value.ToString(), XXXX系统V1.0 23 @\ throw new Exception(\负责人只能由汉字、数字、大小写字母组成!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value != null && (Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\电表名称只能由汉字、数字、大小写字母组成!请重新填写.\ } } protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e) { //int DBSL = Convert.ToInt16(DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where WGBH='\ //if (DBSL > 32) //{ // e.RowError = \此网关下的电表数量已达到最大限度(32个),不能再增加!请在另一网关下增加或先新建网关。\ // return; //} int dfl = 0; dfl = Convert.ToInt16(e.NewValues[\多费率 如果为1则选中 int YCKZ = 0; YCKZ = Convert.ToInt16(e.NewValues[\异常控制值 1为选中 if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\电表名称必须填写且不能超过100个字符!\ } if (dfl == 1 && e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\在多费率状态下尖电价必须填写!\ } if (dfl == 1 && e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\在多费率状态下峰电价必须填写!\ } if (dfl == 1 && e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\在多费率状态下谷电价必须填写!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\所属网关必须选择!\ XXXX系统V1.0 24 } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\用电性质必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\用电类型必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\父表名称必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\所属建筑必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\所属部门必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\异常控制必须选择!\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\状态必须选择!\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\负责人名称过长!应为30个字符以内。\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\安装地址内容过长!应为50个字符以内。\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\固话号码过长!应为20个字符以内。\ } XXXX系统V1.0 25 if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\生产厂家内容过长!应为50个字符以内。\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\电表型号内容过长!应为20个字符以内。\ } if (YCKZ == 1 && e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\在异常控制模式下异常预警电量必须填写且只能为数字!\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\备注内容过长!应为200个字符以内。\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\电表全称内容过长!应为200个字符以内。\ } if (e.NewValues[\ Encoding.Default.GetByteCount(e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\电表序号内容过长!应为20个字符以内。\ } if (e.NewValues[\ { AddError(e.Errors, ASPxGridView1.Columns[\换表时 电表倍率必须填写!\ } if (string.IsNullOrEmpty(e.RowError) && e.Errors.Count > 0) e.RowError = \请正确填写数据!\ } private void AddError(Dictionary if (errors.ContainsKey(column)) return; errors[column] = errorText; } #endregion #region 刷新表编号路径(纠错) protected void ASPxCallback1_Callback(object sender, EventArgs e) { XXXX系统V1.0 26 GG.PubCommonData.BuildDNCJJG_DBLJ_ALL(DataQuery.QueryDataType.DNCJJG); } #endregion #region 查询 protected void btnChaXun_Click(object sender, EventArgs e) { InitBase(); if (txtBBH.Text.Trim() != \ OpenDataTable(string.Format(\ else if (txtBBH.Text.Trim() == \ OpenDataTable(string.Format(\txtTXDZ.Text.Trim())); else if (txtBBH.Text.Trim() != \ OpenDataTable(string.Format(\txtBBH.Text.Trim(), txtTXDZ.Text.Trim())); else { if (_dt != null) _dt.Rows.Clear(); GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ return; } Session[\ //绑定 Gridview 数据 GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ if (_dt.Rows.Count > 0) { txtBBH.Text = txtTXDZ.Text = \ } } #endregion #region ASPxTreeList选中事件 protected void ASPxTreeList1_FocusedNodeChanged(object sender, EventArgs e) { if (ASPxTreeList1.FocusedNode != null) { TreeListNode node = this.ASPxTreeList1.FocusedNode; string key = node.Key.ToString(); string str = key.Substring(0, 1); if (str == \选中的是网关 绑定数据 { ViewState[\ InitBase(); this.OpenDataTable(\ Session[\ //绑定 Gridview 数据 GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } else { XXXX系统V1.0 27 if (_dt != null) _dt.Rows.Clear(); GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } } } #endregion #region 重写更新函数UpdateData protected override int UpdateData() { int row2 = 0; if (_dt != null && strSql.Length > 0) { row2 = DbOpt.Update(_dt, strSql); Session[\ } return row2; } #endregion #region 设置默认值 protected void ASPxGridView1_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { string field_lx_xx = \网关 field_lx_xx += \用电类型 field_lx_xx += \用电性质 field_lx_xx += \否\异常控制 field_lx_xx += \状态 field_lx_xx += \多费率 field_lx_xx += \计算电量 field_lx_xx += \倍率 field_lx_xx += \初始电量 PubCommonControl.SetDefaultValue(field_lx_xx, e.Editor, e.Column.FieldName); return; } #endregion } } using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Empiresoft.Data.DB; XXXX系统V1.0 28 using DevExpress.Web.ASPxTreeList; using DevExpress.Web.ASPxGridView; using System.Text; using System.Text.RegularExpressions; using JNJGPT.GG; using System.Data.SqlClient; using System.Drawing; using DevExpress.Web.ASPxGridView.Export; using System.Collections.Generic; using DevExpress.Web.ASPxEditors; namespace JNJGPT.DNCJJG { public partial class B_DBGL : GG.Form.Form3 { #region 页面加载 protected new void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //根据分辨率设置ASPxSplitter的高度 GG.PubCommonWebHelper.SetASPxH(ASPxSplitter1, 444); //加载网关树 如果建筑下没网关 树不显示 InitTreeList(); //获取 TreeList 数据 ViewState[\ GG.PubCommonWebHelper.GetJZWG(\ //根据分辨率设置GridView的高度 GG.PubCommonWebHelper.SetGridViewH(ASPxGridView1, 344); //初始 Gridview 结构 DBInfoGridview(); } //绑定 TreeList 数据 GG.PubCommonControl.BASPxTreeList(this.ASPxTreeList1, (DataTable)ViewState[\ //设置 TreeList 图标 ASPxTreeList1.Templates.DataCell = new WHTreeLable(1); if (Session[\ { InitBase(); _dt = (DataTable)Session[\ GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } else { InitBase(); this.OpenDataTable(\ GG.PubCommonControl.BASPxGridView(ASPxGridView1, _dt, \ } } #endregion #region 初始Sql语句 protected override void InitBase() XXXX系统V1.0 29 { strSql = \ } #endregion #region 初始化区域树形结构 private void InitTreeList() { this.ASPxTreeList1.Columns.Clear(); this.ASPxTreeList1.Settings.ShowColumnHeaders = false; //建筑名称 GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \建筑名称\ HorizontalAlign.Center, HorizontalAlign.Left, true); GG.PubCommonControl.AddTreeListDataColumn(ASPxTreeList1, \建筑编码\ HorizontalAlign.Center, HorizontalAlign.Left, false); } #endregion #region 初始化电表信息数据 private void DBInfoGridview() { #region 动态列 //电表编号 GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \编 号\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); //电表名称 GridViewDataColumn dbmc = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表名称\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); dbmc.EditFormSettings.VisibleIndex = 0; //所属网关 GridViewDataComboBoxColumn WGMC = GG.PubCommonControl.AddComboColumn2GridView(ASPxGridView1, \ DbOpt.Execute_Query(\\所属网关\ WGMC.Visible = false; WGMC.EditFormSettings.VisibleIndex = 9; //多费率 GridViewDataCheckColumn DFL = GG.PubCommonControl.AddCheckColumn2GridView(ASPxGridView1, \多费率\DevExpress.Web.ASPxClasses.DefaultBoolean.True); DFL.EditFormSettings.VisibleIndex = 2; DFL.PropertiesCheckEdit.ValueUncheckedString = \ //电表生产厂家 GridViewDataColumn SCCJ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \生产厂家\11, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); SCCJ.EditFormSettings.VisibleIndex = 18; //倍率 GridViewDataColumn BL = XXXX系统V1.0 30 GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \倍 率\8, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, true); BL.EditFormSettings.VisibleIndex = 8; //电表型号 GridViewDataColumn dbxh = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表型号\5, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dbxh.EditFormSettings.VisibleIndex = 21; //用电类型 GridViewDataComboBoxColumn YDLX = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \用电类型\ YDLX.EditFormSettings.VisibleIndex = 7; //平电价 GridViewDataColumn pdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \平 电 价\7, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); pdj.EditFormSettings.VisibleIndex = 11; //用电性质 GridViewDataComboBoxColumn YDXZ = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \用电性质\ YDXZ.EditFormSettings.VisibleIndex = 10; //尖电价 GridViewDataColumn jdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \尖 电 价\10, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); jdj.EditFormSettings.VisibleIndex = 14; //电表地址 GridViewDataColumn dbdz = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \安装地址\ HorizontalAlign.Center, HorizontalAlign.Left, 0, true); dbdz.EditFormSettings.VisibleIndex = 15; //初始电量 GridViewDataColumn csdl = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \初始电量\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); csdl.EditFormSettings.VisibleIndex = 19; //峰电价 GridViewDataColumn fdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \峰 电 价\13, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); fdj.EditFormSettings.VisibleIndex = 17; //电表编号路径 GridViewDataColumn BBHLJ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表编 XXXX系统V1.0 31 号路径\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); ////建筑编码 //GridViewDataColumn JZBM = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \建筑编码\ // HorizontalAlign.Center, HorizontalAlign.Left, 0, false); //用电人数 GridViewDataColumn YDRS = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \用电人数\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); YDRS.EditFormSettings.VisibleIndex = 16; //谷电价 GridViewDataColumn gdj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \谷 电 价\16, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); gdj.EditFormSettings.VisibleIndex = 20; //电表通讯地址 GridViewDataColumn TXDZ = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表通讯地址\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); TXDZ.EditFormSettings.VisibleIndex = 12; //固定电话 GridViewDataColumn dh = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \固定电话\18, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dh.EditFormSettings.VisibleIndex = 28; //异常控制 GridViewDataComboBoxColumn YCKZ = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \异常控制\ YCKZ.CellStyle.HorizontalAlign = HorizontalAlign.Center; YCKZ.EditFormSettings.VisibleIndex = 23; //负责人 GridViewDataColumn fzr = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \负 责 人\20, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); fzr.EditFormSettings.VisibleIndex = 22; //手机 GridViewDataColumn sj = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \手机号码\21, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); sj.EditFormSettings.VisibleIndex = 25; //异常预警电量 GridViewDataColumn yjdl = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \异常预警电量\ XXXX系统V1.0 32 HorizontalAlign.Center, HorizontalAlign.Left, 0, false); yjdl.EditFormSettings.VisibleIndex = 26; //状态 GridViewDataComboBoxColumn ZT = GG.PubCommonControl.AddComboColumn2GridView(this.ASPxGridView1, \电表状态\ ZT.CellStyle.HorizontalAlign = HorizontalAlign.Center; ZT.EditFormSettings.VisibleIndex = 13; //备注 GridViewDataColumn bz = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \备 注\24, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); bz.EditFormSettings.VisibleIndex = 30; bz.EditFormSettings.ColumnSpan = 2; //计算电量 GridViewDataCheckColumn JSDL = GG.PubCommonControl.AddCheckColumn2GridView(ASPxGridView1, \计算电量\27, DevExpress.Web.ASPxClasses.DefaultBoolean.True); JSDL.Visible = false; JSDL.EditFormSettings.VisibleIndex = 5; //电表全称 GridViewDataColumn dbqc = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表全称\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); dbqc.EditFormSettings.VisibleIndex = 29; dbqc.EditFormSettings.ColumnSpan = 2; //电表序号 GridViewDataColumn BXH = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \电表序号\28, DevExpress.Web.ASPxClasses.DefaultBoolean.True, HorizontalAlign.Center, HorizontalAlign.Left, 0, false); BXH.EditFormSettings.VisibleIndex = 3; //换表末电量 GridViewDataColumn HBMDL = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \换表末电量\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); HBMDL.EditFormSettings.VisibleIndex = 24; //换表倍率 GridViewDataColumn HBBL = GG.PubCommonControl.AddDataColumn2GridView(this.ASPxGridView1, \换表倍率\ HorizontalAlign.Center, HorizontalAlign.Left, 0, false); HBBL.EditFormSettings.VisibleIndex = 27; //增 删 改 GG.PubCommonControl.AddCmdColumn2GridView(this.ASPxGridView1, true, true, true, 0); #endregion ASPxGridView1.SettingsEditing.EditFormColumnCount = 3;//编辑时显示的列数 GG.PubCommonWebHelper.SetWHGridViewTS(ASPxGridView1, 13);//分页时 XXXX系统V1.0 33 单页显示行数 } #endregion #region 获取建筑全称 protected void cbkJZQC_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取建筑编码 protected void cbkJZBM_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取部门编码 protected void cbkBMBM_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 获取父表编号 protected void cbkFBBH_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[\ } #endregion #region 增 删 改 #region 新增 protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { this.ASPxGridView_RowInserting(this.ASPxGridView1, e, false); } protected override bool ASPxGridView_RowInserting_User(ASPxGridView ASPxGridView1, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { DataRow dr = _dt.NewRow(); dr[\DNCJJG..B_DBXX\ dr[\ dr[\ dr[\ if (Session[\ { dr[\ Session[\ XXXX系统V1.0 34 } else throw new Exception(\获取父表名称失败,请重新选择!\ if (Convert.ToInt16(dr[\ dr[\没有父级表 表编号路径等于他本身 else { //有父级表 表编号路径等于上级表编号路径加','加上本身表编号 string SJBM = DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where BBH=\ dr[\ } dr[\ dr[\ dr[\ dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ dr[\ if (Session[\ { dr[\ Session[\ } else throw new Exception(\获取所属建筑失败,请重新选择!\ if (Session[\ { dr[\ Session[\ } else throw new Exception(\获取所属部门失败,请重新选择!\ if (e.NewValues[\ dr[\ XXXX系统V1.0 35 else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ { if (Session[\ dr[\e.NewValues[\ else dr[\ } else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ if (e.NewValues[\ dr[\ else dr[\ _dt.Rows.Add(dr); return true; } catch (Exception) { throw; return false; } } XXXX系统V1.0 36 #endregion #region 删除 protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { this.ASPxGridView_RowDeleting(ASPxGridView1, e, false); } protected override bool ASPxGridView_RowDeleting_User(ASPxGridView ASPxGridView1, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string BBH = e.Keys[0].ToString(); int result = Convert.ToInt16(DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where FBBH='\ if (result > 0) { throw new Exception(\所选电表下还有子级表,请先删除子级电表再删本电表!\ return false; } else { DataRow[] dr = _dt.Select(\ if (dr.Length > 0) { dr[0].Delete(); } return true; } } #endregion #region 修改 protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { this.ASPxGridView_RowUpdating(this.ASPxGridView1, e, false); } protected override bool ASPxGridView_RowUpdating_User(ASPxGridView ASPxGridView1, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { DataRow[] dr = _dt.Select(\ if (dr.Length > 0) { dr[0][\ dr[0][\ dr[0][\ if (Session[\ { dr[0][\ Session[\ if (Convert.ToInt16(dr[0][\ dr[0][\没有父级表 表编号路径等于他本身编号 else XXXX系统V1.0 37 { //改变了父级表 更改表编号路径 string SJBM = DbOpt.ExecuteScalar(\DNCJJG..B_DBXX where BBH=\ dr[0][\ //修改本表的下级表 GG.PubCommonData.BuildDNCJJG_DBLJ(DataQuery.QueryDataType.DNCJJG, SJBM, Convert.ToInt16(e.Keys[0]), dr[0][\ } } dr[0][\ dr[0][\ dr[0][\ dr[0][\ dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ dr[0][\ XXXX系统V1.0 38 if (e.NewValues[\ dr[0][\ else dr[0][\ dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ //改变了所属建筑 更改电表全称 if (Session[\ Session[\ { //但没有更新电表全称 if (e.NewValues[\e.OldValues[\ { //更改电表全称 dr[0][\e.NewValues[\ } else dr[0][\自行更改了 等于更改值 } else dr[0][\ dr[0][\ if (Session[\ { dr[0][\ Session[\ } dr[0][\ if (Session[\ { dr[0][\ Session[\ } if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ if (e.NewValues[\ dr[0][\ else dr[0][\ } return true; } #endregion #endregion #region ASPxGridView验证 XXXX系统V1.0 39 protected void ASPxGridView1_ParseValue(object sender, DevExpress.Web.Data.ASPxParseValueEventArgs e) { if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\电表通讯地址不能为空且只能为数字!请重新填写.\ else if (e.Value.ToString().Trim().Length > 12) throw new Exception(\电表通讯地址应为12位以内数字组成!\ } if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\倍率不能为空且只能为数字!请重新填写.\ } if (e.FieldName.Equals(\ { if (e.Value == null || !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\平电价不能为空且只能为数字!\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\尖电价只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\峰电价只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ { throw new Exception(\谷电价只能为数字!请重新填写.\ } } if (e.FieldName.Equals(\ { if (e.Value != null && !(Regex.IsMatch(e.Value.ToString(), @\ throw new Exception(\初始电量只能为数字!请重新填写.\
正在阅读:
3源代码-XX系统V1.006-29
名词解释 文学理论03-20
互联网金融相关法律法规存在问题及完善方案05-24
Adaptive Digital Predistortion Linearizer for Power Amplifie04-13
八年级上学期语文教学反思05-25
读书的故事作文450字07-08
鲜花的启示作文500字06-16
跳槽自我介绍02-24
清华-第9章 习题答案07-04
风靡全国的冲冲冲(随笔)11-20
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 源代码
- 系统
- 1.0
- XX
- 拔牙手术同意书 - 图文
- 北京2016年医疗卫生事业单位:医学基础知识模拟试题
- 陕西铁路客运需求分析
- 绞车实操考核评分表
- 2017年中国大数据市场供需预测及投资前景评估(目录)
- 注册消防工程师考试题库01
- 《出纳会计实务》复习题
- 江苏省南京市、盐城市2017届高三第一次模拟考试 化学
- 苏人版八年级上册道德与法治背诵资料
- 2019年教师竞聘上岗演讲稿范文-范文汇编
- 基于SDN的最短路径算法(dijkstra)实现
- 初中英语语法综合练习题(有答案)
- 垃圾分类诗歌
- 南海中学
- 培训心得:组工干部应当做好“三种人”
- 关于会议接待想法
- 六年级数学下册一圆柱和圆锥4圆柱和圆锥整理与复习北京版
- 2014年年度工作总结
- 井下火药库的优化设计(论文)
- 高中政治经济、政治、哲学分析的基本思路