public List<Special> GetSpecialsList() { List<Special> SpecialsList = null; using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewAllSpecials", //*Note CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { SpecialsList = new List<Special>(); foreach (DataRow row in table.Rows) { Special special = new Special(); special.SpecialID = Convert.ToInt32(row["SpecialID"]); special.StartDate = Convert.ToDateTime(row["StartDate"]); special.EndDate = Convert.ToDateTime(row["EndDate"]); special.Description = row["Description"].ToString(); special.CutDownPercentage = Convert.ToInt32(row["CutDownPercentage"]); //special.SpecialPrice = Convert.ToDouble(row["SpecialPrice"]); SpecialsList.Add(special); } } } return SpecialsList; }
public bool InsertSpecial(Special special) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@StartDate", special.StartDate), new SqlParameter("@EndDate", special.EndDate), new SqlParameter("@Description", special.Description), new SqlParameter("@CutDownPercentage", special.CutDownPercentage), }; return DataProvider.ExecuteNonQuery("sp_InsertSpecial", CommandType.StoredProcedure, Params); }
public Special GetSpecialDetails(int SpecialID) { Special special = null; SqlParameter[] Params = { new SqlParameter("@SpecialID", SpecialID) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificSpecial", CommandType.StoredProcedure, Params)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; special = new Special(); special.SpecialID = Convert.ToInt32(row["SpecialID"]); special.StartDate = Convert.ToDateTime(row["StartDate"]); special.EndDate = Convert.ToDateTime(row["EndDate"]); special.Description = row["Description"].ToString(); special.CutDownPercentage = Convert.ToInt32(row["CutDownPercentage"]); //special.SpecialPrice = Convert.ToDouble(row["SpecialPrice"]); } } return special; }
public bool UpdateSpecial(Special special) { SpecialHandler myHandler = new SpecialHandler(); return myHandler.UpdateSpecial(special); }
public bool AddSpecial(Special special) { SpecialHandler myHandler = new SpecialHandler(); return myHandler.InsertSpecial(special); }