Exemplo n.º 1
0
        public IHttpActionResult DeleteOrderRow(OrderRow obj)
        {
            DataTable dt = new DataTable();

            try
            {
                nwindConn.Open();
                SqlDataAdapter Adapter = new SqlDataAdapter("EXECUTE Store.[sp_DeleteOrderRow] @RowIdentity", nwindConn);
                Adapter.SelectCommand.Parameters.AddWithValue("@RowIdentity", obj.RowIdentity);
                Adapter.SelectCommand.CommandTimeout = 30;
                Adapter.Fill(dt);
                nwindConn.Close();

                if (dt == null)
                {
                    return(NotFound());
                }
                return(Ok(dt));
                // return dt;
            }
            catch (Exception ex)
            {
                dt = ConstructError("C#-19", ex);
                return(Ok(dt));
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult SetRating(OrderRow obj)
        {
            DataTable dt = new DataTable();

            try
            {
                nwindConn.Open();
                SqlDataAdapter Adapter = new SqlDataAdapter("EXECUTE Store.[sp_SetRating] @CustomerIdentity,@ProductIdentity,@Score,@Comments", nwindConn);
                Adapter.SelectCommand.Parameters.AddWithValue("@CustomerIdentity", obj.CustomerIdentity);
                Adapter.SelectCommand.Parameters.AddWithValue("@ProductIdentity", obj.ProductIdentity);
                Adapter.SelectCommand.Parameters.AddWithValue("@Score", obj.Score);
                if (obj.Comments == null)
                {
                    obj.Comments = "";
                }
                Adapter.SelectCommand.Parameters.AddWithValue("@Comments", obj.Comments);
                Adapter.SelectCommand.CommandTimeout = 30;
                Adapter.Fill(dt);
                nwindConn.Close();

                if (dt == null)
                {
                    return(NotFound());
                }
                return(Ok(dt));
                // return dt;
            }
            catch (Exception ex)
            {
                dt = ConstructError("C#-13", ex);
                return(Ok(dt));
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult GetOrderRows(OrderRow obj)
        {
            DataTable dt = new DataTable();

            try
            {
                nwindConn.Open();
                SqlDataAdapter Adapter = new SqlDataAdapter("EXECUTE Store.[sp_GetOrderRows]", nwindConn);
                Adapter.SelectCommand.CommandTimeout = 30;
                Adapter.Fill(dt);
                nwindConn.Close();

                if (dt == null)
                {
                    return(NotFound());
                }
                return(Ok(dt));
                // return dt;
            }
            catch (Exception ex)
            {
                dt = ConstructError("C#-17", ex);
                return(Ok(dt));
            }
        }
Exemplo n.º 4
0
        public OrderRow CreateShoe(string OrderIdentity, string ProductIdentity, string Productname, string Price, string Discount)//, string Color, string Size, string ImageURL, string Gender)
        {
            OrderRow row = new OrderRow();

            row.OrderIdentity   = OrderIdentity;
            row.ProductIdentity = ProductIdentity;
            row.Productname     = Productname;
            row.Price           = Price;
            row.Discount        = Discount;
            //shoe.Color = Color;
            //shoe.Size = Size;
            //shoe.ImageURL = ImageURL;
            //shoe.Gender = Gender;


            return(row);
        }
Exemplo n.º 5
0
        public IHttpActionResult UpdateOrderRow(OrderRow obj)
        {
            DataTable dt = new DataTable();

            try
            {
                nwindConn.Open();
                SqlDataAdapter Adapter = new SqlDataAdapter("EXECUTE Store.[sp_UpdateOrderRow] @OrderIdentity,@RowIdentity,@StatusIdentity,@Price,@Discount,@Quantity ", nwindConn);
                //   Adapter.SelectCommand.Parameters.AddWithValue("@ResturantId", obj.ResturantId);
                Adapter.SelectCommand.Parameters.AddWithValue("@OrderIdentity", obj.OrderIdentity);
                Adapter.SelectCommand.Parameters.AddWithValue("@RowIdentity", obj.RowIdentity);
                Adapter.SelectCommand.Parameters.AddWithValue("@StatusIdentity", obj.StatusIdentity);
                Adapter.SelectCommand.Parameters.AddWithValue("@Price", obj.Price);
                if (obj.Discount == null)
                {
                    obj.Discount = "0";
                }
                Adapter.SelectCommand.Parameters.AddWithValue("@Discount", obj.Discount);
                Adapter.SelectCommand.Parameters.AddWithValue("@Quantity", obj.Quantity);
                //Adapter.SelectCommand.Parameters.AddWithValue("@RowIdentity", obj.RowIdentity);
                // Adapter.SelectCommand.Parameters.AddWithValue("@Quantity", obj.ResturantId);

                Adapter.SelectCommand.CommandTimeout = 30;
                Adapter.Fill(dt);
                nwindConn.Close();

                if (dt == null)
                {
                    return(NotFound());
                }
                return(Ok(dt));
                // return dt;
            }
            catch (Exception ex)
            {
                dt = ConstructError("C#-18", ex);
                return(Ok(dt));
            }
        }