using Common; using Dao; using Model; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.Profile; using System.Web.SessionState; public partial class GwDiverterUpdate : PageBase, IRequiresSessionState { private string _action = ""; public GwDiverter Diverter { get; set; } public string DataDiverterItem { get; set; } public string Action { get { return this._action; } set { this._action = value; } } protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack) return; this.Action = this.Request["action"]; if (this.Action == null) return; if (this.Action == "edit") { this.CheckRight("1062", FailedOperation.HistoryGoBack); using (GwDiverterDao gwDiverterDao = new GwDiverterDao()) { string diverterID = this.Request["DiverterID"]; this.Diverter = gwDiverterDao.GetEntity(diverterID); this.DataDiverterItem = this.Diverter.Content; List list1 = gwDiverterDao.LoadItemList(diverterID); List list2 = new List(); if (list1 == null || list1.Count == 0) return; foreach (GwDiverterItem gwDiverterItem1 in list1) { GwDiverterItem gwDiverterItem2 = new GwDiverterItem() { Mode = gwDiverterItem1.Mode, Keywords = gwDiverterItem1.Keywords, SmMaxLength = gwDiverterItem1.SmMaxLength, Segments = gwDiverterItem1.Segments, ExtNoMode = gwDiverterItem1.ExtNoMode, Province = JsonConvert.SerializeObject((object)gwDiverterItem1.Province.Split(',')), CMOPID = gwDiverterItem1.CMOPID, CUOPID = gwDiverterItem1.CUOPID, CTOPID = gwDiverterItem1.CTOPID, CMExtNo = gwDiverterItem1.CMExtNo, CUExtNo = gwDiverterItem1.CUExtNo, CTExtNo = gwDiverterItem1.CTExtNo, CMExtParams = gwDiverterItem1.CMExtParams, CTExtParams = gwDiverterItem1.CTExtParams, CUExtParams = gwDiverterItem1.CUExtParams }; list2.Add(gwDiverterItem2); } string str = JsonConvert.SerializeObject((object)list2); if (string.IsNullOrEmpty(str)) return; this.DataDiverterItem = str; } } else { this.Diverter = new GwDiverter(); this.CheckRight("106", FailedOperation.HistoryGoBack); } } public string GetOpOptions(int opId) { using (GwOpDao gwOpDao = new GwOpDao()) { List list = gwOpDao.LoadInfoList(); StringBuilder stringBuilder = new StringBuilder(); if (list.Count == 0) return ""; stringBuilder.AppendFormat("", (object)0, (object)"NA"); foreach (GwOp gwOp in list) { if (gwOp.OpStatus == 0) { continue; } if (opId == gwOp.OpID) stringBuilder.AppendFormat("", (object)gwOp.OpID, (object)gwOp.OpName); else stringBuilder.AppendFormat("", (object)gwOp.OpID, (object)gwOp.OpName); } return stringBuilder.ToString(); } } public string GwtPrivnce() { using (GwMobileAreaDao gwMobileAreaDao = new GwMobileAreaDao()) { List mobilAreaList = gwMobileAreaDao.GetMobilAreaList(); StringBuilder stringBuilder = new StringBuilder(); if (mobilAreaList.Count == 0) return "无地区信息请查看省份号段"; int num = 0; foreach (Model.GwMobileArea gwMobileArea in mobilAreaList) { stringBuilder.AppendFormat("{0}", (object)gwMobileArea.Province); if (num == 9 || num == 19) stringBuilder.AppendFormat("
"); ++num; } return stringBuilder.ToString(); } } }