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.Web.UI; using SuperMap.RealEstate.Web.UI.WebControls; using Business = SuperMap.RealEstate.Personnel.Storage.Business; namespace SuperMap.RealEstate.Personnel.Modules.StaffRank { public partial class StaffRank : UserControl { protected void Page_Load(object sender, EventArgs e) { } //在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等 public override void InitializeWebControl() { if (base.Request["ID"] != null) { base.CurrObject.RANK_ID_Encrypt = base.Request["ID"]; this.BindDropDownList(base.CurrObject.KeyID); } else { this.BindDropDownList(string.Empty); } RANK_VALID.Clear(); DictionaryHelper.BindingDropDownList("isvalid", RANK_VALID.Items, this.Transaction); try { RANK_VALID.SelectedValue = "1"; } catch { } base.SetControlDefaultValue(new Control[] { this.RANK_PID, this.RANK_INDEX, this.RANK_VALID }); } //载入数据 public override bool LoadData() { //如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码 if (!String.IsNullOrEmpty(Request["ID"])) { CurrObject.RANK_ID_Encrypt = Request["ID"]; return this.Select(); } //默认返回值,工作流组件返回True,功能模块返回False。 return (WorkFlowPage != null); } public void BindDropDownList(string disbledValue, string selectValue) { this.BindDropDownList(disbledValue); this.RANK_PID.Value = selectValue; } public void BindDropDownList(string disabledValue) { this.RANK_PID.Items.Clear(); this.RANK_PID.Items.Add(new ListItemEx { Value = "-1", Text = "默认类别" }); //base.CurrObject.BindingDropDownList(this.RANK_PID.Items, disabledValue, 0, ""); foreach (Business.RANK _RANK in (new Business.RANK(Transaction).FillCollection("WHERE RANK_PID = -1"))) { ListItemEx _ListItemEx = new ListItemEx(); _ListItemEx.Text = _RANK.RANK_NAME; _ListItemEx.Value = _RANK.RANK_ID.ToString(); RANK_PID.Items.Add(_ListItemEx); } } public override void OnDataAction_BeforeSave(DataActionEventArgs e) { e.CurrObject.OPERATE_DATE = DateTime.Now; e.CurrObject.OPERATE_USER = Page.PassportInfo.Name; e.CurrObject.OPERATE_USERID = Page.PassportInfo.ID; base.OnDataAction_BeforeSave(e); } public override void OnDataAction_BeforeDelete(DataActionEventArgs e) { Business.STAFF _STAFF = new Business.STAFF(Transaction); _STAFF.AddSearchParameter("CURRENT_POSITION", CurrObject.RANK_ID); if (_STAFF.Search()) { throw new Exception("该岗位有员工,无法删除!"); } base.OnDataAction_BeforeDelete(e); } } }