public List <SampleCode> ETL(List <SampleCode> Alldata) { List <SampleCode> ret = new List <SampleCode>(); for (int i = 0; i < Alldata.Count; i++) { SampleCode code = Alldata[i].Clone(); foreach (Int32 key in Alldata[i].Data.Keys) { if (_ComponentId.Contains(key) == false) { code.Data.Remove(key); } else { foreach (SampleType key2 in Alldata[i].Data[key].Keys) { if (_DateType.Contains(key2) == false) { code.Data[key].Remove(key2); } } } } ret.Add(code); } return(ret); }
public List <SampleCode> CreateLines() { try { List <JobSection> secs = CreateSection(); if (secs == null) { return(null); } String MacSN = _Machine.MachineSN; if (String.IsNullOrEmpty(MacSN)) { return(null); } List <SampleCode> ret = new List <SampleCode>(); for (int i = 0; i < secs.Count; i++) { JobSection sec = secs[i]; SampleCode code = CreateCode(sec); System.Threading.Thread.Sleep(1); ret.Add(code); } return(ret); } catch (Exception e) { Console.Write("CreateLines" + e.StackTrace); } return(null); }
public static void AddSampleData(DbContextOptions <CompetitionGameContext>?options) { using var context = new CompetitionGameContext(options); var cSharp = new CodingLanguage { Id = 1, Name = "C#" }; context.CodingLanguages.AddRange(new List <CodingLanguage> { cSharp }); var sampleFibonacci = new SampleCode { Id = 1, CodingLanguage = cSharp, Code = @"using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var N = Console.In.ReadLine(); //Your code goes here Console.WriteLine(""Hello, world!""); } } }" }; context.SampleCodes.AddRange(new List <SampleCode> { sampleFibonacci }); var fibonacciTask = new Task { Id = 1, Name = "Simple Fibonacci", Description = "Write a program that based on the given input number (N) returns the N-th number from the Fibonacci's sequence", ExpectedOutput = "6765\r\n", Input = "20", SampleCodes = new List <SampleCode> { sampleFibonacci } }; context.Tasks.AddRange(new List <Task> { fibonacciTask }); context.SaveChanges(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); SampleCode.ReadTxt(); Console.WriteLine("Done"); Console.ReadKey(); }
void Awake() { m_Instance = this; if (nativeLibraryPtr != IntPtr.Zero) { return; } nativeLibraryPtr = Native.LoadLibrary("MarshalSnakeCore.dll"); if (nativeLibraryPtr == IntPtr.Zero) { Debug.LogError("Failed to load native library"); } }
private SampleCode CreateCode(JobSection sec) { SampleCode code = new SampleCode(); code.JobId = sec.JobID; //code.JobId = ""; if (String.IsNullOrEmpty(sec.JobID)) { _SecID = -1; code.SecId = _SecID; } else { code.SecId = ++_SecID; } code.GCodeFile = GetGCodeFileName(); //code.GCodeFile = ""; long tickes = CurrentTime(); code.SampleDate = tickes.ToString(); //code.SampleDate = ""; foreach (Int32 key in sec.SampleDic.Keys) { ComponentSample com = sec.SampleDic[key]; if (com.Configure.Channel == _PGROPChannel.Configure.Channel) { code.ProId = this.GetGCodeFileName(com.SampleData[0]); continue; } else if (com.Configure.Channel == _LINEChannel.Configure.Channel) { code.LineId = com.SampleData[0]; continue; } if (code.Data.Keys.Contains(com.Configure.Component) == false) { Dictionary <SampleType, List <Int32> > list = new Dictionary <SampleType, List <int> >(); code.Data.Add(com.Configure.Component, list); } code.Data[com.Configure.Component].Add(com.Configure.SampleType, com.SampleData); } return(code); }
public void RequestTransaction(SampleCode.CwsTransactionProcessing.TransactionTenderData _transactionTenderData) { //The RequestTransaction() operation allows for the retrieval of any transaction matching the supplied tender data. This is useful in situations //when the application does not receive a response from CWS indicating the TransactionState. List<Response> _Response = new List<Response>(); CheckTokenExpire();//Make sure the current token is valid _Response = Cwsbc.RequestTransaction(_sessionToken, _merchantProfileId, _transactionTenderData); if (_Response != null) { foreach (Response r in _Response) { ResponseDetails RDN = new ResponseDetails(0.00M, r, "", "", _merchantProfileId, true, TypeCardType.NotSet, ""); _message += ProcessResponse(ref RDN);//Pass as reference so we can extract more values from the response } } }
public ActionResult Sample(string samplePath, string controlPath) { Control control = this.ControlRepository.GetControl(controlPath); if (control == null) { throw new HttpException(404, ""); } Sample sample = ViewModelFactory.GetSampleFromTOC(this.TableOfContentsRepository, samplePath, control.PathID, MemoryCache.Default); if (sample == null) { try { sample = this.SampleRepository.GetSample(samplePath, control); } catch (Exception e) { throw new HttpException(500, "", e); } } if (sample == null) { throw new HttpException(404, ""); } /* We don't think this is needed anymore and it is interfearing with the custom error pages. * if (sample == null) * return this.RedirectToRoute("aspnet", new { controller = controlPath, action = samplePath }); */ SampleViewModel model; try { model = ViewModelFactory.CreateSampleViewModel(this.PathHelper, this.TableOfContentsRepository, this.ControlRepository, this.SampleRepository, sample, this.SampleSourceCodeRepository, MemoryCache.Default, new SourceCodeParsingOptions(), this.ApplicationSamplesRepository); } catch (Exception e) { throw new HttpException(500, "", e); } SampleCode code = model.Sample.Code; if (code.IsFile) { var responseHeaders = code.FileResponseHeaders; var headerKeys = responseHeaders.Keys; foreach (string key in headerKeys) { this.Response.AddHeader(key, responseHeaders[key]); } return(File(code.File, "application/octect-stream")); } var request = Config.GetHttpContext().Request; if (request.QueryString["mobileview"] != null && sample.Control.IsJQueryMobile) { return(View("MobileSample", model)); } return(View(model)); }