<%@ WebHandler Language="C#" Class="GwProductHandler" %>
|
using Dao;
|
using Model;
|
// using Newtonsoft.Json;
|
//using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Text.RegularExpressions;
|
using System.Web;
|
using System.IO;
|
using System.Diagnostics;
|
|
public class GwProductHandler : PageHandler<SysUser>
|
{
|
private GwProductDao _Dao = new GwProductDao();
|
private GwSpDao _GwSpDao = new GwSpDao();
|
private GwOpGroupDao _GwOpGroupDao = new GwOpGroupDao();
|
private SysXhDao _SysXhDao = new SysXhDao();
|
|
private List<GwOp> _OpList;
|
private List<GwOpGroup> _GroupList;
|
private List<GwProduct> _ProductList; //产品及产品分类
|
//private List<GwProduct> _ProductClassList; //产品分类
|
|
public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context)
|
{
|
string @string = context.GetString("action");
|
switch (@string)
|
{
|
case "delete":
|
return this.Delete(context); //删除
|
case "update":
|
return this.Update(context); //修改
|
case "add":
|
return this.Add(context); //添加
|
case "list":
|
return this.List(context); //查询
|
case "get":
|
return this.Get(context); //获取记录信息
|
case "updateStatus":
|
return this.UpdateStatus(context); //启用或停用
|
case "upLoad":
|
return this.UpLoad(context); //图标文件上传
|
|
default:
|
throw new Exception("Invalid Action=" + @string);
|
}
|
}
|
|
//加载产品及产品分类信息
|
private JsonPageResult List(PageContext<SysUser> context)
|
{
|
//Console.WriteLine("List.............[" + context.GetInt("name") + "][" + context.GetInt("classes") + "]");
|
int classes = context.GetInt("classes");
|
string name = context.GetString("name");
|
|
int recordCount = 0;
|
int pageSize = context.GetInt("pageSize", 50);
|
int pageIndex = context.GetInt("pageIndex", 1);
|
|
List<GwProduct> list = _Dao.LoadInfoList(classes, name, pageSize, pageIndex, out recordCount);
|
|
string str1 = "";
|
if (list != null && list.Count > 0)
|
{
|
|
int num = 0;
|
foreach (GwProduct bean in list)
|
{
|
++num;
|
str1 = str1 + (object) "<tr><td>" + (object) bean.Icon;
|
str1 = str1 + "</td><td>" + bean.Name + "</td>";
|
str1 = string.Concat(new object[4]
|
{
|
str1,
|
"<td>",
|
bean.Instructions,
|
"</td>"
|
});
|
str1 = str1 + "<td>" + (object)this.ClassesToName(bean.Classes) + "</td>";
|
if (bean.RouterType == 1)
|
{
|
str1 += "<td rowspan=\"1\"><div class=\"btn btn-primary btn-xs\">点路由</div>";
|
str1 += string.Format("<div>移动:{0}</div><div>电信:{1}</div><div>联通:{2}</div>", (object)this.GetOpName(bean.CmOpId), (object)this.GetOpName(bean.CtOpId), (object)this.GetOpName(bean.CuOpId));
|
}
|
else if (bean.RouterType == 3)
|
{
|
str1 += "<td rowspan=\"1\"><div class=\"btn btn-success btn-xs\">组路由</div>";
|
str1 += string.Format("<div>移动:{0}</div><div>电信:{1}</div><div>联通:{2}</div>", (object)this.GetGroupName(bean.CmGroupid), (object)this.GetGroupName(bean.CtGroupid), (object)this.GetGroupName(bean.CuGroupid));
|
}
|
else
|
{
|
str1 += "<td rowspan=\"1\"></td>";
|
}
|
str1 = str1 + "<td>" + ProductToName(bean.ParentId) + "</td>";
|
str1 = str1 + "<td>" + IsDefaultToName(bean.IsDefault) + "</td>";
|
str1 = str1 + "<td>" + IsEnableToName(bean.IsEnable) + "</td>";
|
str1 = string.Concat(new object[4]
|
{
|
str1,
|
"<td>",
|
bean.Sort,
|
"</td>"
|
});
|
str1 = string.Concat(new object[4]
|
{
|
str1,
|
"<td>",
|
bean.GivingNum, //默认赠送条数
|
"</td>"
|
});
|
|
str1 += string.Format("<td>{0}元/条</td>", (object)(Convert.ToDecimal(bean.Price) / new Decimal(1000)));
|
str1 = str1 + "<td>" + bean.CreateTime + "</td>";
|
str1 += "<td class=\"text-right\">";
|
str1 = bean.IsEnable != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"0\" class=\"action-update-status btn btn-primary btn-xs\"><i class=\"fa fa-toggle-off\"></i> 停用</a> ", (object) bean.Id ) : str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-is_enable=\"1\" class=\"action-update-status btn btn-default btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 启用</a> ", (object) bean.Id );
|
str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-success btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object) bean.Id);
|
str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-delete btn btn-default btn-xs\"><i class=\"fa fa-trash\"></i> 删除</a> ", (object) bean.Id);
|
str1 += "</td>";
|
str1 += "</tr>";
|
}
|
}
|
else
|
str1 += "<tr><td colspan=\"13\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>";
|
|
return new JsonPageResult(true, new
|
{
|
Table = str1.ToString(),
|
TotalCount = recordCount
|
});
|
}
|
|
//通道运行状态或错误信息
|
private string FormatOpError(int opStatus, int opError, string remark)
|
{
|
StringBuilder stringBuilder = new StringBuilder();
|
if (opStatus == 0)
|
{
|
stringBuilder.Append("<span class=\"label label-default\">已停用</span>");
|
}
|
else
|
{
|
stringBuilder.Append("<a data-html=\"true\" data-content=\"<pre style='width:200px;height:160px;'>" + HttpUtility.HtmlEncode(remark) + "</pre>\" type=\"button\" class=\"btn-xs\" data-trigger=\"click\" data-toggle=\"popover\" data-placement=\"left\">");
|
if (opError == 0)
|
stringBuilder.Append("<span class=\"label label-primary\">正常</span>");
|
else if (opError == 5)
|
stringBuilder.Append("<span class=\"label label-danger\">异常</span>");
|
else
|
stringBuilder.Append("NA");
|
stringBuilder.Append("</a>");
|
}
|
return stringBuilder.ToString();
|
}
|
|
public bool IsInt(string input)
|
{
|
for (int index = 0; index < input.Length; ++index)
|
{
|
if (!char.IsNumber(input, index))
|
return false;
|
}
|
return true;
|
}
|
|
|
//删除产品或产品分类
|
private JsonPageResult Delete(PageContext<SysUser> context)
|
{
|
string ID = context.GetString("id");
|
|
if (this._Dao.GwProductUseCount(ID) > 0)
|
throw new ArgumentException("当前产品分类已在产品信息使用中,无法删除!");
|
if (this._Dao.GwSpUseCount(ID) > 0)
|
throw new ArgumentException("当前产品在客户账号信息中使用,无法删除!");
|
this._Dao.Delete(ID);
|
return new JsonPageResult(true, "删除信息成功!");
|
|
}
|
|
//添加产品或产品分类
|
private JsonPageResult Add(PageContext<SysUser> context)
|
{
|
|
string id = _SysXhDao.getXh("GW_PRODUCT"); //获取生成产品ID
|
string name = context.GetString("name");
|
int classes = context.GetInt("classes", -1);
|
string icon = "";
|
string instructions = "";
|
int isDefault = 0;
|
int sort = 0;
|
|
int routerType = 0;
|
int cmOpId = 0;
|
int cuOpId = 0;
|
int ctOpId = 0;
|
string cmExtParams = "";
|
string cuExtParams = "";
|
string ctExtParams = "";
|
int cmGroupid = 0;
|
int cuGroupid = 0;
|
int ctGroupid = 0;
|
int price = 0;
|
int givingNum = 0;
|
|
string info = "" ;
|
if (classes == -1) {
|
throw new ArgumentException("请选择类别!");
|
}
|
else
|
{
|
if(classes == 1)
|
{
|
info = "产品";
|
if (string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException(info + "名称不能为空!");
|
}
|
|
}
|
else if (classes == 0)
|
{
|
info = "产品分类";
|
if (string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException(info + "名称不能为空!");
|
}
|
|
}
|
|
}
|
|
//1-产品;0-分类
|
if (classes==1)
|
{
|
icon = context.GetString("icon");
|
instructions = context.GetString("instructions");
|
isDefault = context.GetInt("isDefault", 0);
|
|
int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1);
|
price = num;
|
givingNum = context.GetInt("givingNum", 0);
|
sort = context.GetInt("sort", 0);
|
|
routerType = context.GetInt("routerType", 1);
|
//路由类型:1-通道路由;3-通道组路由。
|
if (routerType==1)
|
{
|
cmOpId = context.GetInt("cmOpId", 0);
|
cuOpId = context.GetInt("cuOpId", 0);
|
ctOpId = context.GetInt("ctOpId", 0);
|
cmExtParams = context.GetString("cmExtParams");
|
cuExtParams = context.GetString("cuExtParams");
|
ctExtParams = context.GetString("ctExtParams");
|
|
}
|
else if (routerType==3)
|
{
|
cmGroupid = context.GetInt("cmGroupid", 0);
|
cuGroupid = context.GetInt("cuGroupid", 0);
|
ctGroupid = context.GetInt("ctGroupid", 0);
|
|
}
|
|
}
|
string parentId = context.GetString("parentId", "0");
|
string path = "";
|
if (parentId.Equals("0"))
|
{
|
path = "0";
|
}
|
else
|
{
|
GwProduct newProduct = _Dao.Get(parentId);
|
if(newProduct!=null)
|
{
|
path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ;
|
}
|
else
|
{
|
path = "0";
|
}
|
|
}
|
int isEnable = context.GetInt("isEnable", 0);
|
|
//int price = context.GetInt("price", 0);
|
//int givingNum = context.GetInt("givingNum", 0);
|
string remark = context.GetString("remark", "");
|
DateTime createTime = DateTime.Now;
|
string creator = context.OperatorID;
|
//DateTime update_time = context.GetDateTime("update_time");
|
//string updateor = context.GetString("updateor", "");
|
|
//校验
|
if (classes == -1) {
|
throw new ArgumentException("请选择类别!");
|
}
|
else
|
{
|
if(string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException("请输入名称!");
|
}
|
//产品相关项校验
|
if (classes == 1)
|
{
|
if (routerType==0 )
|
throw new ArgumentException("请选择路由类型!");
|
if (cmGroupid == 0 && cuGroupid == 0 && ctGroupid == 0 && routerType == 3 && classes==1)
|
throw new ArgumentException("至少指定一个通道组!");
|
if (cmOpId == 0 && cuOpId == 0 && ctOpId == 0 && routerType == 1 && classes==1)
|
throw new ArgumentException("至少指定一个通道!");
|
if (!string.IsNullOrEmpty(context.GetString("sort")) && !Regex.IsMatch(context.GetString("sort"), "^[0-9]*$"))
|
throw new Exception("序号必须为数字");
|
if (!string.IsNullOrEmpty(context.GetString("price")) && !Regex.IsMatch(context.GetString("price"), "^[0-9]*$") && price<=0 )
|
throw new Exception("参考单价不能小于等于0");
|
if (!string.IsNullOrEmpty(context.GetString("givingNum")) && !Regex.IsMatch(context.GetString("givingNum"), "^[0-9]*$"))
|
throw new Exception("默认赠送条数必须为整数");
|
}
|
//产品相关项校验
|
else if (classes == 0)
|
{
|
|
}
|
|
}
|
|
this._Dao.Add(new GwProduct()
|
{
|
Id = id,
|
Name = name,
|
Icon = icon,
|
Instructions = instructions,
|
Classes = classes,
|
ParentId = parentId,
|
Path = path,
|
IsDefault = isDefault,
|
IsEnable = isEnable,
|
Sort = sort,
|
RouterType = routerType,
|
CmOpId = cmOpId,
|
CuOpId = cuOpId,
|
CtOpId = ctOpId,
|
CmGroupid = cmGroupid,
|
CuGroupid = cuGroupid,
|
CtGroupid = ctGroupid,
|
CmExtParams = cmExtParams,
|
CuExtParams = cuExtParams,
|
CtExtParams = ctExtParams,
|
Price = price, //单价换算
|
GivingNum = givingNum,
|
Remark = remark,
|
CreateTime = createTime,
|
Creator = creator
|
//UpdateTime = update_time,
|
//Updateor = updateor
|
|
});
|
return new JsonPageResult(true, info + "信息添加成功!");
|
}
|
|
//更新产品或产品分类
|
private JsonPageResult Update(PageContext<SysUser> context)
|
{
|
string id = context.GetString("id");
|
string name = context.GetString("name");
|
int classes = context.GetInt("classes", -1);
|
string icon = "";
|
string instructions = "";
|
int isDefault = 0;
|
int sort = 0;
|
|
int routerType = 0;
|
int cmOpId = 0;
|
int cuOpId = 0;
|
int ctOpId = 0;
|
string cmExtParams = "";
|
string cuExtParams = "";
|
string ctExtParams = "";
|
int cmGroupid = 0;
|
int cuGroupid = 0;
|
int ctGroupid = 0;
|
int price = 0;
|
int givingNum = 0;
|
|
string info = "" ;
|
if (classes == -1) {
|
throw new ArgumentException("请选择类别!");
|
}
|
else
|
{
|
if(classes == 1)
|
{
|
info = "产品";
|
if (string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException(info + "名称不能为空!");
|
}
|
|
}
|
else if (classes == 0)
|
{
|
info = "产品分类";
|
if (string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException(info + "名称不能为空!");
|
}
|
|
}
|
|
}
|
|
|
//1-产品;0-分类
|
if (classes==1)
|
{
|
icon = context.GetString("icon");
|
instructions = context.GetString("instructions");
|
isDefault = context.GetInt("isDefault", 0);
|
|
int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1);
|
price = num;
|
givingNum = context.GetInt("givingNum", 0);
|
sort = context.GetInt("sort", 0);
|
|
routerType = context.GetInt("routerType", 1);
|
//路由类型:1-通道路由;3-通道组路由。
|
if (routerType==1)
|
{
|
cmOpId = context.GetInt("cmOpId", 0);
|
cuOpId = context.GetInt("cuOpId", 0);
|
ctOpId = context.GetInt("ctOpId", 0);
|
cmExtParams = context.GetString("cmExtParams");
|
cuExtParams = context.GetString("cuExtParams");
|
ctExtParams = context.GetString("ctExtParams");
|
|
}
|
else if (routerType==3)
|
{
|
cmGroupid = context.GetInt("cmGroupid", 0);
|
cuGroupid = context.GetInt("cuGroupid", 0);
|
ctGroupid = context.GetInt("ctGroupid", 0);
|
|
}
|
|
}
|
string parentId = context.GetString("parentId", "0");
|
string path = "";
|
if (parentId.Equals("0"))
|
{
|
path = "0";
|
}
|
else
|
{
|
GwProduct newProduct = _Dao.Get(parentId);
|
if(newProduct!=null)
|
{
|
path = newProduct.Path=="" ? "0" : newProduct.Path + "," + newProduct.Id ;
|
}
|
else
|
{
|
path = "0";
|
}
|
|
}
|
int isEnable = context.GetInt("isEnable", 0);
|
|
string remark = context.GetString("remark", "");
|
//DateTime createTime = context.GetDateTime("createTime");
|
//int creator = context.GetInt("creator", 0);
|
//DateTime updateTime = context.GetDateTime("updateTime");
|
DateTime updateTime = DateTime.Now;
|
string updateor = context.OperatorID;
|
|
//校验
|
if (classes == -1) {
|
throw new ArgumentException("请选择类别!");
|
}
|
else
|
{
|
if(string.IsNullOrEmpty(name))
|
{
|
throw new ArgumentException("请输入名称!");
|
}
|
//产品相关项校验
|
if (classes == 1)
|
{
|
if (routerType==0 )
|
throw new ArgumentException("请选择路由类型!");
|
if (cmGroupid == 0 && cuGroupid == 0 && ctGroupid == 0 && routerType == 3 && classes==1)
|
throw new ArgumentException("至少指定一个通道组!");
|
if (cmOpId == 0 && cuOpId == 0 && ctOpId == 0 && routerType == 1 && classes==1)
|
throw new ArgumentException("至少指定一个通道!");
|
if (!string.IsNullOrEmpty(context.GetString("sort")) && !Regex.IsMatch(context.GetString("sort"), "^[0-9]*$"))
|
throw new Exception("序号必须为数字");
|
if (!string.IsNullOrEmpty(context.GetString("price")) && !Regex.IsMatch(context.GetString("price"), "^[0-9]*$") && price<=0 )
|
throw new Exception("参考单价不能小于等于0");
|
if (!string.IsNullOrEmpty(context.GetString("givingNum")) && !Regex.IsMatch(context.GetString("givingNum"), "^[0-9]*$"))
|
throw new Exception("默认赠送条数必须为整数");
|
}
|
//产品相关项校验
|
else if (classes == 0)
|
{
|
|
}
|
|
}
|
|
this._Dao.Update(new GwProduct()
|
{
|
Id = id,
|
Name = name,
|
Icon = icon,
|
Instructions = instructions,
|
Classes = classes,
|
ParentId = parentId,
|
Path = path,
|
IsDefault = isDefault,
|
IsEnable = isEnable,
|
Sort = sort,
|
RouterType = routerType,
|
CmOpId = cmOpId,
|
CuOpId = cuOpId,
|
CtOpId = ctOpId,
|
CmGroupid = cmGroupid,
|
CuGroupid = cuGroupid,
|
CtGroupid = ctGroupid,
|
CmExtParams = cmExtParams,
|
CuExtParams = cuExtParams,
|
CtExtParams = ctExtParams,
|
Price = price, //单价换算
|
GivingNum = givingNum,
|
Remark = remark,
|
//CreateTime = createTime,
|
//Creator = creator,
|
UpdateTime = updateTime,
|
Updateor = updateor
|
|
});
|
|
//更新关联的产品路径PATH
|
_Dao.UpdatePath(id, path);
|
|
|
return new JsonPageResult(true, info + "信息更新成功!");
|
}
|
|
//根据主键获取产品或产品分类信息
|
private JsonPageResult Get(PageContext<SysUser> context)
|
{
|
return new JsonPageResult(true, this._Dao.Get(context.GetString("id")));
|
}
|
|
//图标文件上传
|
private JsonPageResult UpLoad(PageContext<SysUser> context)
|
{
|
Stopwatch stopwatch = new Stopwatch();
|
stopwatch.Start();
|
HttpPostedFile httpPostedFile = context.Files["certPath"];
|
if (httpPostedFile == null || httpPostedFile.FileName == "")
|
throw new Exception("请选择要上传的BMP(位图)、JPG、JPEG、PNG、GIF文件,并检查文件大小!");
|
string extension = Path.GetExtension(httpPostedFile.FileName);
|
if (!extension.Equals(".jpg", StringComparison.OrdinalIgnoreCase)
|
&& !extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase)
|
&& !extension.Equals(".png", StringComparison.OrdinalIgnoreCase)
|
&& !extension.Equals(".gif", StringComparison.OrdinalIgnoreCase)
|
&& !extension.Equals(".bmp", StringComparison.OrdinalIgnoreCase))
|
throw new Exception("上传文件格式不正确,只允许上传BMP(位图)、JPG、JPEG、PNG、GIF文件!");
|
if (httpPostedFile.ContentLength > 5242880 )
|
throw new Exception("文件上传不能超过5M,请检查文件大小,是否有写权限!");
|
|
//string @string = context.GetString("ablackpool");
|
//if (string.IsNullOrEmpty(@string))
|
// throw new Exception("请选择黑名单池!");
|
|
List<Stream> outputStreamList = new List<Stream>();
|
if (extension.Equals(".jpg", StringComparison.OrdinalIgnoreCase)
|
&& extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase)
|
&& extension.Equals(".png", StringComparison.OrdinalIgnoreCase)
|
&& extension.Equals(".gif", StringComparison.OrdinalIgnoreCase)
|
&& extension.Equals(".bmp", StringComparison.OrdinalIgnoreCase))
|
outputStreamList.Add(httpPostedFile.InputStream);
|
//else if (extension.Equals(".zip", StringComparison.OrdinalIgnoreCase))
|
// ZipUtils.Decompression(httpPostedFile.InputStream, ref outputStreamList, true);
|
|
//string fieldName = "c:/AYZH";
|
//HttpContext httpContext = new HttpContext();
|
//WebTool.SaveUploadFile(httpContext, fieldName);
|
|
stopwatch.Stop();
|
string str = "上传耗时:" + (object) stopwatch.ElapsedMilliseconds + "ms";
|
return new JsonPageResult(true, (object) new
|
{
|
Message = "文件上传成功!",
|
Msg = str
|
});
|
}
|
|
//获取通道列表
|
private List<GwOp> OpList
|
{
|
get
|
{
|
if (this._OpList == null)
|
{
|
using (GwOpDao gwOpDao = new GwOpDao())
|
this._OpList = gwOpDao.LoadInfoList();
|
}
|
return this._OpList;
|
}
|
}
|
|
//加载产品及产品分类信息
|
private List<GwProduct> ProductAllList()
|
{
|
GwProduct bean = new GwProduct();
|
bean.Classes = -1;
|
bean.IsDefault = -1;
|
bean.IsEnable = -1;
|
|
List<GwProduct> list = _Dao.getAllList(bean);
|
|
return list;
|
}
|
|
//获取产品或产品分类列表
|
private List<GwProduct> ProductList
|
{
|
get
|
{
|
if (this._ProductList == null)
|
{
|
this._ProductList = this.ProductAllList();
|
}
|
return this._ProductList;
|
}
|
}
|
|
//产品或产品分类ID转换名称
|
private string ProductToName(string productId)
|
{
|
if (this.ProductList == null)
|
return string.Empty;
|
GwProduct bean = this.ProductList.Find((Predicate<GwProduct>)(product => product.Id == productId));
|
if (bean != null)
|
//return string.Format("{0}-{1}", (object)bean.Id, (object)bean.Name);
|
return string.Format("{0}", (object)bean.Name);
|
return string.Empty;
|
}
|
|
//更新信息启用或停用
|
private JsonPageResult UpdateStatus(PageContext<SysUser> context)
|
{
|
string id = context.GetString("id");
|
string isEnable = context.GetString("isEnable");
|
|
if(isEnable=="0") {
|
if (this._Dao.GwProductUseCount(id) > 0)
|
throw new ArgumentException("当前产品分类已在产品信息使用中,无法停用!");
|
if (this._Dao.GwSpUseCount(id) > 0)
|
throw new ArgumentException("当前产品在客户账号信息中使用,无法停用!");
|
}
|
this._Dao.UpdateStatus(id, isEnable);
|
return new JsonPageResult(true, "更新信息状态成功!");
|
|
}
|
|
//获取通道组列表
|
private List<GwOpGroup> GroupList
|
{
|
get
|
{
|
if (this._GroupList == null)
|
{
|
using (GwOpGroupDao gwOpGroupDao = new GwOpGroupDao())
|
this._GroupList = gwOpGroupDao.GetGroupList();
|
}
|
return this._GroupList;
|
}
|
}
|
|
//通道ID转换名称
|
private string GetOpName(int opID)
|
{
|
if (this.OpList == null)
|
return string.Empty;
|
GwOp gwOp = this.OpList.Find((Predicate<GwOp>)(op => op.OpID == opID));
|
if (gwOp != null)
|
return string.Format("{0}-{1}", (object)gwOp.OpID, (object)gwOp.OpName);
|
return string.Empty;
|
}
|
|
//产品类别转换名称
|
private string ClassesToName(int classes)
|
{
|
if (classes == -1)
|
return string.Empty;
|
else if(classes == 0)
|
return "0-产品分类";
|
else if(classes == 1)
|
return "1-产品";
|
|
return string.Empty;
|
}
|
|
//产品是否默认转换名称
|
private string IsDefaultToName(int isDefault)
|
{
|
if (isDefault == -1)
|
return string.Empty;
|
else if(isDefault == 0)
|
return "0-个性化";
|
else if(isDefault == 1)
|
return "1-系统默认";
|
|
return string.Empty;
|
}
|
|
//启用停用转换名称
|
private string IsEnableToName(int isEnable)
|
{
|
if (isEnable == -1)
|
return string.Empty;
|
else if(isEnable == 0)
|
return "0-停用";
|
else if(isEnable == 1)
|
return "1-启用";
|
|
return string.Empty;
|
}
|
|
//通道组ID转换名称
|
private string GetGroupName(int groupID)
|
{
|
if (this.GroupList == null)
|
return string.Empty;
|
GwOpGroup gwOpGroup = this.GroupList.Find((Predicate<GwOpGroup>)(group => group.GroupID == groupID));
|
if (gwOpGroup != null)
|
return string.Format("{0}-{1}", (object)gwOpGroup.GroupID, (object)gwOpGroup.GroupName);
|
return string.Empty;
|
}
|
}
|