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.
110 lines
3.5 KiB
C#
110 lines
3.5 KiB
C#
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;
|
|
using DSWeb.Common.DB;
|
|
using System.Linq;
|
|
|
|
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,CUSTOMERNAME");
|
|
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"]);
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region 航线港口信息
|
|
|
|
static public List<vw_code_lanes_port_md> GetLanesPortList(string LANEID)
|
|
{
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
var list = new List<vw_code_lanes_port_md>();
|
|
|
|
list = cdc.vw_code_lanes_port.Where(x => x.LANEID == LANEID).OrderBy(o=>o.ORDERNO).ToList();
|
|
|
|
return list;
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
}
|