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/Import/DAL/ReceiptDoc/ReceiptDocDAL.cs

106 lines
4.3 KiB
C#

2 years ago
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using DSWeb.Areas.Import.Models.ImportTrade;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.CommMng.Models;
using System.Web;
using System.Data.Common;
using DSWeb.TruckMng.Comm.Cookie;
using WebSqlHelper;
using HcUtility.Core;
namespace DSWeb.Areas.Import.DAL.ReceiptDoc
{
public partial class ReceiptDocDAL
{
#region 单据信息列表
static public List<ReceiptDocmb> GetDocList ( string strCondition, string sortstr = "")
{ //合同信息/商品信息 ——每合同一行
var strSql = new StringBuilder();
strSql.Append(" SELECT [GID],RECEIPTTYPE,[R_GID],[BSNO],[URL],[Driect_URL] ");
strSql.Append(" ,[MODIFIEDUSER],(select SHOWNAME from [user] where gid=[Receipt_Doc].MODIFIEDUSER) MODIFIEDUSERRef ");
strSql.Append(" ,dbo.trimtime(MODIFIEDTIME)[MODIFIEDTIME]");
strSql.Append(" ,[documentAttachedCode],[documentAttachedNo],ISPUBLIC ");//需求编号SR2017081100003
strSql.Append(" ,(SELECT TOP 1 MBLNO FROM V_OP_BILL WHERE BSNO=Receipt_Doc.BSNO) MBLNO");//需求编号SR2017081100003
strSql.Append(" FROM [Receipt_Doc] ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
if (sortstr!="")
strSql.Append(" order by "+ sortstr);
else
strSql.Append(" order by MODIFIEDTIME ");
return SetDocList(strSql);
}
private static List<ReceiptDocmb> SetDocList ( StringBuilder strSql )
{
var headList = new List<ReceiptDocmb>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
ReceiptDocmb data = new ReceiptDocmb();
#region Set DB data to Object
data.GID = Convert.ToString(reader["GID"]);
data.RECEIPTTYPE = Convert.ToString(reader["RECEIPTTYPE"]);
data.R_GID = Convert.ToString(reader["R_GID"]);
data.BSNO = Convert.ToString(reader["BSNO"]);
data.MBLNO = Convert.ToString(reader["MBLNO"]);
data.URL = Convert.ToString(reader["URL"]);
data.Driect_URL = Convert.ToString(reader["Driect_URL"]);
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
data.MODIFIEDUSERRef = Convert.ToString(reader["MODIFIEDUSERRef"]);
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
data.DOCUMENTATTACHEDCODE = (reader["DOCUMENTATTACHEDCODE"] == null ? "" : Convert.ToString(reader["DOCUMENTATTACHEDCODE"]));//易航线_随附单证代码//需求编号SR2017081100003
data.DOCUMENTATTACHEDNO = (reader["DOCUMENTATTACHEDNO"] == null ? "" : Convert.ToString(reader["DOCUMENTATTACHEDNO"]));//易航线_随附单证编//需求编号SR2017081100003
if (reader["ISPUBLIC"] != DBNull.Value)
data.ISPUBLIC = Convert.ToBoolean(reader["ISPUBLIC"]);//服务项目9
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 公开临时表 的 单据信息列表
static public List<ReceiptDocmb> GetDocPubList ( string strCondition )
{ //合同信息/商品信息 ——每合同一行
var strSql = new StringBuilder();
strSql.Append(" SELECT [GID],RECEIPTTYPE,[R_GID],[BSNO],[URL],[Driect_URL] ");
strSql.Append(" ,'' [MODIFIEDUSER],'' MODIFIEDUSERRef ");
strSql.Append(" ,''[MODIFIEDTIME],0 ISPUBLIC ");
strSql.Append(" ,'' MBLNO");//需求编号SR2017081100003
strSql.Append(" FROM [Receipt_Doc_public] ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
return SetDocList(strSql);
}
#endregion
}
}