using Dao; using Model; using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.Profile; using System.Web.SessionState; public partial class _GwSpUpdate : PageBase, IRequiresSessionState { protected List ApList; protected List OpList; protected List GwProductList; private int _userId = -1; private string _userType = ""; private string _account = ""; public GwSp GwSp { get; protected set; } public string SpID { get { return this.AppContext.GetString("spid"); } } public string ActionTitle { get { return !string.IsNullOrEmpty(this.SpID) ? "编辑账户" : "创建新账户"; } } public IEnumerable DiverterList { get; set; } protected void Page_Load(object sender, EventArgs e) { _userId = this.AppContext.SessionObject.UserID; _userType = this.AppContext.SessionObject.UserType; _account = this.AppContext.SessionObject.Account; using (GwApDao gwApDao = new GwApDao()) this.ApList = gwApDao.LoadInfoList(); using (GwOpDao gwOpDao = new GwOpDao()) this.OpList = gwOpDao.LoadInfoList(); using (GwDiverterDao gwDiverterDao = new GwDiverterDao()) this.DiverterList = (IEnumerable)gwDiverterDao.LoadList(); using (GwSpDao gwSpDao = new GwSpDao()) { if (!string.IsNullOrEmpty(this.SpID)) { this.GwSp = gwSpDao.Get(this.SpID); int combinationMode = this.GwSp.CombinationMode; } else { this.GwSp = new GwSp(); this.GwSp.Price = 40; this.GwSp.FeeLongLength = 67; this.GwSp.FeeShortLength = 70; this.GwSp.MaxConnCount = 1; this.GwSp.Threshold = 30; this.GwSp.MCPM = 10; this.GwSp.McExpression = "0;0;0;10;20;40;80;240;480"; this.GwSp.Status = 1; this.GwSp.BlackMode = 1; this.GwSp.DiverterID = 0; this.GwSp.Password = "123456"; this.GwSp.AccessCode = gwSpDao.GetNextAccessCode(); this.GwSp.ClientIp = "0.0.0.0"; this.GwSp.ForceSignFlag = 0; this.GwSp.ForceSign = ""; this.GwSp.AccessCodeMode = 0; this.GwSp.ExtnoExtensionMode = 0; this.GwSp.CombinationMode = 0; this.GwSp.SubPackageNum = 4000; this.GwSp.SingleSubmitMinRestrict = 0; this.GwSp.IsDispalyPrice = 0; this.GwSp.DeductionMode = 1; this.GwSp.IsSendAudit = 0; this.GwSp.BelowNumAudit = 0; this.GwSp.AboveNumAudit = 0; this.GwSp.IsCumulativeAudit = 0; this.GwSp.CumulativeAuditNum = 0; this.GwSp.CumulativeAuditTime = 0; this.GwSp.IsSyncChildSendAudit = 0; } } //获取启用的产品分类 using (GwProductDao gwProductDao = new GwProductDao()) { GwProduct bean = new GwProduct(); bean.Classes = 1; bean.IsDefault = -1; bean.IsEnable = -1; this.GwProductList = gwProductDao.getAllList(bean); } } public string McCount(int i, string mcExpression) { string str = ""; if (!string.IsNullOrEmpty(mcExpression)) str = mcExpression.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries)[i]; return str; } public string GetDiverterOptions(int diverterID) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat(""); foreach (GwDiverter gwDiverter in this.DiverterList) stringBuilder.AppendFormat("", (object)gwDiverter.DiverterID, (object)gwDiverter.DiverterName, gwDiverter.DiverterID == diverterID ? (object)"selected" : (object)""); return stringBuilder.ToString(); } /// /// 获取通道组 /// /// /// public string GetOpGroupOptions(int groupID) { StringBuilder stringBuilder = new StringBuilder(); using (GwOpGroupDao gwOpGroupDao = new GwOpGroupDao()) { List groupList = gwOpGroupDao.GetGroupList(); stringBuilder.AppendFormat(""); foreach (GwOpGroup gwOpGroup in groupList) stringBuilder.AppendFormat("", (object)gwOpGroup.GroupID, (object)gwOpGroup.GroupName, gwOpGroup.GroupID == groupID ? (object)"selected" : (object)""); } return stringBuilder.ToString(); } public string GetAPOptions(int apId) { string str = ""; if (this.ApList.Count == 0) return ""; foreach (GwAp gwAp in this.ApList) str = apId != gwAp.ApID ? str + string.Format("", (object)gwAp.ApID, (object)gwAp.ApName) : str + string.Format("", (object)gwAp.ApID, (object)gwAp.ApName); return str; } //获取通道信息 public string GetOpOptions(int opId) { StringBuilder stringBuilder = new StringBuilder(); if (this.OpList.Count == 0) return ""; stringBuilder.AppendFormat("", (object)0, (object)"NA"); foreach (GwOp gwOp in this.OpList) { //停用的通道不再显示 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 GetStrategyOptions(int strategyID) { GwStrategyDao gwStrategyDao = new GwStrategyDao(); string str = ""; int recordcount = 0; List list = gwStrategyDao.LoadInfoList("", "", out recordcount, 9999, 1); if (recordcount == 0) return ""; foreach (GwStrategy gwStrategy in list) { if (strategyID == gwStrategy.StrategyId) str = str + (object)""; else str = str + (object)""; } return str; } public string GetClientOptions(string clientId) { using (GwClientDao gwClientDao = new GwClientDao()) { string permissionsSQL = gwClientDao.GetClientPermissions(_userId, _userType, null); string str = ""; List list = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL); if (list.Count == 0) { str += string.Format(""); } else { foreach (GwClient gwClient in list) str = !(clientId == gwClient.ClientID) ? str + string.Format("", (object)gwClient.ClientID, (object)gwClient.ClientID) : str + string.Format("", (object)gwClient.ClientID, (object)gwClient.ClientID); } return str; } } public string GetGwspCtpattern(string spid) { using (GwSpDao gwSpDao = new GwSpDao()) { SpCTPatternInfo pattern = gwSpDao.GetPattern(spid); string str = ""; if (pattern != null) str = pattern.Pattern; return str; } } //获取报备的内容 public int GetGwspEnabled(string spid) { using (GwSpDao gwSpDao = new GwSpDao()) { SpCTPatternInfo pattern = gwSpDao.GetPattern(spid); int num = 0; if (pattern != null) num = pattern.Enabled; return num; } } //获取产品信息 public string GetProductOptions(string productId) { if (productId==null) return ""; StringBuilder stringBuilder = new StringBuilder(); if (this.GwProductList.Count == 0) return ""; stringBuilder.AppendFormat("", (object)"", (object)"无"); foreach (GwProduct bean in this.GwProductList) { //停用的产品分类不再显示 if (bean.IsEnable == 0) { continue; } //类别为产品不再显示 if (bean.Classes == 0) { continue; } if (productId.Equals(bean.Id)) stringBuilder.AppendFormat("", (object)bean.Id, (object)bean.Name); else stringBuilder.AppendFormat("", (object)bean.Id, (object)bean.Name); } return stringBuilder.ToString(); } }