//---------------------------------------------------------- private List <Aligns> Init(string LogFilePath, string LogFileName, SqlCommand cmd) { List <Aligns> AlignList = new List <Aligns>(); SqlConnection con = db.getConnection(); cmd.Connection = con; try { if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { Aligns m_Aligns = new Aligns(db.ConnectionString); m_Aligns.AlignId = smartReader.GetByte("AlignId"); m_Aligns.AlignName = smartReader.GetString("AlignName"); m_Aligns.AlignDesc = smartReader.GetString("AlignDesc"); AlignList.Add(m_Aligns); } smartReader.DisposeReader(reader); } catch (SqlException ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } finally { con.Close(); } return(AlignList); }
//----------------------------------------------------------------------- public static List <Aligns> Static_GetList(string LogFilePath, string LogFileName, string constr) { List <Aligns> RetVal = new List <Aligns>(); Aligns m_Aligns = new Aligns(constr); try { RetVal = m_Aligns.GetList(LogFilePath, LogFileName); } catch (Exception ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + m_Aligns.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(RetVal); }
//------------------------------------------------------------- public Aligns Get(string LogFilePath, string LogFileName, string AlignName) { Aligns RetVal = new Aligns(db.ConnectionString); try { List <Aligns> list = GetListByAlignName(LogFilePath, LogFileName, AlignName); if (list.Count > 0) { RetVal = (Aligns)list[0]; } } catch (Exception ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(RetVal); }
//----------------------------------------------------------------------- public static string Static_GetName(string LogFilePath, string LogFileName, string constr, byte AllignId) { string RetVal = ""; Aligns m_Aligns = new Aligns(constr); try { m_Aligns = m_Aligns.Get(LogFilePath, LogFileName, AllignId); if (!string.IsNullOrEmpty(m_Aligns.AlignName)) { RetVal = m_Aligns.AlignName; } } catch (Exception ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + m_Aligns.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(RetVal); }