using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data; namespace Stone.WinBiz.SystemData { public class F_FIFO { public static string GetModel(string Code) { string ret = ""; SqlConnection conn = new System.Data.SqlClient.SqlConnection(GetConnString()); try { conn.Open(); string sql = "select * from t_product where code='" + Code + "'"; SqlDataAdapter sda = new SqlDataAdapter(sql, conn); DataSet dsData = new DataSet(); sda.Fill(dsData); if (dsData.Tables[0].Rows.Count == 0) { throw new Exception("在FIFO中未取到存货代码为 " + Code + " 的数据"); } ret = dsData.Tables[0].Rows[0]["Model"].ToString(); return ret; } catch (Exception ex) { throw ex; } finally { if (conn.State == System.Data.ConnectionState.Open) conn.Close(); } } public static string GetConnString() { Entity.Entity_t_Sys_Appconfig t_Sys_Appconfig = new Entity.Entity_t_Sys_Appconfig(); return t_Sys_Appconfig.GetData("[Code]='FIFO'").Tables[0].Rows[0]["Value"].ToString(); } } }