Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public bool UpdateSpecial(Special special)
 {
     SpecialHandler myHandler = new SpecialHandler(); return myHandler.UpdateSpecial(special);
 }
Exemplo n.º 5
0
 public bool AddSpecial(Special special)
 {
     SpecialHandler myHandler = new SpecialHandler(); return myHandler.InsertSpecial(special);
 }