85 lines
3.0 KiB
C#
85 lines
3.0 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.Text;
|
||
using System.Web;
|
||
|
||
namespace WX.CRM.WEB.ViewModel.Level2
|
||
{
|
||
public class BatchOrder
|
||
{
|
||
/// <summary>
|
||
/// 前缀
|
||
/// </summary>
|
||
[DisplayName("前缀")]
|
||
[Required(ErrorMessage = "前缀不能为空")]
|
||
public string FirstName { get; set; }
|
||
/// <summary>
|
||
/// 渠道号
|
||
/// </summary>
|
||
[DisplayName("渠道号")]
|
||
[Required(ErrorMessage = "渠道号不能为空")]
|
||
public string campaignId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 尾号起始
|
||
/// </summary>
|
||
[DisplayName("起始尾号")]
|
||
[Required(ErrorMessage = "不能为空")]
|
||
public string LastStartName { get; set; }
|
||
/// <summary>
|
||
/// 尾号结束
|
||
/// </summary>
|
||
[DisplayName("结束尾号")]
|
||
[Required(ErrorMessage = "不能为空")]
|
||
public string LastEndName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 产品代码
|
||
/// </summary>
|
||
[DisplayName("产品")]
|
||
[Required(ErrorMessage = "产品不能为空")]
|
||
public string ProductCode { get; set; }
|
||
/// <summary>
|
||
/// 限定IP
|
||
/// </summary>
|
||
[DisplayName("限定IP")]
|
||
[RegularExpression(@"^((0|(?:[1-9]\d{0,1})|(?:1\d{2})|(?:2[0-4]\d)|(?:25[0-5]))\.){3}((?:[1-9]\d{0,1})|(?:1\d{2})|(?:2[0-4]\d)|(?:25[0-5]))$", ErrorMessage = "IP格式错误")]
|
||
public string IP { get; set; }
|
||
|
||
/// <summary>
|
||
/// 完整用户名 前缀+下划线+中间4位数+尾号 范例:JMD_1234001
|
||
/// </summary>
|
||
public string FullName { get; private set; }
|
||
public string ProductName { get; set; }
|
||
|
||
public List<BatchOrder> GetList()
|
||
{
|
||
int start = Convert.ToInt32(this.LastStartName);
|
||
int end = Convert.ToInt32(this.LastEndName);
|
||
end = end < start ? start : end;
|
||
List<BatchOrder> orderList = new List<BatchOrder>();
|
||
for (int i = start; i <= end; i++)
|
||
{
|
||
BatchOrder order = new BatchOrder();
|
||
order.FirstName = this.FirstName;
|
||
order.campaignId = this.campaignId;
|
||
order.LastStartName = this.LastStartName;
|
||
order.LastEndName = this.LastEndName;
|
||
order.IP = this.IP;
|
||
order.ProductCode = this.ProductCode;
|
||
order.FullName = this.FirstName + i.ToString();
|
||
order.ProductName = HttpUtility.UrlDecode(this.ProductName, Encoding.UTF8);
|
||
orderList.Add(order);
|
||
}
|
||
return orderList;
|
||
}
|
||
public string getPara()
|
||
{
|
||
string para = string.Concat("FirstName=", this.FirstName, "&LastStartName=", this.LastStartName, "&LastEndName=", this.LastEndName, "&ProductCode=", this.ProductCode, "&campaignId=", this.campaignId, "&IP=", this.IP, "&ProductName=", this.ProductName);
|
||
return para;
|
||
}
|
||
}
|
||
|
||
} |