public static List <Model.mdlCustomer2> LoadCustomernWarehouseAddr(string ID, string customerid) { var mdlCustomerList = new List <Model.mdlCustomer2>(); List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@ID", SqlDbType = SqlDbType.NVarChar, Value = ID }, new SqlParameter() { ParameterName = "@CustomerID", SqlDbType = SqlDbType.NVarChar, Value = customerid }, }; DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"select a.CustomerAddress, 'customer' as CustomerType from customer a where a.customerid=@ID union all select b.WarehouseAddress, 'warehouse' as CustomerType from Warehouse b where b.warehouseid=@ID and b.CustomerID=@CustomerID", sp); foreach (DataRow drCustomer in dtCustomer.Rows) { var mdlCustomer = new Model.mdlCustomer2(); mdlCustomer.CustomerAddress = drCustomer["CustomerAddress"].ToString(); mdlCustomer.CustomerType = drCustomer["CustomerType"].ToString(); mdlCustomerList.Add(mdlCustomer); } return(mdlCustomerList); }
public static List <Model.mdlCustomer2> LoadCustomernWarehouse(string customerID) { var mdlCustomerList = new List <Model.mdlCustomer2>(); List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@CustomerID", SqlDbType = SqlDbType.NVarChar, Value = customerID }, }; DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"select a.customerid,a.customername from customer a where a.customerid=@CustomerID union all select b.warehouseid,b.warehousename from Warehouse b where b.customerid=@CustomerID", sp); foreach (DataRow drCustomer in dtCustomer.Rows) { var mdlCustomer = new Model.mdlCustomer2(); mdlCustomer.CustomerID = drCustomer["CustomerID"].ToString(); mdlCustomer.CustomerName = drCustomer["CustomerName"] + " - " + drCustomer["CustomerID"].ToString(); mdlCustomerList.Add(mdlCustomer); } return(mdlCustomerList); }