Ejemplo n.º 1
0
        public bool AddRequestedSeatsToTimeslot(SeatsProcessRequest request)
        {
            var requestTable = new DataTable("TimeslotSeatRequest");

            requestTable.Columns.Add("Row", typeof(int));
            requestTable.Columns.Add("Seat", typeof(int));
            requestTable.Columns.Add("Status", typeof(int));
            foreach (var seatRequest in request.SeatsRequest.AddedSeats)
            {
                requestTable.Rows.Add(seatRequest.Row, seatRequest.Seat, request.SelectedStatus);
            }

            SqlParameter requestTableparameter = new SqlParameter
            {
                ParameterName = "@seatsRequest",
                SqlDbType     = SqlDbType.Structured,
                Value         = requestTable
            };

            var parameters = new[]
            {
                requestTableparameter,
                new SqlParameter("@TimeslotId", request.TimeslotId)
            };

            return(DatabaseUtil.ExecuteNonQuery("AddRequestedSeatsToTimeslot", parameters) != 0);
        }
Ejemplo n.º 2
0
        void WriteValue(string key, KeyValue value)
        {
            string colName = null;

            if (value.IntValue.HasValue)
            {
                colName = "IntValue";
            }
            else if (value.DoubleValue.HasValue)
            {
                colName = "DoubleValue";
            }
            else if (value.BoolValue != null)
            {
                colName = "BoolValue";
            }
            else if (value.StringValue != null)
            {
                colName = "StringValue";
            }
            else
            {
                Debug.Fail("No value in KeyValue");
            }

            var queryParams = CreateQueryParams(key, "@Value", value.Value);

            var cmdText = string.Format(
                "UPDATE KeyValueStore SET {0} = @Value WHERE ExtensionId = @ExtensionId AND [Key] = @Key",
                colName);

            if (DatabaseUtil.ExecuteNonQuery(cmdText, queryParams) == 1)
            {
                return;
            }

            cmdText = string.Format(
                "INSERT INTO KeyValueStore (ExtensionId, [Key], {0}) VALUES (@ExtensionId, @Key, @Value)",
                colName);

            DatabaseUtil.ExecuteNonQuery(cmdText, queryParams);
        }
Ejemplo n.º 3
0
 public void RemoveValue(string key)
 {
     DatabaseUtil.ExecuteNonQuery(
         "DELETE FROM KeyValueStore WHERE ExtensionId = @ExtensionId AND [Key] = @Key",
         CreateQueryParams(key));
 }