wzp
2022-11-11 2f74eb23c0d2d4a246bc612c5c34bdfa8dea5603
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<%@ WebHandler Language="C#" Class="GwTransfer" %>
 
using System;
using System.Web;
using com.softwee.smgw.common;
using Dao;
using Model;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
 
 
/// <summary>
/// 携号转网处理程序
/// </summary>
public class GwTransfer : PageHandler<SysUser>
{
    private GwTransferDao _dao = new GwTransferDao();
 
    public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context)
    {
        string @string = context.GetString("action");
        switch (@string)
        {
            case "loadGwTransfer":
                return this.LoadGwTransfer(context);
            case "save":
                return this.Save(context);
            case "deleteMobile":
                return this.DeleteMobile(context);
            default:
                throw new Exception("Invalid Action=" + @string);
        }
    }
 
 
    private JsonPageResult LoadGwTransfer(PageContext<SysUser> context)
    {
        string mobile = context.GetString("mobile");
        int recordcount = 0;
        int int1 = context.GetInt("pageIndex", 1);
        int int2 = context.GetInt("pageSize", 20);
        string str = "";
        using (GwTransferDao Dao = new GwTransferDao())
        {
            List<Model.GwTransfer> list = Dao.LoadInfoList(mobile, out recordcount, int1, int2);
            if (list != null && list.Count > 0)
            {
                foreach (Model.GwTransfer gw in list)
                {
                    str = str + (object)"<tr ><td>" + gw.Mobile + "</td><td>" + (object)gw.Operator + "</td>";
                    str += "<td>";
                    str += string.Format("<a class=\"action-delete btnbtn btn btn-default btn-xs\" href=\"javascript:;\" data-id=\"{0}\">", (object)gw.Id);
                    str += "<i class='fa fa-trash'></i>&nbsp;删除 </a>";
                    str += "</td>";
                    str += "</tr>";
                }
            }
            else
            {
                str += "<tr><td colspan=\"3\" style=\"text-align: center;\">暂无信息</td></tr>";
            }
        }
        return new JsonPageResult(true, (object)new
        {
            Table = str.ToString(),
            TotalCount = recordcount
        });
    }
 
 
 
    private JsonPageResult Save(PageContext<SysUser> context)
    {
        string mobile = context.GetString("telphone");
        string mOperator = context.GetString("selectId");
        if (string.IsNullOrEmpty(mobile))
            throw new ArgumentException("手机号码称不能为空!");
        if (this._dao.IsExitsMobile(mobile))
            throw new ArgumentException("手机号码已存在!");
        this._dao.Add(new Model.GwTransfer()
        {
            Mobile =mobile,
            Operator =mOperator
        });
        return new JsonPageResult(true, (object)"创建成功!");
    }
 
    private JsonPageResult DeleteMobile(PageContext<SysUser> context)
    {
        int @int = context.GetInt("mobileId");
        this._dao.Delete(@int);
        return new JsonPageResult(true, (object)"删除号码成功!");
    }
 
}