public List <Budget_Protections> SelectAll() { List <Budget_Protections> ProtectionsList = null; try { string sSQL = "SELECT * FROM Protections"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { ProtectionsList = new List <Budget_Protections>(); Budget_Protections protection = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { protection = new Budget_Protections(); protection.ProtectionOID = new Guid(ds.Tables[0].Rows[i]["ProtectionOID"].ToString()); protection.Enable = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString()); protection.Seq = Convert.ToInt32(ds.Tables[0].Rows[i]["Seq"].ToString()); protection.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); protection.BannerFileName = ds.Tables[0].Rows[i]["BannerFileName"].ToString(); protection.Title = ds.Tables[0].Rows[i]["Title"].ToString(); protection.ShortDes = ds.Tables[0].Rows[i]["ShortDes"].ToString(); protection.Descriptions = ds.Tables[0].Rows[i]["Descriptions"].ToString(); protection.imageFileName1 = ds.Tables[0].Rows[i]["imageFileName1"].ToString(); protection.imageFileName2 = ds.Tables[0].Rows[i]["imageFileName2"].ToString(); protection.imageFileName3 = ds.Tables[0].Rows[i]["imageFileName3"].ToString(); protection.imageFileName4 = ds.Tables[0].Rows[i]["imageFileName4"].ToString(); protection.imageFileName5 = ds.Tables[0].Rows[i]["imageFileName5"].ToString(); protection.imageFileName6 = ds.Tables[0].Rows[i]["imageFileName6"].ToString(); protection.imageFileName7 = ds.Tables[0].Rows[i]["imageFileName7"].ToString(); protection.imageFileName8 = ds.Tables[0].Rows[i]["imageFileName8"].ToString(); protection.imageFileName9 = ds.Tables[0].Rows[i]["imageFileName9"].ToString(); protection.imageFileName10 = ds.Tables[0].Rows[i]["imageFileName10"].ToString(); protection.imageFileName11 = ds.Tables[0].Rows[i]["imageFileName11"].ToString(); protection.imageFileName12 = ds.Tables[0].Rows[i]["imageFileName12"].ToString(); protection.imageFileName13 = ds.Tables[0].Rows[i]["imageFileName13"].ToString(); protection.imageFileName14 = ds.Tables[0].Rows[i]["imageFileName14"].ToString(); protection.imageFileName15 = ds.Tables[0].Rows[i]["imageFileName15"].ToString(); ProtectionsList.Add(protection); } } } catch (Exception ex) { } return(ProtectionsList); }
public Budget_Protections SelectByOID(Guid guidProtectionOID) { Budget_Protections protection = null; try { string sSQL = "SELECT * FROM Protections WHERE ProtectionOID=@ProtectionOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@ProtectionOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidProtectionOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { protection = new Budget_Protections(); protection.ProtectionOID = new Guid(ds.Tables[0].Rows[0]["ProtectionOID"].ToString()); protection.Enable = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString()); protection.Seq = Convert.ToInt32(ds.Tables[0].Rows[0]["Seq"].ToString()); protection.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); protection.BannerFileName = ds.Tables[0].Rows[0]["BannerFileName"].ToString(); protection.Title = ds.Tables[0].Rows[0]["Title"].ToString(); protection.ShortDes = ds.Tables[0].Rows[0]["ShortDes"].ToString(); protection.Descriptions = ds.Tables[0].Rows[0]["Descriptions"].ToString(); protection.imageFileName1 = ds.Tables[0].Rows[0]["imageFileName1"].ToString(); protection.imageFileName2 = ds.Tables[0].Rows[0]["imageFileName2"].ToString(); protection.imageFileName3 = ds.Tables[0].Rows[0]["imageFileName3"].ToString(); protection.imageFileName4 = ds.Tables[0].Rows[0]["imageFileName4"].ToString(); protection.imageFileName5 = ds.Tables[0].Rows[0]["imageFileName5"].ToString(); protection.imageFileName6 = ds.Tables[0].Rows[0]["imageFileName6"].ToString(); protection.imageFileName7 = ds.Tables[0].Rows[0]["imageFileName7"].ToString(); protection.imageFileName8 = ds.Tables[0].Rows[0]["imageFileName8"].ToString(); protection.imageFileName9 = ds.Tables[0].Rows[0]["imageFileName9"].ToString(); protection.imageFileName10 = ds.Tables[0].Rows[0]["imageFileName10"].ToString(); protection.imageFileName11 = ds.Tables[0].Rows[0]["imageFileName11"].ToString(); protection.imageFileName12 = ds.Tables[0].Rows[0]["imageFileName12"].ToString(); protection.imageFileName13 = ds.Tables[0].Rows[0]["imageFileName13"].ToString(); protection.imageFileName14 = ds.Tables[0].Rows[0]["imageFileName14"].ToString(); protection.imageFileName15 = ds.Tables[0].Rows[0]["imageFileName15"].ToString(); } } catch (Exception ex) { } return(protection); }