using Common.Model; using CoreEntity.Entity; using System; using System.Collections.Generic; using System.Data; using System.Text; using ZcPeng.PublicLibrary; namespace CoreEntity.DAL { class SupplyDAL { public static SupplyDoc getSupply(string BusinessCode) { DataTable dt = new DataTable(); string commandTextSupp = "Select SuppliersId,DftAddress From SUPPLYDOC Where gysbh=@BusinessCode"; string resultSupp; List> parametersSupp = new List>(); if (BusinessCode != null) { parametersSupp.Add(new List() { "BusinessCode", BusinessCode }); DataAccess.GetValues(commandTextSupp, ref dt, DataAccess.ToParameters(parametersSupp).ToArray(), out resultSupp); } if (dt.Rows.Count > 0) { List suplist = (List)ModelConvertHelper.ConvertToModel(dt); SupplyDoc[] sups = suplist.ToArray(); return sups[0]; } return null; } public static SupplyDoc getSupplyByContactId(string ContactId) { DataTable dt = new DataTable(); string commandTextSupp = "Select * From SUPPLYDOC " + "Where SuppliersId in (select BusinessId from ContactDoc where ContactId = @ContactId)"; string resultSupp; List> parametersSupp = new List>(); if (ContactId != null) { parametersSupp.Add(new List() { "ContactId", ContactId }); DataAccess.GetValues(commandTextSupp, ref dt, DataAccess.ToParameters(parametersSupp).ToArray(), out resultSupp); } if (dt.Rows.Count > 0) { List suplist = (List)ModelConvertHelper.ConvertToModel(dt); SupplyDoc[] sups = suplist.ToArray(); return sups[0]; } return null; } } }