|
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<SysUser>, IRequiresSessionState
|
{
|
protected List<GwAp> ApList;
|
protected List<GwOp> OpList;
|
protected List<GwProduct> GwProductList;
|
|
private int _userId = -1;
|
private int _userType = -1;
|
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<GwDiverter> 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<GwDiverter>)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("<option value='0'>不设置导流策略</option>");
|
foreach (GwDiverter gwDiverter in this.DiverterList)
|
stringBuilder.AppendFormat("<option value='{0}' {2}>{1}</option>", (object)gwDiverter.DiverterID, (object)gwDiverter.DiverterName, gwDiverter.DiverterID == diverterID ? (object)"selected" : (object)"");
|
return stringBuilder.ToString();
|
}
|
|
|
/// <summary>
|
/// 获取通道组
|
/// </summary>
|
/// <param name="groupID"></param>
|
/// <returns></returns>
|
public string GetOpGroupOptions(int groupID)
|
{
|
StringBuilder stringBuilder = new StringBuilder();
|
using (GwOpGroupDao gwOpGroupDao = new GwOpGroupDao())
|
{
|
List<GwOpGroup> groupList = gwOpGroupDao.GetGroupList();
|
stringBuilder.AppendFormat("<option value=\"0\">不设置</option>");
|
foreach (GwOpGroup gwOpGroup in groupList)
|
stringBuilder.AppendFormat("<option value='{0}' {2}>{1}</option>", (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 "<option value='0'>暂无AP节点信息</option>";
|
foreach (GwAp gwAp in this.ApList)
|
str = apId != gwAp.ApID ? str + string.Format("<option value=\"{0}\" >{1}</option>", (object)gwAp.ApID, (object)gwAp.ApName) : str + string.Format("<option value=\"{0}\" selected>{1}</option>", (object)gwAp.ApID, (object)gwAp.ApName);
|
return str;
|
}
|
|
|
//获取通道信息
|
public string GetOpOptions(int opId)
|
{
|
StringBuilder stringBuilder = new StringBuilder();
|
if (this.OpList.Count == 0)
|
return "<option value=''>无通道信息</option>";
|
stringBuilder.AppendFormat("<option value=\"{0}\" selected>{1}</option>", (object)0, (object)"NA");
|
foreach (GwOp gwOp in this.OpList)
|
{
|
//停用的通道不再显示
|
if (gwOp.OpStatus == 0)
|
{
|
continue;
|
}
|
|
if (opId == gwOp.OpID)
|
stringBuilder.AppendFormat("<option value=\"{0}\" selected>{0}-{1}</option>", (object)gwOp.OpID, (object)gwOp.OpName);
|
else
|
stringBuilder.AppendFormat("<option value=\"{0}\">{0}-{1}</option>", (object)gwOp.OpID, (object)gwOp.OpName);
|
}
|
return stringBuilder.ToString();
|
}
|
|
public string GetStrategyOptions(int strategyID)
|
{
|
GwStrategyDao gwStrategyDao = new GwStrategyDao();
|
string str = "";
|
int recordcount = 0;
|
List<GwStrategy> list = gwStrategyDao.LoadInfoList("", "", out recordcount, 9999, 1);
|
if (recordcount == 0)
|
return "<option value=''>暂无内容策略配置</option>";
|
foreach (GwStrategy gwStrategy in list)
|
{
|
if (strategyID == gwStrategy.StrategyId)
|
str = str + (object)"<option value=\"" + (object)gwStrategy.StrategyId + "\" selected>" + gwStrategy.StrategyName + "</option>";
|
else
|
str = str + (object)"<option value=\"" + (object)gwStrategy.StrategyId + "\">" + gwStrategy.StrategyName + "</option>";
|
}
|
return str;
|
}
|
|
public string GetClientOptions(string clientId)
|
{
|
using (GwClientDao gwClientDao = new GwClientDao())
|
{
|
string permissionsSQL = gwClientDao.GetClientPermissions(_userId, _userType, null);
|
string str = "";
|
List<GwClient> list = gwClientDao.LoadInfoList("", "", "", "", permissionsSQL);
|
if (list.Count == 0)
|
{
|
str += string.Format("<option value=\"\">尚未创建客户信息</option>");
|
}
|
else
|
{
|
foreach (GwClient gwClient in list)
|
str = !(clientId == gwClient.ClientID) ? str + string.Format("<option value=\"{0}\">{1}</option>", (object)gwClient.ClientID, (object)gwClient.Company) : str + string.Format("<option value=\"{0}\" selected>{1}</option>", (object)gwClient.ClientID, (object)gwClient.Company);
|
}
|
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 "<option value='0'>无</option>";
|
StringBuilder stringBuilder = new StringBuilder();
|
if (this.GwProductList.Count == 0)
|
return "<option value='0'>无</option>";
|
stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (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("<option value=\"{0}\" selected>{1}</option>", (object)bean.Id, (object)bean.Name);
|
else
|
stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.Id, (object)bean.Name);
|
}
|
return stringBuilder.ToString();
|
}
|
|
}
|