You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/HomeService/NavigationService.asmx.cs

77 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
using HomeService.DBHelper;
using HomeService.Models;
using HomeService.Utility;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace HomeService
{
/// <summary>
/// NavigationService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class NavigationService : System.Web.Services.WebService
{
[WebMethod]
public static void StoreMemcached()
{
string gid = "";
string name = "";
string description = "";
string url = "";
DataTable modInquire = GetModuleName();
for (int iCount = 0; iCount < modInquire.Rows.Count; iCount++)
{
gid = modInquire.Rows[iCount]["GID"].ToString();
name = modInquire.Rows[iCount]["NAME"].ToString();
description = modInquire.Rows[iCount]["DESCRIPTION"].ToString();
url = modInquire.Rows[iCount]["MODULEURL"].ToString();
if (!CacheHelper.IsExists("/" + url))
{
CacheHelper.Set("/" + url, gid + "|" + name + "|" + description, DateTime.Now.AddHours(1));
}
else
{
CacheHelper.Replace("/" + url, gid + "|" + name + "|" + description, DateTime.Now.AddHours(1));
}
}
}
[WebMethod]
public static string DeliveryMemcached(string url)
{
string _delivery = "";
string _de = CacheHelper.Get(url) as string;
if (_de != null)
{
_delivery = _de;
}
else
{
StoreMemcached();
_delivery = CacheHelper.Get(url) as string;
}
return _delivery;
}
private static DataTable GetModuleName()
{
StringBuilder sql = new StringBuilder();
DataTable dt = new DataTable();
sql.AppendLine("select * from sys_module ");
dt = SqlHelper.ExecuteSql(sql.ToString());
return dt;
}
}
}