From 374ce4ffd0c459bb4067e8d5765f972668aff9b1 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期四, 02 三月 2023 14:56:23 +0800
Subject: [PATCH] 变更oracle访问组件

---
 web/web/GwBlackMobile.ashx |  835 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 418 insertions(+), 417 deletions(-)

diff --git a/web/web/GwBlackMobile.ashx b/web/web/GwBlackMobile.ashx
index 30965c6..8ddc610 100644
--- a/web/web/GwBlackMobile.ashx
+++ b/web/web/GwBlackMobile.ashx
@@ -1,6 +1,7 @@
 锘�<%@ WebHandler Language="C#" Class="GwBlackMobileHandler" %>
- 
-using com.softwee.smgw.common;
+
+//using App_Code;
+using Common;
 using Dao;
 using Model;
 using System;
@@ -14,326 +15,326 @@
 
 public class GwBlackMobileHandler : PageHandler<SysUser>
 {
-  private HashSet<long> Map = new HashSet<long>();
-  private GwBlackPoolDao _GwBlackPoolDao = new GwBlackPoolDao();
+    private HashSet<long> Map = new HashSet<long>();
+    private GwBlackPoolDao _GwBlackPoolDao = new GwBlackPoolDao();
 
-  public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context)
-  {
-    string @string = context.GetString("action");
-    switch (@string)
+    public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context)
     {
-      case "saveMobileSegMent":
-        return this.SaveMobileSegMent(context);
-      case "getMobileSegment":
-        return this.GetMobileSegment(context);
-      case "loadGwBlackPool":
-        return this.LoadGwBlackPool(context);
-      case "getGwBlackPool":
-        return this.GetGwBlackPool(context);
-      case "save":
-        return this.Save(context);
-            
-   //娓呴櫎榛戝悕鍗曟暟鎹�  
-                  
-      case "truntateBlackMobile":
-        return this.truntateBlackMobile(context);
-   //娓呴櫎榛戝悕鍗曟暟鎹瓻ND
-                
-      case "update":
-        return this.Update(context);
-      case "deletePool":
-        return this.DeletePool(context);
-      case "loadGwBlackMobile":
-        return this.LoadGwBlackMobile(context);
-      case "addGwBlackMobile":
-        return this.AddGwBlackMobile(context);
-      case "deleteMobile":
-        return this.DeleteMobile(context);
-      case "txtimportBlackMobile":
-        return this.ZipImportBlackMobile(context);
-      default:
-        throw new Exception("Invalid Action=" + @string);
+        string @string = context.GetString("action");
+        switch (@string)
+        {
+            case "saveMobileSegMent":
+                return this.SaveMobileSegMent(context);
+            case "getMobileSegment":
+                return this.GetMobileSegment(context);
+            case "loadGwBlackPool":
+                return this.LoadGwBlackPool(context);
+            case "getGwBlackPool":
+                return this.GetGwBlackPool(context);
+            case "save":
+                return this.Save(context);
+
+            //娓呴櫎榛戝悕鍗曟暟鎹�  
+
+            case "truntateBlackMobile":
+                return this.truntateBlackMobile(context);
+            //娓呴櫎榛戝悕鍗曟暟鎹瓻ND
+
+            case "update":
+                return this.Update(context);
+            case "deletePool":
+                return this.DeletePool(context);
+            case "loadGwBlackMobile":
+                return this.LoadGwBlackMobile(context);
+            case "addGwBlackMobile":
+                return this.AddGwBlackMobile(context);
+            case "deleteMobile":
+                return this.DeleteMobile(context);
+            case "txtimportBlackMobile":
+                return this.ZipImportBlackMobile(context);
+            default:
+                throw new Exception("Invalid Action=" + @string);
+        }
     }
-  }
 
