예제 #1
0
        public List<ShoppingCart> GetItemDetails()
        {
            List<ShoppingCart> listData = new List<ShoppingCart>();
            string strConn = CONNECT_DB;
            SqlConnection conn = new SqlConnection(strConn);
            SqlCommand command = new SqlCommand("sp_GetItemDetails", conn);
            command.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataReader reader = command.ExecuteReader();

            //List<User> users = new List<User>;
            //List<Adress> adresses = new List<User>;
            while (reader.Read())
            {
                ShoppingCart item = new ShoppingCart();
                item.Item_ID = (string)reader["Item_ID"].ToString();
                item.Item_Name = (string)reader["Item_Name"];
                item.Item_Price = reader["Item_Price"].ToString();
                item.Description = (string)reader["Item_Description"];
                item.AddedBy = (string)reader["AddedBy"];
                listData.Add(item);
            }
            conn.Close();
            return listData;
        }
예제 #2
0
        public bool addItemMaster(ShoppingCart item)
        {
            bool result = false;
            string strConn = CONNECT_DB;//ConfigurationManager.ConnectionStrings["ShoppingDB"].ToString();
            SqlConnection conn = new SqlConnection(strConn);
            SqlCommand command = new SqlCommand("sp_addItemMaster", conn);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@itemname", SqlDbType.VarChar).Value = item.Item_Price.ToString();
            command.Parameters.Add("@itemprice", SqlDbType.Int).Value = int.Parse(item.Item_Price);
            command.Parameters.Add("@imagename", SqlDbType.VarChar).Value = item.Image_Name.ToString();
            command.Parameters.Add("@description", SqlDbType.VarChar).Value = item.Description.ToString();
            command.Parameters.Add("@addedby", SqlDbType.VarChar).Value = item.AddedBy.ToString();

            conn.Open();
            try
            {
                result = (bool)command.ExecuteScalar();
            }
            catch (Exception e)
            {
                throw (e);

            }
            conn.Close();
            return result;
        }
 public bool addItemMasterTest()
 {
     ShoppingCart item = new ShoppingCart();
     item.Item_Name = "sonyz3";
     item.Item_Price = "123123";
     item.Description = "sony z3";
     item.Image_Name = "sonyz3.jpg";
     item.AddedBy = "binhhv";
     var objBBUS = new B_BUS();
     return objBBUS.addItemMaster(item);
 }
예제 #4
0
 public bool addItemMaster(ShoppingCart item)
 {
     var objBDAC = new B_DAC();
     return objBDAC.addItemMaster(item);
 }
 public bool addItemMaster(ShoppingCart item)
 {
     var objBBUS = new B_BUS();
     return objBBUS.addItemMaster(item);
 }