|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DSWeb.MvcShipping.Models.CodeAll;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsCodeAll
|
|
|
|
|
{
|
|
|
|
|
public class MsCodeAllDAL
|
|
|
|
|
{
|
|
|
|
|
#region 航线信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strCondition"></param>
|
|
|
|
|
/// <param name="companyid"></param>
|
|
|
|
|
/// <param name="sort"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
static public List<Code_lanesmb> GetLanesList ( string strCondition, string companyid, string sort = null )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(" SELECT ");
|
|
|
|
|
strSql.Append(" GID,LANEID,LANE,LANEEN,EDICODE,OP,DOC,CUSTSERVICE");
|
|
|
|
|
strSql.Append(" from code_lanes ");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" WHERE " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
strSql.Append(" order by LANEID");
|
|
|
|
|
}
|
|
|
|
|
return SetLanesData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public Code_lanesmb GetLanesData ( string condition, string companyid )
|
|
|
|
|
{
|
|
|
|
|
Code_lanesmb data = null;
|
|
|
|
|
var list = GetLanesList(condition, companyid);
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
data = list[0];
|
|
|
|
|
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
data = new Code_lanesmb();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<Code_lanesmb> SetLanesData ( StringBuilder strSql )
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<Code_lanesmb>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
Code_lanesmb data = new Code_lanesmb();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
|
|
data.LANEID = Convert.ToString(reader["LANEID"]);
|
|
|
|
|
data.LANE = Convert.ToString(reader["LANE"]);
|
|
|
|
|
data.LANEEN = Convert.ToString(reader["LANEEN"]);
|
|
|
|
|
data.EDICODE = Convert.ToString(reader["EDICODE"]);
|
|
|
|
|
data.OP = Convert.ToString(reader["OP"]);
|
|
|
|
|
data.DOC = Convert.ToString(reader["DOC"]);
|
|
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|