public static Boolean UpdateAttribute(Support_Classes.Attribute objAttribute) { Boolean updateSuccessful = false; updateSuccessful = Attribute_DL.UpdateAttributeRecord(objAttribute); return(updateSuccessful); }
public static Support_Classes.Attribute GetAttributeRecord(int attributeId) { Support_Classes.Attribute objAttribute = null; if (attributeId == 0) { return(objAttribute); } String selectString = "SELECT attribute_id, attribute_name FROM [dbo].[tblAttribute] WHERE attribute_id = {0}"; selectString = String.Format(selectString, Convert.ToString(attributeId)); SqlConnection conn = new SqlConnection(Data_Layer.ltConnectionString); SqlCommand comm = new SqlCommand(selectString, conn); SqlDataReader rdr; try { conn.Open(); rdr = comm.ExecuteReader(); rdr.Read(); objAttribute = new Support_Classes.Attribute(); objAttribute.Attribute_Id = Convert.ToInt32(rdr["attribute_id"]); objAttribute.Attribute_Name = Convert.ToString(rdr["attribute_name"]); // objAttribute.Application_Name = Convert.ToString(rdr["application_name"]); } catch { objAttribute = null; } finally { conn.Close(); conn.Dispose(); comm.Dispose(); } return(objAttribute); }
public static List <Support_Classes.Attribute> GetAttributeRecordList() { List <Support_Classes.Attribute> lstAttribute = null; string selectString = "select attribute_id, attribute_name from dbo.tblAttribute"; Support_Classes.Attribute objAttribute; lstAttribute = new List <Support_Classes.Attribute>(); SqlConnection conn = new SqlConnection(Data_Layer.ltConnectionString); SqlCommand comm = new SqlCommand(selectString, conn); SqlDataReader rdr; try { conn.Open(); rdr = comm.ExecuteReader(); while (rdr.Read()) { objAttribute = new Support_Classes.Attribute(); objAttribute.Attribute_Id = Convert.ToInt32(rdr["attribute_id"]); objAttribute.Attribute_Name = Convert.ToString(rdr["attribute_name"]); // objAttribute.Application_Name = Convert.ToString(rdr["application_name"]); lstAttribute.Add(objAttribute); } } catch { lstAttribute = null; } finally { conn.Dispose(); conn.Close(); comm.Dispose(); } return(lstAttribute); }
public static Boolean UpdateAttributeRecord(Support_Classes.Attribute objAttribute) { bool updateSuccessful = false; if (objAttribute == null) { return(updateSuccessful); } if (string.IsNullOrEmpty(objAttribute.Attribute_Name)) { return(updateSuccessful); } string updateString = "UPDATE tblAttribute SET attribute_name = '{0}' WHERE attribute_id = {2}"; updateString = string.Format(updateString, objAttribute.Attribute_Name, objAttribute.Attribute_Id); updateSuccessful = Data_Layer.UpdateTypeRecord(updateString, Data_Layer.ltConnectionString); return(updateSuccessful); }
public static Support_Classes.Attribute GetAttribute(int attributeId) { Support_Classes.Attribute objAttribute = null; objAttribute = Data_Layer.Attribute_DL.GetAttributeRecord(attributeId); return(objAttribute); }