-  private JsonPageResult SaveMobileSegMent(PageContext<SysUser> context)
-  {
-    int @int = context.GetInt("pid");
-    string @string = context.GetString("mobileData");
-    if (@int < 0)
-      throw new ArgumentException("鍙傛暟PoolID鑾峰彇澶辫触");
-    if (string.IsNullOrEmpty(@string))
-      throw new ArgumentException("璇峰~鍐欏彿娈�");
-    if (new GwBlackPoolDao().UpMobileSegMentdate(new GwBlackPool()
+    private JsonPageResult SaveMobileSegMent(PageContext<SysUser> context)
     {
-      PoolID = @int,
-      MobileSegMent = SegmentHelper.Filrate(@string)
-    }))
-      return new JsonPageResult(true, (object) "鍙锋淇敼鎴愬姛");
-    return new JsonPageResult(false, (object) "娣诲姞鍙锋澶辫触");
-  }
-
-  private JsonPageResult GetMobileSegment(PageContext<SysUser> context)
-  {
-    return new JsonPageResult(true, (object) new GwBlackPoolDao().GetGwBlackPool(context.GetInt("pid")));
-  }
-
-  private JsonPageResult LoadGwBlackPool(PageContext<SysUser> context)
-  {
-    string @string = context.GetString("poolName");
-    int recordcount = 0;
-    int int1 = context.GetInt("pageIndex", 1);
-    int int2 = context.GetInt("pageSize", 20);
-    string str = "";
-    using (GwBlackPoolDao gwBlackPoolDao = new GwBlackPoolDao())
-    {
-      List<GwBlackPool> list = gwBlackPoolDao.LoadInfoList(@string, out recordcount, int1, int2);
-      if (list != null && list.Count > 0)
-      {
-        foreach (GwBlackPool gwBlackPool in list)
+        int @int = context.GetInt("pid");
+        string @string = context.GetString("mobileData");
+        if (@int < 0)
+            throw new ArgumentException("鍙傛暟PoolID鑾峰彇澶辫触");
+        if (string.IsNullOrEmpty(@string))
+            throw new ArgumentException("璇峰~鍐欏彿娈�");
+        if (new GwBlackPoolDao().UpMobileSegMentdate(new GwBlackPool()
         {
-          str = str + (object) "<tr ><td>" + gwBlackPool.PoolName + "</td><td>" + (object) gwBlackPool.BlackPoolID + "</td>";
-          str += "<td>";
-          str += string.Format("<a class=\"btn btn-xs btn-primary btn-poolmobile\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
-          str += "&nbsp;鏌ヨ</a>&nbsp;";
-          str += string.Format("<a class=\"btn btn-xs btn-primary btn-mobile-segment\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
-          str += "<i class=\"fa fa-edit\"></i>&nbsp;榛戝悕鍗曞彿娈�</a>&nbsp;";
-          str += string.Format("<a class=\"action-txtimportBlack btn btn-info btn-xs \" href=\"javascript:;\" data-id=\"{0}\" data-name=\"{1}\">", (object) gwBlackPool.PoolID, (object) gwBlackPool.PoolName);
-          str += "&nbsp;榛戝悕鍗曞鍏�</a>&nbsp;";
-          if (gwBlackPool.PoolID > 0)
-          {
-            str += string.Format("<a class=\"action-modal-edit btn btn-success btn-xs \" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
-            str += "<i class='fa fa-edit'></i>&nbsp;缂栬緫";
-            str += "</a>&nbsp;";
-            str += string.Format("<a class=\"action-delete btnbtn btn btn-default btn-xs\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
-            str += "<i class='fa fa-trash'></i>&nbsp;鍒犻櫎";
-            str += "</a>&nbsp;";
-          }
-          str += "</td>";
-          str += "</tr>";
-        }
-      }
-      else
-        str += "<tr><td colspan=\"3\" style=\"text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+            PoolID = @int,
+            MobileSegMent = SegmentHelper.Filrate(@string)
+        }))
+            return new JsonPageResult(true, (object) "鍙锋淇敼鎴愬姛");
+        return new JsonPageResult(false, (object) "娣诲姞鍙锋澶辫触");
     }
-    return new JsonPageResult(true, (object) new
+
+    private JsonPageResult GetMobileSegment(PageContext<SysUser> context)
     {
-      Table = str.ToString(),
-      TotalCount = recordcount
-    });
-  }
-
-  private JsonPageResult Save(PageContext<SysUser> context)
-  {
-    string @string = context.GetString("poolName");
-    if (string.IsNullOrEmpty(@string))
-      throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О涓嶈兘涓虹┖锛�");
-    if (this._GwBlackPoolDao.IsExitsPoolName(@string))
-      throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О宸插瓨鍦紒");
-    this._GwBlackPoolDao.Add(new GwBlackPool()
-    {
-      PoolName = @string
-    });
-    return new JsonPageResult(true, (object) "鍒涘缓榛戝悕鍗曟睜鎴愬姛锛�");
-  }
-
-  private JsonPageResult Update(PageContext<SysUser> context)
-  {
-    int @int = context.GetInt("poolID");
-    string @string = context.GetString("poolName");
-    if (string.IsNullOrEmpty(@string))
-      throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О涓嶈兘涓虹┖锛�");
-    if (this._GwBlackPoolDao.IsExitsPoolName(@string, @int))
-      throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О宸插瓨鍦紒");
-    this._GwBlackPoolDao.Update(new GwBlackPool()
-    {
-      PoolID = @int,
-      PoolName = @string
-    });
-    return new JsonPageResult(true, (object) "淇敼榛戝悕鍗曟睜鎴愬姛锛�");
-  }
-
-  private JsonPageResult DeletePool(PageContext<SysUser> context)
-  {
-    int @int = context.GetInt("poolID");
-    if (this._GwBlackPoolDao.IsGwOpPortExits(@int))
-      throw new Exception("閫氶亾淇℃伅閰嶇疆涓鍦ㄤ娇鐢ㄨ榛戝悕鍗曟睜锛屼笉鑳藉垹闄わ紒");
-    this._GwBlackPoolDao.DeleteMobile(@int);
-    return new JsonPageResult(true, (object) "鍒犻櫎榛戝悕鍗曟睜鎴愬姛锛�");
-  }
-
-
-  // 娓呴櫎榛戝悕鍗曟暟鎹垚鍔�
-
-  private JsonPageResult truntateBlackMobile(PageContext<SysUser> context)
-  {
-      this._GwBlackPoolDao.truntateBlackMobile();
-      
-      return new JsonPageResult(true,"娓呴櫎鍏ㄩ儴榛戝悕鍗曞彿鐮佹垚鍔燂紒");
-  }
-  // 娓呴櫎榛戝悕鍗曟暟鎹垚鍔烢ND
-    
-    
-  private JsonPageResult GetGwBlackPool(PageContext<SysUser> context)
-  {
-    return new JsonPageResult(true, (object) this._GwBlackPoolDao.GetGwBlackPool(context.GetInt("poolID")));
-  }
-
-  private JsonPageResult LoadGwBlackMobile(PageContext<SysUser> context)
-  {
-    string string1 = context.GetString("blackpool");
-    string string2 = context.GetString("mobile");
-    if (string.IsNullOrEmpty(string2))
-      throw new ArgumentException("鎵嬫満鍙风爜涓嶈兘涓虹┖锛�");
-    string str = "";
-    using (GwBlackPoolDao gwBlackPoolDao = new GwBlackPoolDao())
-    {
-      List<GwBlackPool> list = gwBlackPoolDao.LoadInfoList(string1, string2);
-      if (list != null && list.Count > 0)
-      {
-        foreach (GwBlackPool gwBlackPool in list)
-        {
-          str = str + (object) "<tr ><td>" + gwBlackPool.Mobile + "</td><td>" + gwBlackPool.PoolName + "</td><td>" + (object) gwBlackPool.ModifyTime + "</td>";
-          str += "<td>";
-          str += string.Format("<a class=\"action-mobile-delete btnbtn btn btn-default btn-xs\" href=\"javascript:;\" data-id=\"{0}\" data-moblie=\"{1}\">", (object) gwBlackPool.BlackPoolID, (object) gwBlackPool.Mobile);
-          str += "<i class='fa fa-trash'></i>&nbsp;鍒犻櫎";
-          str += "</a>";
-          str += "</td>";
-          str += "</tr>";
-        }
-      }
-      else
-        str += "<tr><td colspan=\"4\" style=\"text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+        return new JsonPageResult(true, (object) new GwBlackPoolDao().GetGwBlackPool(context.GetInt("pid")));
     }
-    return new JsonPageResult(true, (object) new
-    {
-      Table = str.ToString()
-    });
-  }
 
-  private JsonPageResult AddGwBlackMobile(PageContext<SysUser> context)
-  {
-    string string1 = context.GetString("blackpool");
-    string string2 = context.GetString("mobile");
-    if (string.IsNullOrEmpty(string1))
-      throw new ArgumentException("榛戝悕鍗曟睜涓嶈兘涓虹┖锛�");
-    if (string.IsNullOrEmpty(string2))
-      throw new ArgumentException("鎵嬫満鍙风爜涓嶈兘涓虹┖锛�");
-    if (!this._GwBlackPoolDao.IsPortExits(Convert.ToInt32(string1), string2))
-      throw new Exception("榛戝悕鍗曞彿鐮佸凡瀛樺湪锛�");
-    this._GwBlackPoolDao.AddMobile(Convert.ToInt32(string1), string2);
-    return new JsonPageResult(true, (object) "鏂板榛戝悕鍗曞彿鐮佹垚鍔燂紒");
-  }
-
-  private JsonPageResult DeleteMobile(PageContext<SysUser> context)
-  {
-    this._GwBlackPoolDao.DeleteMobile(context.GetInt("poolID"), context.GetString("mobile"));
-    return new JsonPageResult(true, (object) "鍒犻櫎榛戝悕鍗曞彿鐮佹垚鍔燂紒");
-  }
-
- 
-    
-    
-    
-  private JsonPageResult ZipImportBlackMobile(PageContext<SysUser> context)
-  {
-    Stopwatch stopwatch = new Stopwatch();
-    stopwatch.Start();
-    HttpPostedFile httpPostedFile = context.Files["certPath"];
-    if (httpPostedFile == null || httpPostedFile.FileName == "")
-      throw new Exception("璇烽�夋嫨瑕佸鍏ョ殑zip鏂囦欢,骞舵鏌ユ枃浠跺ぇ灏忥紒");
-    string extension = Path.GetExtension(httpPostedFile.FileName);
-    if (!extension.Equals(".zip", StringComparison.OrdinalIgnoreCase) && !extension.Equals(".txt", StringComparison.OrdinalIgnoreCase))
-      throw new Exception("瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝鍙厑璁稿鍏ip鎴杢xt鏂囦欢!");
-    if (httpPostedFile.ContentLength > 104857600)
-      throw new Exception("鏂囦欢涓婁紶涓嶈兘瓒呰繃100M锛岃妫�鏌ユ枃浠跺ぇ灏忥紝鏄惁鏈夊啓鏉冮檺锛�");
-    string @string = context.GetString("ablackpool");
-    if (string.IsNullOrEmpty(@string))
-      throw new Exception("璇烽�夋嫨榛戝悕鍗曟睜锛�");
-    List<Stream> outputStreamList = new List<Stream>();
-    if (extension.Equals(".txt", StringComparison.OrdinalIgnoreCase))
-      outputStreamList.Add(httpPostedFile.InputStream);
-    else if (extension.Equals(".zip", StringComparison.OrdinalIgnoreCase))
-      ZipUtils.Decompression(httpPostedFile.InputStream, ref outputStreamList, true);
-    HashSet<string> blackPoolMobile = this._GwBlackPoolDao.GetBlackPoolMobile(Convert.ToInt32(@string.ToString()));
-    HashSet<string> tempSet = new HashSet<string>();
-    DataTable dt = new DataTable("GW_BLACKPOOL_MOBILE");
-    dt.Columns.Add("MOBILE", typeof (string));
-    DateTime now = DateTime.Now;
-    DataColumn column1 = new DataColumn("BLACKPOOL_ID", typeof (int));
-    DataColumn column2 = new DataColumn("MODIFY_TIME", typeof (DateTime));
-    DataColumn column3 = new DataColumn("IS_DELETED", typeof (int));
-    column1.DefaultValue = (object) @string;
-    column2.DefaultValue = (object) now;
-    column3.DefaultValue = (object) 0;
-    dt.Columns.Add(column1);
-    dt.Columns.Add(column2);
-    dt.Columns.Add(column3);
-    StringBuilder errorBuilder = new StringBuilder();
-    int count = 0;
-    foreach (Stream stream in outputStreamList)
+    private JsonPageResult LoadGwBlackPool(PageContext<SysUser> context)
     {
-      stream.Seek(0L, SeekOrigin.Begin);
-      count += this.ProcessStream(blackPoolMobile, tempSet, dt, errorBuilder, stream);
-    }
-    int num = this.SaveDataTable(dt, now, count);
-    stopwatch.Stop();
-    string str = "鏁伴噺锛�" + (object) num + "涓紝鑰楁椂锛�" + (object) stopwatch.ElapsedMilliseconds + "ms";
-    if (errorBuilder.Length > 0)
-      str = str + ",閿欒鍙风爜鍖呭惈锛�" + errorBuilder.ToString();
-    return new JsonPageResult(true, (object) new
-    {
-      Message = "鍏ㄥ眬榛戝悕鍗曞鍏ユ垚鍔燂紒",
-      Msg = str
-    });
-  }
-
-  private int SaveDataTable(DataTable dt, DateTime dtime, int count)
-  {
-    if (dt != null)
-    {
-      if (dt.Rows.Count > 0)
-      {
-        try
+        string @string = context.GetString("poolName");
+        int recordcount = 0;
+        int int1 = context.GetInt("pageIndex", 1);
+        int int2 = context.GetInt("pageSize", 20);
+        string str = "";
+        using (GwBlackPoolDao gwBlackPoolDao = new GwBlackPoolDao())
         {
-          this._GwBlackPoolDao.Import(dt);
-          this._GwBlackPoolDao.Add_EventLog(dtime);
-          count += dt.Rows.Count;
-        }
-        catch (Exception ex)
-        {
-          throw new Exception("鍐欏叆鏁版嵁鍑洪敊锛�" + ex.Message);
-        }
-      }
-    }
-    return count;
-  }
-
-  private int ProcessStream(HashSet<string> existsSet, HashSet<string> tempSet, DataTable dt, StringBuilder errorBuilder, Stream stream)
-  {
-    int count = 0;
-    using (StreamReader streamReader = new StreamReader(stream, Encoding.Default))
-    {
-      Regex regex = new Regex("^1[34578]\\d{9}$");
-      int num = 0;
-      while (!streamReader.EndOfStream)
-      {
-        string str1;
-        try
-        {
-          str1 = streamReader.ReadLine();
-        }
-        catch (Exception ex)
-        {
-          throw new Exception("璇诲彇鏂囦欢鍑洪敊锛屾墜鏈哄彿鐮佽鎹㈣锛�");
-        }
-        if (!string.IsNullOrEmpty(str1))
-        {
-          string[] strArray;
-          try
-          {
-            strArray = str1.Split(new char[8]
+            List<GwBlackPool> list = gwBlackPoolDao.LoadInfoList(@string, out recordcount, int1, int2);
+            if (list != null && list.Count > 0)
             {
+                foreach (GwBlackPool gwBlackPool in list)
+                {
+                    str = str + (object) "<tr ><td>" + gwBlackPool.PoolName + "</td><td>" + (object) gwBlackPool.BlackPoolID + "</td>";
+                    str += "<td>";
+                    str += string.Format("<a class=\"btn btn-xs btn-primary btn-poolmobile\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
+                    str += "&nbsp;鏌ヨ</a>&nbsp;";
+                    str += string.Format("<a class=\"btn btn-xs btn-primary btn-mobile-segment\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
+                    str += "<i class=\"fa fa-edit\"></i>&nbsp;榛戝悕鍗曞彿娈�</a>&nbsp;";
+                    str += string.Format("<a class=\"action-txtimportBlack btn btn-info btn-xs \" href=\"javascript:;\" data-id=\"{0}\" data-name=\"{1}\">", (object) gwBlackPool.PoolID, (object) gwBlackPool.PoolName);
+                    str += "&nbsp;榛戝悕鍗曞鍏�</a>&nbsp;";
+                    if (gwBlackPool.PoolID > 0)
+                    {
+                        str += string.Format("<a class=\"action-modal-edit btn btn-success btn-xs \" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
+                        str += "<i class='fa fa-edit'></i>&nbsp;缂栬緫";
+                        str += "</a>&nbsp;";
+                        str += string.Format("<a class=\"action-delete btnbtn btn btn-default btn-xs\" href=\"javascript:;\" data-id=\"{0}\">", (object) gwBlackPool.PoolID);
+                        str += "<i class='fa fa-trash'></i>&nbsp;鍒犻櫎";
+                        str += "</a>&nbsp;";
+                    }
+                    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 @string = context.GetString("poolName");
+        if (string.IsNullOrEmpty(@string))
+            throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О涓嶈兘涓虹┖锛�");
+        if (this._GwBlackPoolDao.IsExitsPoolName(@string))
+            throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О宸插瓨鍦紒");
+        this._GwBlackPoolDao.Add(new GwBlackPool()
+        {
+            PoolName = @string
+        });
+        return new JsonPageResult(true, (object) "鍒涘缓榛戝悕鍗曟睜鎴愬姛锛�");
+    }
+
+    private JsonPageResult Update(PageContext<SysUser> context)
+    {
+        int @int = context.GetInt("poolID");
+        string @string = context.GetString("poolName");
+        if (string.IsNullOrEmpty(@string))
+            throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О涓嶈兘涓虹┖锛�");
+        if (this._GwBlackPoolDao.IsExitsPoolName(@string, @int))
+            throw new ArgumentException("榛戝悕鍗曟睜鍚嶇О宸插瓨鍦紒");
+        this._GwBlackPoolDao.Update(new GwBlackPool()
+        {
+            PoolID = @int,
+            PoolName = @string
+        });
+        return new JsonPageResult(true, (object) "淇敼榛戝悕鍗曟睜鎴愬姛锛�");
+    }
+
+    private JsonPageResult DeletePool(PageContext<SysUser> context)
+    {
+        int @int = context.GetInt("poolID");
+        if (this._GwBlackPoolDao.IsGwOpPortExits(@int))
+            throw new Exception("閫氶亾淇℃伅閰嶇疆涓鍦ㄤ娇鐢ㄨ榛戝悕鍗曟睜锛屼笉鑳藉垹闄わ紒");
+        this._GwBlackPoolDao.DeleteMobile(@int);
+        return new JsonPageResult(true, (object) "鍒犻櫎榛戝悕鍗曟睜鎴愬姛锛�");
+    }
+
+
+    // 娓呴櫎榛戝悕鍗曟暟鎹垚鍔�
+
+    private JsonPageResult truntateBlackMobile(PageContext<SysUser> context)
+    {
+        this._GwBlackPoolDao.truntateBlackMobile();
+
+        return new JsonPageResult(true,"娓呴櫎鍏ㄩ儴榛戝悕鍗曞彿鐮佹垚鍔燂紒");
+    }
+    // 娓呴櫎榛戝悕鍗曟暟鎹垚鍔烢ND
+
+
+    private JsonPageResult GetGwBlackPool(PageContext<SysUser> context)
+    {
+        return new JsonPageResult(true, (object) this._GwBlackPoolDao.GetGwBlackPool(context.GetInt("poolID")));
+    }
+
+    private JsonPageResult LoadGwBlackMobile(PageContext<SysUser> context)
+    {
+        string string1 = context.GetString("blackpool");
+        string string2 = context.GetString("mobile");
+        if (string.IsNullOrEmpty(string2))
+            throw new ArgumentException("鎵嬫満鍙风爜涓嶈兘涓虹┖锛�");
+        string str = "";
+        using (GwBlackPoolDao gwBlackPoolDao = new GwBlackPoolDao())
+        {
+            List<GwBlackPool> list = gwBlackPoolDao.LoadInfoList(string1, string2);
+            if (list != null && list.Count > 0)
+            {
+                foreach (GwBlackPool gwBlackPool in list)
+                {
+                    str = str + (object) "<tr ><td>" + gwBlackPool.Mobile + "</td><td>" + gwBlackPool.PoolName + "</td><td>" + (object) gwBlackPool.ModifyTime + "</td>";
+                    str += "<td>";
+                    str += string.Format("<a class=\"action-mobile-delete btnbtn btn btn-default btn-xs\" href=\"javascript:;\" data-id=\"{0}\" data-moblie=\"{1}\">", (object) gwBlackPool.BlackPoolID, (object) gwBlackPool.Mobile);
+                    str += "<i class='fa fa-trash'></i>&nbsp;鍒犻櫎";
+                    str += "</a>";
+                    str += "</td>";
+                    str += "</tr>";
+                }
+            }
+            else
+                str += "<tr><td colspan=\"4\" style=\"text-align: center;\">鏆傛棤淇℃伅</td></tr>";
+        }
+        return new JsonPageResult(true, (object) new
+        {
+            Table = str.ToString()
+        });
+    }
+
+    private JsonPageResult AddGwBlackMobile(PageContext<SysUser> context)
+    {
+        string string1 = context.GetString("blackpool");
+        string string2 = context.GetString("mobile");
+        if (string.IsNullOrEmpty(string1))
+            throw new ArgumentException("榛戝悕鍗曟睜涓嶈兘涓虹┖锛�");
+        if (string.IsNullOrEmpty(string2))
+            throw new ArgumentException("鎵嬫満鍙风爜涓嶈兘涓虹┖锛�");
+        if (!this._GwBlackPoolDao.IsPortExits(Convert.ToInt32(string1), string2))
+            throw new Exception("榛戝悕鍗曞彿鐮佸凡瀛樺湪锛�");
+        this._GwBlackPoolDao.AddMobile(Convert.ToInt32(string1), string2);
+        return new JsonPageResult(true, (object) "鏂板榛戝悕鍗曞彿鐮佹垚鍔燂紒");
+    }
+
+    private JsonPageResult DeleteMobile(PageContext<SysUser> context)
+    {
+        this._GwBlackPoolDao.DeleteMobile(context.GetInt("poolID"), context.GetString("mobile"));
+        return new JsonPageResult(true, (object) "鍒犻櫎榛戝悕鍗曞彿鐮佹垚鍔燂紒");
+    }
+
+
+
+
+
+    private JsonPageResult ZipImportBlackMobile(PageContext<SysUser> context)
+    {
+        Stopwatch stopwatch = new Stopwatch();
+        stopwatch.Start();
+        HttpPostedFile httpPostedFile = context.Files["certPath"];
+        if (httpPostedFile == null || httpPostedFile.FileName == "")
+            throw new Exception("璇烽�夋嫨瑕佸鍏ョ殑zip鏂囦欢,骞舵鏌ユ枃浠跺ぇ灏忥紒");
+        string extension = Path.GetExtension(httpPostedFile.FileName);
+        if (!extension.Equals(".zip", StringComparison.OrdinalIgnoreCase) && !extension.Equals(".txt", StringComparison.OrdinalIgnoreCase))
+            throw new Exception("瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝鍙厑璁稿鍏ip鎴杢xt鏂囦欢!");
+        if (httpPostedFile.ContentLength > 104857600)
+            throw new Exception("鏂囦欢涓婁紶涓嶈兘瓒呰繃100M锛岃妫�鏌ユ枃浠跺ぇ灏忥紝鏄惁鏈夊啓鏉冮檺锛�");
+        string @string = context.GetString("ablackpool");
+        if (string.IsNullOrEmpty(@string))
+            throw new Exception("璇烽�夋嫨榛戝悕鍗曟睜锛�");
+        List<Stream> outputStreamList = new List<Stream>();
+        if (extension.Equals(".txt", StringComparison.OrdinalIgnoreCase))
+            outputStreamList.Add(httpPostedFile.InputStream);
+        else if (extension.Equals(".zip", StringComparison.OrdinalIgnoreCase))
+            ZipUtils.Decompression(httpPostedFile.InputStream, ref outputStreamList, true);
+        HashSet<string> blackPoolMobile = this._GwBlackPoolDao.GetBlackPoolMobile(Convert.ToInt32(@string.ToString()));
+        HashSet<string> tempSet = new HashSet<string>();
+        DataTable dt = new DataTable("GW_BLACKPOOL_MOBILE");
+        dt.Columns.Add("MOBILE", typeof (string));
+        DateTime now = DateTime.Now;
+        DataColumn column1 = new DataColumn("BLACKPOOL_ID", typeof (int));
+        DataColumn column2 = new DataColumn("MODIFY_TIME", typeof (DateTime));
+        DataColumn column3 = new DataColumn("IS_DELETED", typeof (int));
+        column1.DefaultValue = (object) @string;
+        column2.DefaultValue = (object) now;
+        column3.DefaultValue = (object) 0;
+        dt.Columns.Add(column1);
+        dt.Columns.Add(column2);
+        dt.Columns.Add(column3);
+        StringBuilder errorBuilder = new StringBuilder();
+        int count = 0;
+        foreach (Stream stream in outputStreamList)
+        {
+            stream.Seek(0L, SeekOrigin.Begin);
+            count += this.ProcessStream(blackPoolMobile, tempSet, dt, errorBuilder, stream);
+        }
+        int num = this.SaveDataTable(dt, now, count);
+        stopwatch.Stop();
+        string str = "鏁伴噺锛�" + (object) num + "涓紝鑰楁椂锛�" + (object) stopwatch.ElapsedMilliseconds + "ms";
+        if (errorBuilder.Length > 0)
+            str = str + ",閿欒鍙风爜鍖呭惈锛�" + errorBuilder.ToString();
+        return new JsonPageResult(true, (object) new
+        {
+            Message = "鍏ㄥ眬榛戝悕鍗曞鍏ユ垚鍔燂紒",
+            Msg = str
+        });
+    }
+
+    private int SaveDataTable(DataTable dt, DateTime dtime, int count)
+    {
+        if (dt != null)
+        {
+            if (dt.Rows.Count > 0)
+            {
+                try
+                {
+                    this._GwBlackPoolDao.Import(dt);
+                    this._GwBlackPoolDao.Add_EventLog(dtime);
+                    count += dt.Rows.Count;
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception("鍐欏叆鏁版嵁鍑洪敊锛�" + ex.Message);
+                }
+            }
+        }
+        return count;
+    }
+
+    private int ProcessStream(HashSet<string> existsSet, HashSet<string> tempSet, DataTable dt, StringBuilder errorBuilder, Stream stream)
+    {
+        int count = 0;
+        using (StreamReader streamReader = new StreamReader(stream, Encoding.Default))
+        {
+            Regex regex = new Regex("^1[34578]\\d{9}$");
+            int num = 0;
+            while (!streamReader.EndOfStream)
+            {
+                string str1;
+                try
+                {
+                    str1 = streamReader.ReadLine();
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception("璇诲彇鏂囦欢鍑洪敊锛屾墜鏈哄彿鐮佽鎹㈣锛�");
+                }
+                if (!string.IsNullOrEmpty(str1))
+                {
+                    string[] strArray;
+                    try
+                    {
+                        strArray = str1.Split(new char[8]
+                        {
               '\r',
               '\n',
               ',',
@@ -342,126 +343,126 @@
               '|',
               '锛�',
               '锛�'
-            }, StringSplitOptions.RemoveEmptyEntries);
-          }
-          catch (Exception ex)
-          {
-            throw new Exception("鍒嗗壊鎵嬫満鍙风爜鍑洪敊锛�");
-          }
-          foreach (string str2 in strArray)
-          {
-            string input = str2.Trim();
-            if (!regex.IsMatch(input))
-              errorBuilder.AppendFormat("{0};", (object) input);
-            else if (!existsSet.Contains(input) && !tempSet.Contains(input))
-            {
-              ++num;
-              DataRow row = dt.NewRow();
-              row["MOBILE"] = (object) input;
-              dt.Rows.Add(row);
-              tempSet.Add(input);
+                        }, StringSplitOptions.RemoveEmptyEntries);
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new Exception("鍒嗗壊鎵嬫満鍙风爜鍑洪敊锛�");
+                    }
+                    foreach (string str2 in strArray)
+                    {
+                        string input = str2.Trim();
+                        if (!regex.IsMatch(input))
+                            errorBuilder.AppendFormat("{0};", (object) input);
+                        else if (!existsSet.Contains(input) && !tempSet.Contains(input))
+                        {
+                            ++num;
+                            DataRow row = dt.NewRow();
+                            row["MOBILE"] = (object) input;
+                            dt.Rows.Add(row);
+                            tempSet.Add(input);
+                        }
+                        if (num == 1000000)
+                        {
+                            count = this.SaveDataTable(dt, DateTime.Now, count);
+                            num = 0;
+                            dt.Clear();
+                        }
+                    }
+                }
             }
-            if (num == 1000000)
-            {
-              count = this.SaveDataTable(dt, DateTime.Now, count);
-              num = 0;
-              dt.Clear();
-            }
-          }
         }
-      }
+        return count;
     }
-    return count;
-  }
 
-  private JsonPageResult TxtImportBlackMobile(PageContext<SysUser> context)
-  {
-    Stopwatch stopwatch = new Stopwatch();
-    stopwatch.Start();
-    HttpPostedFile httpPostedFile = context.Files["certPath"];
-    if (httpPostedFile == null)
-      throw new Exception("鏈�夋嫨鏂囦欢鎴栦笂浼犳枃浠惰秴杩�10M锛�");
-    if (httpPostedFile.FileName == "")
-      throw new Exception("璇烽�夋嫨瑕佸鍏ョ殑txt鏂囦欢锛�");
-    string extension = Path.GetExtension(httpPostedFile.FileName);
-    if (!extension.Equals(".txt") && !extension.Equals(".TXT"))
-      throw new Exception("瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝鍙厑璁稿鍏xt鏂囦欢!");
-    if (httpPostedFile.ContentLength > 10485760)
-      throw new Exception("鏂囦欢涓婁紶涓嶈兘瓒呰繃10M锛岃妫�鏌ユ枃浠跺ぇ灏忥紝鏄惁鏈夊啓鏉冮檺锛�");
-    string @string = context.GetString("ablackpool");
-    if (string.IsNullOrEmpty(@string))
-      throw new Exception("璇烽�夋嫨榛戝悕鍗曟睜锛�");
-    HashSet<string> blackPoolMobile = this._GwBlackPoolDao.GetBlackPoolMobile(Convert.ToInt32(@string.ToString()));
-    HashSet<string> hashSet = new HashSet<string>();
-    DataTable dt = new DataTable("GW_BLACKPOOL_MOBILE");
-    dt.Columns.Add("MOBILE", typeof (string));
-    DateTime dtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
-    DataColumn column1 = new DataColumn("BLACKPOOL_ID", typeof (int));
-    DataColumn column2 = new DataColumn("MODIFY_TIME", typeof (DateTime));
-    DataColumn column3 = new DataColumn("IS_DELETED", typeof (int));
-    column1.DefaultValue = (object) @string;
-    column2.DefaultValue = (object) dtime;
-    column3.DefaultValue = (object) 0;
-    dt.Columns.Add(column1);
-    dt.Columns.Add(column2);
-    dt.Columns.Add(column3);
-    StringBuilder stringBuilder = new StringBuilder();
-    using (StreamReader streamReader = new StreamReader(httpPostedFile.InputStream, Encoding.Default))
+    private JsonPageResult TxtImportBlackMobile(PageContext<SysUser> context)
     {
-      Regex regex = new Regex("^1[34578]\\d{9}$");
-      string str1 = streamReader.ReadToEnd();
-      if (!string.IsNullOrEmpty(str1))
-      {
-        string str2 = str1;
-        char[] separator = new char[6]
+        Stopwatch stopwatch = new Stopwatch();
+        stopwatch.Start();
+        HttpPostedFile httpPostedFile = context.Files["certPath"];
+        if (httpPostedFile == null)
+            throw new Exception("鏈�夋嫨鏂囦欢鎴栦笂浼犳枃浠惰秴杩�10M锛�");
+        if (httpPostedFile.FileName == "")
+            throw new Exception("璇烽�夋嫨瑕佸鍏ョ殑txt鏂囦欢锛�");
+        string extension = Path.GetExtension(httpPostedFile.FileName);
+        if (!extension.Equals(".txt") && !extension.Equals(".TXT"))
+            throw new Exception("瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝鍙厑璁稿鍏xt鏂囦欢!");
+        if (httpPostedFile.ContentLength > 10485760)
+            throw new Exception("鏂囦欢涓婁紶涓嶈兘瓒呰繃10M锛岃妫�鏌ユ枃浠跺ぇ灏忥紝鏄惁鏈夊啓鏉冮檺锛�");
+        string @string = context.GetString("ablackpool");
+        if (string.IsNullOrEmpty(@string))
+            throw new Exception("璇烽�夋嫨榛戝悕鍗曟睜锛�");
+        HashSet<string> blackPoolMobile = this._GwBlackPoolDao.GetBlackPoolMobile(Convert.ToInt32(@string.ToString()));
+        HashSet<string> hashSet = new HashSet<string>();
+        DataTable dt = new DataTable("GW_BLACKPOOL_MOBILE");
+        dt.Columns.Add("MOBILE", typeof (string));
+        DateTime dtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
+        DataColumn column1 = new DataColumn("BLACKPOOL_ID", typeof (int));
+        DataColumn column2 = new DataColumn("MODIFY_TIME", typeof (DateTime));
+        DataColumn column3 = new DataColumn("IS_DELETED", typeof (int));
+        column1.DefaultValue = (object) @string;
+        column2.DefaultValue = (object) dtime;
+        column3.DefaultValue = (object) 0;
+        dt.Columns.Add(column1);
+        dt.Columns.Add(column2);
+        dt.Columns.Add(column3);
+        StringBuilder stringBuilder = new StringBuilder();
+        using (StreamReader streamReader = new StreamReader(httpPostedFile.InputStream, Encoding.Default))
         {
+            Regex regex = new Regex("^1[34578]\\d{9}$");
+            string str1 = streamReader.ReadToEnd();
+            if (!string.IsNullOrEmpty(str1))
+            {
+                string str2 = str1;
+                char[] separator = new char[6]
+                {
           '\r',
           '\n',
           ',',
           ';',
           ' ',
           '|'
-        };
-        int num = 1;
-        foreach (string str3 in str2.Split(separator, (StringSplitOptions) num))
-        {
-          string input = str3.Trim();
-          if (!regex.IsMatch(input))
-            stringBuilder.AppendFormat("{0};", (object) input);
-          else if (!blackPoolMobile.Contains(input) && !hashSet.Contains(input))
-          {
-            DataRow row = dt.NewRow();
-            row["MOBILE"] = (object) input;
-            dt.Rows.Add(row);
-            hashSet.Add(input);
-          }
+                };
+                int num = 1;
+                foreach (string str3 in str2.Split(separator, (StringSplitOptions) num))
+                {
+                    string input = str3.Trim();
+                    if (!regex.IsMatch(input))
+                        stringBuilder.AppendFormat("{0};", (object) input);
+                    else if (!blackPoolMobile.Contains(input) && !hashSet.Contains(input))
+                    {
+                        DataRow row = dt.NewRow();
+                        row["MOBILE"] = (object) input;
+                        dt.Rows.Add(row);
+                        hashSet.Add(input);
+                    }
+                }
+            }
         }
-      }
+        int num1 = 0;
+        if (dt != null)
+        {
+            if (dt.Rows.Count > 0)
+            {
+                try
+                {
+                    num1 = this._GwBlackPoolDao.Import(dt, dtime);
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception("鍐欏叆鏁版嵁鍑洪敊锛�" + ex.Message);
+                }
+            }
+        }
+        stopwatch.Stop();
+        string str = "鏁伴噺锛�" + (object) num1 + "涓紝鑰楁椂锛�" + (object) stopwatch.ElapsedMilliseconds + "ms";
+        if (stringBuilder.Length > 0)
+            str = str + ",閿欒鍙风爜鍖呭惈锛�" + stringBuilder.ToString();
+        "".TrimEnd(',');
+        return new JsonPageResult(true, (object) new
+        {
+            Message = "鍏ㄥ眬榛戝悕鍗曞鍏ユ垚鍔燂紒",
+            Msg = str
+        });
     }
-    int num1 = 0;
-    if (dt != null)
-    {
-      if (dt.Rows.Count > 0)
-      {
-        try
-        {
-          num1 = this._GwBlackPoolDao.Import(dt, dtime);
-        }
-        catch (Exception ex)
-        {
-          throw new Exception("鍐欏叆鏁版嵁鍑洪敊锛�" + ex.Message);
-        }
-      }
-    }
-    stopwatch.Stop();
-    string str = "鏁伴噺锛�" + (object) num1 + "涓紝鑰楁椂锛�" + (object) stopwatch.ElapsedMilliseconds + "ms";
-    if (stringBuilder.Length > 0)
-      str = str + ",閿欒鍙风爜鍖呭惈锛�" + stringBuilder.ToString();
-    "".TrimEnd(',');
-    return new JsonPageResult(true, (object) new
-    {
-      Message = "鍏ㄥ眬榛戝悕鍗曞鍏ユ垚鍔燂紒",
-      Msg = str
-    });
-  }
 }

--
Gitblit v1.9.1