public bool Order(int id, int duration, int type) { int floor = idToFloor(id); if (floor == 0) { return(false); } using (roib_m13DataContext ctx = new roib_m13DataContext()) { if (!CheckIfAvailable(ctx, type, floor)) { return(false); } usage usage = new usage() { Id = id, Floor = floor, DurationMinutes = duration + 10, Type = type, StartTime = DateTime.UtcNow.ToUnixTime() }; ctx.usages.InsertOnSubmit(usage); ctx.SubmitChanges(); } return(true); }
/// <summary> /// Converts all constant buffers syntax (cbuffer) into a struct with a cbuffer attribute /// Builds a dictionary of constant names so we can replace their simple use by a composition cbufferName.ConstantName instead /// </summary> /// <param name="_Source"></param> /// <returns></returns> private static string ConvertConstantBuffers(string _Source) { int CurrentPosition = 0; while (true) { int CBufferStart = _Source.IndexOf("cbuffer", CurrentPosition, StringComparison.InvariantCultureIgnoreCase); if (CBufferStart == -1) { break; } int BOLIndex = FindBOL(_Source, CBufferStart); int EOLIndex = FindEOL(_Source, CBufferStart); if (IsCommentedLine(_Source, CBufferStart)) { // Skip this line if it's a comment CurrentPosition = CBufferStart + 1; continue; } TODO : get cbuffer name and fields and store into a map to append cbuffer name fo field usage // Replace by a struct with an attribute _Source = _Source.Remove(CBufferStart, "cbuffer".Length); string CBufferAttributePlusStruct = "[cbuffer]\nstruct"; _Source = _Source.Insert(CBufferStart, CBufferAttributePlusStruct); // New position for starting our search... CurrentPosition = CBufferStart + CBufferAttributePlusStruct.Length; } return(_Source); }
this = RenderTargetProperties(type, pixelFormat, dpiX, dpiY, usage, minLevel);