using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SuperMap.RealEstate.CoreFrameWork; using SuperMap.RealEstate.ServiceModel; using SuperMap.RealEstate.Utility; using SuperMap.RealEstate.Web.UI; using SuperMap.RealEstate.Web.UI.WebControls; using SuperMap.RealEstate.Web.Utility; using MSB = SuperMap.RealEstate.MainTenance.Storage.Business; using System.Data; namespace SuperMap.RealEstate.MainTenance.Storage.Modules.Equipment { public partial class Equipment : UserControl { #region 加载事件 protected void Page_Load(object sender, EventArgs e) { } #endregion //在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等 public override void InitializeWebControl() { } #region 载入数据 public override bool LoadData() { //如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码 if (!String.IsNullOrEmpty(Request["ID"])) { CurrObject.EQUIPMENT_ID_Encrypt = Request["ID"]; return this.Select(); } //默认返回值,工作流组件返回True,功能模块返回False。 return (WorkFlowPage != null); } #endregion //OnDataAction_XXXXX 有一个系列可用,在此加入界面的逻辑处理 //e.CancelDataAction 来处理是否取消该动作; //失败的原因可以用Page.Alert()传递到页面 public override void OnDataAction_BeforeSave(DataActionEventArgs e) { base.OnDataAction_BeforeSave(e); } #region 编号自动生成 public void GetNumber() { if (EQUIPMENT_CODE.Text == "") { //查询最大编号,并加一 MSB.EQUIPMENT _EQUIPMENT = new MSB.EQUIPMENT(Transaction); DataTable dt = _EQUIPMENT.ExecuteDataTable( @"SELECT EQUIPMENT_CODE FROM MAINTENANCE_STORAGE.T_EQUIPMENT ORDER BY EQUIPMENT_CODE DESC"); if (dt.Rows.Count > 0) { int id = int.Parse(dt.Rows[0][0].ToString()); string ids = "0000000"; if (id < 10) { ids += id + 1; } else if (id == 10) { ids = "00000010"; } else if (id > 10) { ids = "000000"; ids += id + 1; } else if (id == 100) { ids = "00000100"; } else if (id > 100) { ids = "00000"; ids += id + 1; } EQUIPMENT_CODE.Text = ids.ToString(); } else { EQUIPMENT_CODE.Text = "00000001"; } } } #endregion } }