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/DSWeb/Areas/MvcShipping/DAL/MsWebSite/MsWebSiteDAL.cs

68 lines
2.4 KiB
C#

2 years ago
using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using DSWeb.MvcShipping.Models.MsMessTip;
using DSWeb.MvcShipping.Models.MsTemplet;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.EntityDA;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using System.Data.SqlClient;
using System.IO;
using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
namespace DSWeb.MvcShipping.DAL.MsWebSite
{
public class MsWebSiteDAL
{
#region 查询模板地址
public static List<MsTempletStructure> GetTempletURL(string gid)
{
List<MsTempletStructure> list = new List<MsTempletStructure>();
StringBuilder sql = new StringBuilder();
//sql.AppendLine("select top 1 TEMPLETURL from templet where TEMPLETID='" + gid + "'");
sql.AppendLine("select distinct GID,MAINIMGURL ");
sql.AppendLine("from templet ");
sql.AppendLine("where TEMPLETID='" + gid + "' ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql.ToString()))
{
while (reader.Read())
{
MsTempletStructure data = new MsTempletStructure();
data.GID = Convert.ToString(reader["GID"]);
data.MAINIMGURL = Convert.ToString(reader["MAINIMGURL"]);
list.Add(data);
}
reader.Close();
}
return list;
}
#endregion
#region 查询网址
public static List<MsTempletStructure> GetWebSite(string id)
{
List<MsTempletStructure> list = new List<MsTempletStructure>();
StringBuilder sql = new StringBuilder();
sql.AppendLine("select MAINIMGURL from templet where GID='" + id + "'");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql.ToString()))
{
while (reader.Read())
{
MsTempletStructure data = new MsTempletStructure();
data.MAINIMGURL = Convert.ToString(reader["MAINIMGURL"]);
list.Add(data);
}
reader.Close();
}
return list;
}
#endregion
}
}