protected override void AddAllFields(Lucene.Net.Documents.Document document, Data.Items.Item item, bool versionSpecific) { base.AddAllFields(document, item, versionSpecific); if (item != null && document != null) { #if SC70 var fieldAnalysis = Field.Index.ANALYZED; #else var fieldAnalysis = Field.Index.TOKENIZED; #endif // Sitecore 6.2 does not include template document.Add(new Field(Constants.Index.Fields.Template, TransformValue(item.TemplateID), Field.Store.NO, fieldAnalysis)); // Add multilist fields foreach (var fieldName in m_multilistFields) { if(item.Fields[fieldName] != null) document.Add(new Field(fieldName, TransformMultilistValue(item.Fields[fieldName]), Field.Store.YES, fieldAnalysis)); } // Add additional fields foreach (var fieldName in m_dataFieldNames) { if (item.Fields[fieldName] != null) { document.Add(new Field(fieldName, TransformCSV(item.Fields[fieldName].Value), Field.Store.YES, fieldAnalysis)); } } // Add modified language code to deal with dash in region specific languages document.Add(new Field(Constants.Index.Fields.Language, TransformLanguageCode(item.Language.Name), Field.Store.NO, fieldAnalysis)); } }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.Short ? (data as Data.Short).Value : data is Data.Binary ? BitConverter.ToInt16((data as Data.Binary).Value, 0) : data is Data.String ? short.Parse((data as Data.String).Value, System.Globalization.CultureInfo.InvariantCulture.NumberFormat) : (short)0; }
public UCNhanVien(Data.Transit transit) { InitializeComponent(); mTransit = transit; BONhanVien = new Data.BONhanVien(transit); PhanQuyen(); }
public AbilityEntry(Data.AbilityEntry Entry) { this.Index = Entry.Index; this.Note = Entry.Note; this.Pokemon = Entry.Pokemon.Name; this.Ability = Entry.Ability.Name; }
public void AddMethod(MethodParamResult inMethod,Data.Inputs.Interfaces.IEventInput input) { MethodParamPair pair = new MethodParamPair(inMethod, input); _methods.AddLast(pair); if (_current == null) _current = _methods.First; }
/// <summary> /// The Accumulation/Distribution (AD) study attempts to quantify the amount of volume flowing into or out of an instrument by identifying the position of the close of the period in relation to that period�s high/low range. /// </summary> /// <returns></returns> public ADL ADL(Data.IDataSeries input) { if (cacheADL != null) for (int idx = 0; idx < cacheADL.Length; idx++) if (cacheADL[idx].EqualsInput(input)) return cacheADL[idx]; lock (checkADL) { if (cacheADL != null) for (int idx = 0; idx < cacheADL.Length; idx++) if (cacheADL[idx].EqualsInput(input)) return cacheADL[idx]; ADL indicator = new ADL(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; Indicators.Add(indicator); indicator.SetUp(); ADL[] tmp = new ADL[cacheADL == null ? 1 : cacheADL.Length + 1]; if (cacheADL != null) cacheADL.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheADL = tmp; return indicator; } }
/* * Corey Paxton - 4/5/2014 - Initial Version */ public override void Entered(StateControl from, Data.User user, Data.User returnUser) { base.Entered(from, user, returnUser); this.txt_currentName.Text = user.Name; this.txt_newName.Text = user.Name; ddl_groups.DataSource = Data.GroupList.Instance; if (this.CurrentUser.Status == Data.User.UserType.Teacher) { // Hide group stuff, but display the password stuff lbl_group.Visible = false; ddl_groups.Visible = false; lbl_newPassword.Visible = true; lbl_newPasswordConfirm.Visible = true; txt_newPassword.Visible = true; txt_newPasswordConfirm.Visible = true; } else if (this.CurrentUser.Status == Data.User.UserType.Student) { // Display group stuff, hide password lbl_group.Visible = true; ddl_groups.Visible = true; lbl_newPassword.Visible = false; lbl_newPasswordConfirm.Visible = false; txt_newPassword.Visible = false; txt_newPasswordConfirm.Visible = false; if(this.CurrentUser.GroupName != null) ddl_groups.SelectedItem = Data.GroupList.Instance.GetByName(this.CurrentUser.GroupName); } }
public void Create_Message(Data data, Dictionary<string, object> headers) { var factory = Create(); var test = factory.Create(data, headers); Assert.Equal(test.Body, data); Assert.Equal(test.Headers, headers); }
protected void DeleteEventAction(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); if (Request.QueryString["O"] != null) { if (Request.QueryString["U"] != null) { dat.Execute("DELETE FROM User_GroupEvent_Calendar WHERE UserID=" + Session["User"].ToString() + " AND GroupEventID=" + Request.QueryString["ID"].ToString() + " AND ReoccurrID=" + Request.QueryString["O"].ToString()); } else { dat.Execute("DELETE FROM GroupEvent_Members WHERE UserID=" + Session["User"].ToString() + " AND GroupEventID=" + Request.QueryString["ID"].ToString() + " AND ReoccurrID=" + Request.QueryString["O"].ToString()); } } else { dat.Execute("DELETE FROM User_Calendar WHERE UserID=" + Session["User"].ToString() + " AND EventID=" + Request.QueryString["ID"].ToString()); } RemovePanel.Visible = false; ThankYouPanel.Visible = true; }
private void CreateBitmapContexts(Data data) { m_bitmapContexts = new BitmapContext[data.bitmaps.Length]; for (int i = 0; i < data.bitmaps.Length; ++i) { Format.Bitmap bitmap = data.bitmaps[i]; // Ignore null texture if (bitmap.textureFragmentId == -1) continue; int bitmapExId = -i - 1; Format.BitmapEx bitmapEx = new Format.BitmapEx(); bitmapEx.matrixId = bitmap.matrixId; bitmapEx.textureFragmentId = bitmap.textureFragmentId; bitmapEx.u = 0; bitmapEx.v = 0; bitmapEx.w = 1; bitmapEx.h = 1; m_bitmapContexts[i] = new BitmapContext(this, data, bitmapEx, bitmapExId); } m_bitmapExContexts = new BitmapContext[data.bitmapExs.Length]; for (int i = 0; i < data.bitmapExs.Length; ++i) { Format.BitmapEx bitmapEx = data.bitmapExs[i]; // Ignore null texture if (bitmapEx.textureFragmentId == -1) continue; m_bitmapExContexts[i] = new BitmapContext(this, data, bitmapEx, i); } }
static void InitGPIO(this MainPage page, Data data) { GpioController gpio = GpioController.GetDefault(); page.GpioPinInfo.Text = "Led pin: " + Data.LED_PIN.ToString(); // Show an error if there is no GPIO controller if (gpio == null) { data.pin = null; page.GpioStatus.Text = "There is no GPIO controller on this device."; return; } data.pin = gpio.OpenPin(Data.LED_PIN); GpioPin pin = data.pin; data.pinValue = GpioPinValue.High; pin.Write(data.pinValue); pin.SetDriveMode(GpioPinDriveMode.Output); page.GpioStatus.Text = "GPIO pin initialized correctly."; var timer = data.Timer; if (pin != null) { timer.Start(); } }
//Chris Han add DeviceId to Json public async Task<DataSet> Process(DataSet dataset, CancellationToken ct, string DeviceId) { #if AggravatedSerialization //Serialize the whole dataset as single json string var json = await Task.Factory.StartNew( new Func<object, string>(JsonConvert.SerializeObject), dataset, ct); var data = new Data(); data.Add("stringContent", json); var output = new DataSet(); output.Add(data); return output; #else //Serialize each data as one json string foreach (var data in dataset) { data["DeviceId"] = DeviceId;//Chris han add DeviceId to Json var json = await Task.Factory.StartNew( new Func<object, string>(JsonConvert.SerializeObject), data, ct); data.Add("stringContent", json); } return dataset; #endif }
/// <summary> /// the data loader for openquant. /// </summary> /// <param name="instrument">The instrument.</param> /// <param name="dtfrom">The dtfrom.</param> /// <param name="dtto">The dtto.</param> /// <param name="barsize">The barsize.</param> /// <returns></returns> public static LoaderTypes OpenquantDataLoader(string instrument, DateTime dtfrom, DateTime dtto, Data.Data.BarType bartype, long barsize) { var BarSerie = new DataArray(); Console.WriteLine("Initialized the Openquant-Encog Loader"); try { // BarSerie = this.GetHistoricalBars(dtfrom, dtto, BarType.Time, barsize); // BarSerie = this.GetHistoricalBars(this.MarketDataProvider,Instrument,dtfrom,dtto,(int)barsize); // BarSerie = DataManager.GetHistoricalBars(instrument, Data.Data.BarType.Time, 3600); var typeLoaded = new LoaderTypes(instrument, dtfrom, dtto, bartype, barsize); Console.WriteLine("Loaded Types instrument:" + typeLoaded.Instrument); return typeLoaded; } catch (Exception ex) { var er = new EncogError(ex); Console.WriteLine("Error :" + ex.Message); Console.WriteLine("Error :" + ex.StackTrace); Console.WriteLine("Error:" + ex.InnerException); Console.WriteLine("Full message:" + ex); return null; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); if (Session["User"] == null) { Response.Redirect("~/Home.aspx"); } if (Request.QueryString["ID"] == null) Response.Redirect("Home.aspx"); if (dat.HasEventPassed(Request.QueryString["ID"].ToString())) { DataView dvName = dat.GetDataDV("SELECT * FROM Events WHERE ID="+ Request.QueryString["ID"].ToString()); Response.Redirect(dat.MakeNiceName(dvName[0]["Header"].ToString()) + "_" + Request.QueryString["ID"].ToString() + "_Event"); } }
public UploadContent(IDatabase db, Data.Version version, int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize) : base(sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize) { _db = db; _version = version; }
public TEditSidebar(Word.Document WordDoc) { InitializeComponent(); AxiomIRISRibbon.Utility.setTheme(this); this.tabDebug.Visibility = System.Windows.Visibility.Hidden; if (Globals.ThisAddIn.getDebug()) { this.tabDebug.Visibility = System.Windows.Visibility.Visible; } this.D = Globals.ThisAddIn.getData(); this.Doc = WordDoc; // Initiatlise the tables to hold the XML this.DTClauseXML = new DataTable(); this.DTClauseXML.TableName = "ClauseXML"; this.DTClauseXML.Columns.Add(new DataColumn("Id", typeof(String))); this.DTClauseXML.Columns.Add(new DataColumn("XML", typeof(String))); this.CurrentConceptId = ""; this.CurrentClauseId = ""; this.CurrentElementId = ""; this.RefreshConceptList(); this.GetDropDowns(); this.ClauseLock = true; this.ForceRereshClauseXML = false; }
public void Download(Data.RemoteServer _data, string _localFile, string _remoteFile) { this.data = _data; this.remoteFile = _remoteFile; this.localFile = _localFile; string[] files = Utils.Ftp.directoryListDetailed(data, remoteFile.Substring(0, remoteFile.LastIndexOf("/")) + "/"); foreach(string elem in files) { string[] splitted = elem.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (splitted.Length >= 9) { string name = ""; for (int i = 8; i < splitted.Length; i++) { name += splitted[i] + " "; } name = Utils.Strings.CutLastChars(name, 1); if (name == Path.GetFileName(remoteFile)) this.fileSize = long.Parse(splitted[4]); } } if (this.fileSize > 65536) { worker.RunWorkerAsync(); this.ShowDialog(); } else { worker_DoWork(null, null); } }
public void Can_call_methods_on_wrapped_instance() { var data = new Data() { Id = 42, Name = "Everything" }; var data2 = Freezer.AsFreezable(data); Assert.IsTrue(data2.IsA<Freezer.IFreezableWrapper>()); AssertSameValue(data, data2); }
public void Can_detect_wrapped_instances() { var data = new Data() { Id = 42, Name = "Everything" }; Assert.IsFalse(Freezer.IsFreezable(data)); var data2 = Freezer.AsFreezable(data); Assert.IsTrue(Freezer.IsFreezable(data2)); }
public static Boolean IsEmailUsed(String email, Data.Model.User user = null) { using (UpsilabEntities context = new UpsilabEntities()) { if (user != null) { var existingUser = context.User.Where(u => u.UserEmail == email && !u.IsDeleted).FirstOrDefault(); if (existingUser != null) { if (user.idUser == existingUser.idUser) return false; else return true; } else return false; } else { var existingUser = context.User.Where(u => u.UserEmail == email && !u.IsDeleted).FirstOrDefault(); if (existingUser != null) return true; else return false; } } }
protected void AddAgendaItem(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["BrowserDate"]; if (cookie == null) { cookie = new HttpCookie("BrowserDate"); cookie.Value = DateTime.Now.ToString(); cookie.Expires = DateTime.Now.AddDays(22); Response.Cookies.Add(cookie); } Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); AgendaItemTextBox.Text = dat.stripHTML(AgendaItemTextBox.Text.Trim()); AgendaDescriptionTextBox.Text = dat.stripHTML(AgendaDescriptionTextBox.Text.Trim()); if (AgendaItemTextBox.Text.Trim() != "") { AgendaLiteral.Text += "<div style=\"padding: 0px; padding-bottom: 3px;\" class=\"AddLink\">" + dat.BreakUpString(AgendaItemTextBox.Text.Trim(), 44) + "</div>"; if (AgendaDescriptionTextBox.Text.Trim() != "") { AgendaLiteral.Text += "<div style=\"padding: 0px; padding-left: 20px; padding-bottom: 3px; color: #cccccc; font-family: arial; font-size: 11px;\">" + dat.BreakUpString(AgendaDescriptionTextBox.Text.Trim(), 44) + "</div>"; } } else { AgendaErrorLabel.Text = "Must include the item title."; } }
/// <summary> /// add the texture to the game object and his child /// </summary> public void AddTexture() { normal = Shader.Find("Diffuse"); transparent = Shader.Find("Transparent/Diffuse"); data = ToolBox.Instance.data; if (fileName != null && data.mtl.ContainsKey(fileName)) { ReadMtl(data.mtl[fileName]); foreach (KeyValuePair<string, string> mat in matNameFile) { if (meshes.ContainsKey(mat.Key)) { Material material; if (matNameColor[mat.Key].a < 1) { material = new Material(transparent); } else { material = new Material(normal); } material.color = matNameColor[mat.Key]; if (data.textures.ContainsKey(mat.Value)) { material.mainTexture = data.textures[mat.Value]; } foreach (GameObject g in meshes[mat.Key]) { g.GetComponent<Renderer>().material = material; } } } } }
private static bool CheckAgencyPropertyExists(Property agencyProperty, Data.Models.Property databasePropertyDto) { IPropertyMatcherFactory factory = new PropertyMatcherFactory(); IPropertyMatcher propertyMatcher = factory.GetPropertyMatcher(agencyProperty.AgencyCode); return propertyMatcher.IsMatch(agencyProperty, Mapper.Map<Property>(databasePropertyDto)); }
// Used to populate the board in a networked game public Board(Data data) { Width = data.Width; Height = data.Height; SetColors(data.Colors); floodFiller = new FloodFiller(colors); }
public object Deserialize(IStorage storage, Data.Node data, object result) { return data is Data.DateTime ? (data as Data.DateTime).Value : data is Data.Binary ? new System.DateTime(BitConverter.ToInt64((data as Data.Binary).Value, 0)) : data is Data.String ? System.DateTime.Parse((data as Data.String).Value) : new System.DateTime(); }
public object Deserialize(IStorage storage, Data.Node data, object result) { Kean.Collection.IList<Data.Node> nodes; Reflect.Type type; Reflect.Type elementType; type = data.Type; elementType = this.GetElementType(type); if (data is Data.Collection) nodes = (data as Data.Collection).Nodes; else { // only one element so it was impossible to know it was a collection nodes = new Kean.Collection.List<Data.Node>(data); data.Type = data.OriginalType ?? elementType; Uri.Locator locator = data.Locator.Copy(); locator.Fragment += "0"; data.Locator = locator; } if (result.IsNull()) result = this.Create(type, elementType, nodes.Count); int i = 0; foreach (Data.Node child in nodes) { int c = i++; // ensure c is unique in every closure of lambda function below storage.Deserialize(child, elementType, d => this.Set(result, d, c)); } return result; }
public string GenerateGraphBody(string id, Data[] data, string[] tick_label) { string ret = ""; ret += "<div id=\"" + id + "\"></div>\n"; ret += "<script>\n"; ret += "(function basic_radar(container) {\n"; for (int x = 0; x < data.GetLength(0); x++) { ret += "var s" + x + " = { label : '" + data[x].label + "', data : ["; for (int y = 0; y < data[x].data.GetLength(0); y++) { if (y != 0) { ret += ","; } ret += "[" + y + "," + data[x].data[y] + "]"; } ret += "]};"; } ret += "var ticks = [\n"; for (int i = 0; i < tick_label.Length; i++) { if (i != 0) { ret += ","; } ret += "[" + i + ", \"" + tick_label[i] + "\"]\n"; } ret += "]\n"; ret += "graph = Flotr.draw(container,["; for (int x = 0; x < data.GetLength(0); x++) { if (x != 0) { ret += ","; } ret += "s" + x; } ret += "], {\n"; ret += "radar : { show : true}, \n"; ret += "grid : { circular : true, minorHorizontalLines : true}, \n"; ret += "yaxis : { min : " + m_min + ", max : " + m_max + ", minorTickFreq : 2}, \n"; ret += "xaxis : { ticks : ticks},\n"; ret += "mouse : { track : true}\n"; ret += "});\n"; ret += "})(document.getElementById(\"" + id + "\"));\n"; ret += "</script>\n"; return ret; }
protected override void Fire(object sender, EventArgs e) { if (!UserInfo.isDoctor(Session)) { alertAndGoback("you are not a doctor. Please login"); return; } String today = DateTime.Now.Date.ToString().Substring(0, 10); DOS.Text = today; UserID.Text = Param.getString("pId"); Data result = new Data(); DBC dbc = new DBC(); Data data = new Data(); /*dbc.open(); data.add("pID", Param.get("pId")); result = dbc.select("SELECT * FROM Users WHERE UserID = @pId", data); dbc.close();*/ SurgeryBiz biz = new SurgeryBiz(); biz.view(data); userNameLabel.Text = Param.getString("pId"); type.DataSource = biz.getType(data).Source; type.DataBind(); }
public override void Entered(StateControl from, Data.User user, Data.User returnUser) { base.Entered(from, user, returnUser); txt_newName.Text = string.Empty; txt_oldName.Text = string.Empty; dtg_ungrouped_users.DataSource = Data.UserList.Instance.ApplyGroupFilter("Ungrouped Users"); }
public int SendIt(string msgText, string userName, string userID, string eventName, string[] idArray, string msgBody) { HttpCookie cookie = Request.Cookies["BrowserDate"]; Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"))); DataSet dsUser; for (int i = 0; i < idArray.Length; i++) { SqlConnection conn = dat.GET_CONNECTED; SqlCommand cmd = new SqlCommand("INSERT INTO UserMessages (MessageContent, MessageSubject, From_UserID, To_UserID, Date, [Read], Mode)" + " VALUES(@content, @subject, @fromID, @toID, @date, 'False', 0)", conn); cmd.Parameters.Add("@content", SqlDbType.Text).Value = msgText + "<br/><br/>"+msgBody; cmd.Parameters.Add("@subject", SqlDbType.NVarChar).Value = userName + " wants you to check out event " + eventName; cmd.Parameters.Add("@toID", SqlDbType.Int).Value = int.Parse(idArray[i]); cmd.Parameters.Add("@fromID", SqlDbType.Int).Value = int.Parse(userID); cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")); cmd.ExecuteNonQuery(); conn.Close(); dsUser = dat.GetData("SELECT * FROM Users WHERE User_ID=" + idArray[i]); dat.SendEmail(System.Configuration.ConfigurationManager.AppSettings["emailemail"].ToString(), System.Configuration.ConfigurationManager.AppSettings["emailName"].ToString(), dsUser.Tables[0].Rows[0]["Email"].ToString(), "<div><br/>A new email arrived at your inbox on Hippo Happenings. <br/><br/> Email Contents:<br/><br/>Subject: " + userName + " wants you to check out event " + eventName + "<br/><br/>Message Body: " + msgText + "<br/><br/>" + msgBody + "<br/><br/> To view the message, <a href=\"HippoHappenings.com/login\">" + "log into Hippo Happenings</a></div>", "You have a new email at Hippo Happenings!"); MessageLabel2.Text = "Your message has been sent."; ThankYouPanel.Visible = true; MessagePanel.Visible = false; } return 0; }
/// <summary> /// フックイベント /// </summary> /// <param name="state"></param> private void MouseHookProcedure(ref GlobalHook_Mouse.MouseState state) { if (state.button != GlobalHook_Mouse.MouseButton.Left) { return; } if (state.action != GlobalHook_Mouse.MouseAction.Down) { return; } GlobalHook_Mouse.IsPaused = true; try { int x = state.x; int y = state.y; bool visible = false; int left = 0; int top = 0; int width = 0; int height = 0; object target = null; if (this.useAutomationElement) { var element = this.FindAutomationElement(x, y); if (null != element) { visible = true; var rect = element.Current.BoundingRectangle; left = (int)rect.Left; top = (int)rect.Top; width = (int)rect.Width; height = (int)rect.Height; target = element.Current; } } else { var handle = this.FindHandle(x, y); if (IntPtr.Zero != handle) { var rect = new Win32.Rect(); bool result = true; result &= Win32.GetWindowRect(handle, out rect); if (result) { visible = true; left = rect.Left; top = rect.Top; width = rect.Width; height = rect.Height; } var length = Win32.GetWindowTextLength(handle); var title = new string('\0', length + 1); result &= 0 != Win32.GetWindowText(handle, title, title.Length); if (result) { target = new Data(title, new Rectangle(rect.Location, rect.Size)); } } } this.Invoke((MethodInvoker) delegate { this.ChangeTarget(visible, left, top, width, height, target); }); } finally { GlobalHook_Mouse.IsPaused = false; } }
public void add(Data data) { lankList.Add(data); lankList.Sort((a, b) => (a.time - b.time)); lankList.Remove(lankList[5]); }
public ActionResult _Grafico(EnumTipoGrafico tipoGrafico, EnumTipoReporteGrafico tipoReporteGrafico) { DashboardDAO dao = new DashboardDAO(); Notificacion <Grafico> grafico = new Notificacion <Grafico>(); if ((tipoGrafico == EnumTipoGrafico.EntradasPorFecha) || (tipoGrafico == EnumTipoGrafico.SalidasPorFecha)) { //Notificacion<List<Estacion>> estaciones = dao.ObtenerVentasEstacion(); Notificacion <List <Categoria> > categorias = dao.ObtenerEntradasSalidasPorFecha(tipoReporteGrafico, tipoGrafico); grafico.Estatus = categorias.Estatus; grafico.Mensaje = categorias.Mensaje; List <Data> dataProductos = new List <Data>(); List <seriesDrilldown> SeriesDrilldown = new List <seriesDrilldown>(); if (categorias.Estatus == 200) { foreach (Categoria categoria in categorias.Modelo) { Data data = new Data(); data.name = categoria.categoria; data.y = categoria.total; Notificacion <List <Categoria> > productos = dao.ObtenerEntradasSalidasPorProducto(categoria.fechaIni, categoria.fechaFin, tipoReporteGrafico, tipoGrafico); if (productos.Estatus == 200) { List <List <Object> > DataDrilldown = new List <List <Object> >(); foreach (Categoria e in productos.Modelo) { DataDrilldown.Add(new List <Object>() { e.categoria.ToString(), e.total }); } SeriesDrilldown.Add(new seriesDrilldown() { id = categoria.id + "_" + categoria.categoria, name = categoria.categoria, data = DataDrilldown }); } data.drilldown = categoria.id + "_" + categoria.categoria; dataProductos.Add(data); } grafico.Modelo = new Grafico(); if (dataProductos.Count > 0) { grafico.Estatus = 200; grafico.Modelo.data = dataProductos; grafico.Modelo.seriesDrilldowns = SeriesDrilldown; } else { grafico.Estatus = -1; grafico.Mensaje = "No existe información para mostrar"; } } } if (tipoGrafico == EnumTipoGrafico.TopTenProductosEntrantes || tipoGrafico == EnumTipoGrafico.TopTenProductosSalientes) { Notificacion <List <Categoria> > categorias = dao.ObtenerTopTen(tipoReporteGrafico, tipoGrafico); grafico.Estatus = categorias.Estatus; grafico.Mensaje = categorias.Mensaje; if (categorias.Estatus == 200) { grafico.Modelo = new Grafico(); grafico.Modelo.data = new List <Data>(); //grafico.Modelo.categorias = categorias.Modelo; foreach (Categoria categoria in categorias.Modelo) { Data data = new Data(); data.name = categoria.categoria; data.y = categoria.total; grafico.Modelo.data.Add(data); } } } ViewBag.tipoGrafico = tipoGrafico; ViewBag.tipoReporteGrafico = tipoReporteGrafico; return(PartialView(grafico)); }
public override int GetHashCode() { return(Data.GetHashCode()); }
public DataTests() { fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>()); data = new Data(fileSystem, dataDirectory); }
internal void Invoke(params object[] obj) { Data.Invoke(obj); }
/// <summary> /// 加载xml /// </summary> /// <param name="p_reader"></param> public void ReadXml(XmlReader p_reader) { Data.ReadXml(p_reader); p_reader.Read(); }
public void CmdPlayerMessage(Data data) { this._data = data; }
private Task <Chart> GenerateChartTask(List <string> paramsList) { var generateChartTask = Task.Run(() => { if (!_context.SimulationWorkschedules.Any()) { return(null); } SimulationType simType = (paramsList[1].Equals("Decentral")) ? SimulationType.Decentral : SimulationType.Central; Chart chart = new Chart { Type = "bar" }; // charttype // use available hight in Chart // use available hight in Chart var machines = _context.Kpis.Where(x => x.SimulationConfigurationId == Convert.ToInt32(paramsList[0]) && x.SimulationType == simType && x.KpiType == KpiType.MachineUtilization && x.IsKpi && x.IsFinal && x.SimulationNumber == Convert.ToInt32(paramsList[2])) .OrderByDescending(g => g.Name) .ToList(); var data = new Data { Labels = machines.Select(n => n.Name).ToList() }; // create Dataset for each Lable data.Datasets = new List <Dataset>(); var i = 0; var cc = new ChartColor(); //var max = _context.SimulationWorkschedules.Max(x => x.End) - 1440; var barDataSet = new BarDataset { Data = new List <double>(), BackgroundColor = new List <string>(), HoverBackgroundColor = new List <string>(), YAxisID = "y-normal" }; var barDiversityInvisSet = new BarDataset { Data = new List <double>(), BackgroundColor = new List <string>(), HoverBackgroundColor = new List <string>(), YAxisID = "y-diversity" }; var barDiversitySet = new BarDataset { Data = new List <double>(), BackgroundColor = new List <string>(), HoverBackgroundColor = new List <string>(), YAxisID = "y-diversity" }; foreach (var machine in machines) { var percent = Math.Round(machine.Value * 100, 2); // var wait = max - work; barDataSet.Data.Add(percent); barDataSet.BackgroundColor.Add(cc.Color[i].Substring(0, cc.Color[i].Length - 4) + "0.4)"); barDataSet.HoverBackgroundColor.Add(cc.Color[i].Substring(0, cc.Color[i].Length - 4) + "0.7)"); var varianz = machine.Count * 100; barDiversityInvisSet.Data.Add(percent - Math.Round(varianz / 2, 2)); barDiversityInvisSet.BackgroundColor.Add(ChartColor.Transparent); barDiversityInvisSet.HoverBackgroundColor.Add(ChartColor.Transparent); barDiversitySet.Data.Add(Math.Round(varianz, 2)); barDiversitySet.BackgroundColor.Add(cc.Color[i].Substring(0, cc.Color[i].Length - 4) + "0.8)"); barDiversitySet.HoverBackgroundColor.Add(cc.Color[i].Substring(0, cc.Color[i].Length - 4) + "1)"); i++; } data.Datasets.Add(barDataSet); data.Datasets.Add(barDiversityInvisSet); data.Datasets.Add(barDiversitySet); chart.Data = data; // Specifie xy Axis var xAxis = new List <Scale>() { new CartesianScale { Stacked = true, Id = "x-normal", Display = true } }; var yAxis = new List <Scale>() { new CartesianScale { Stacked = true, Display = true, Ticks = new CartesianLinearTick { BeginAtZero = true, Min = 0, Max = 100 }, Id = "y-normal" }, new CartesianScale { Stacked = true, Ticks = new CartesianLinearTick { BeginAtZero = true, Min = 0, Max = 100 }, Display = false, Id = "y-diversity", ScaleLabel = new ScaleLabel { LabelString = "Value in %", Display = false, FontSize = 12 }, }, }; //var yAxis = new List<Scale>() { new BarScale{ Ticks = new CategoryTick { Min = "0", Max = (yMaxScale * 1.1).ToString() } } }; chart.Options = new Options() { Scales = new Scales { XAxes = xAxis, YAxes = yAxis }, MaintainAspectRatio = false, Responsive = true, Title = new Title { Text = "Machine Workloads", Position = "top", FontSize = 24, FontStyle = "bold", Display = true }, Legend = new Legend { Position = "bottom", Display = false } }; return(chart); }); return(generateChartTask); }
private void dataChanged(Data data) { _data = data; refresh(); }
/// <summary> /// Initializes a new instance of the <see cref="ResourcePackData"/> class. /// </summary> /// <param name="Row">The row.</param> /// <param name="DataTable">The data table.</param> public ResourcePackData(Row Row, DataTable DataTable) : base(Row, DataTable) { Data.Load(this, this.GetType(), Row); }
private void InitConstants(int _level) { data = new Data(JsonFilePath, _level); }
public bool GetTariffTimeTable(long lTariff, long dayType, COPSDate dtOper, long numDaysPassed, IMT_TimeTables timetables, bool considerCloseInterval, out Tariffs outTariff, out Timetables outTimetable) { trace.Write(TraceLevel.Debug, "IMT_Tariffs::GetTariffTimeTable"); bool fnResult = true; outTariff = null; outTimetable = null; try { Guard.IsNull(dtOper, nameof(dtOper)); int totalMinutes = dtOper.TimeToMinutes(); trace.Write(TraceLevel.Info, $@"QUERY: Which are the Time Table, Init Hour, End Hour for the Tariff({lTariff}) at this Hour({totalMinutes/60:D2}:{totalMinutes%60:D2}) for Day({dayType})?"); IEnumerable <Tariffs> tariffs = Data.Where(w => w.TAR_ID == lTariff && w.TAR_DDAY_ID == dayType && (w.TAR_INIDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_INIDATE <= dtOper) && (w.TAR_ENDDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_ENDDATE > dtOper) ); bool timtableHasBeenFound = false; if (tariffs.Any()) { bool bApplyTariff = false; foreach (Tariffs tariff in tariffs) { if (numDaysPassed != GlobalDefs.DEF_UNDEFINED_VALUE) { bApplyTariff = (tariff.TAR_NUMDAYS_PASSED.HasValue && tariff.TAR_NUMDAYS_PASSED.Value == numDaysPassed); } else { bApplyTariff = !tariff.TAR_NUMDAYS_PASSED.HasValue; } if (bApplyTariff) { Timetables foundTimeTable = timetables.GetIniEndFromTimId(tariff.TAR_TIM_ID.Value); trace.Write(TraceLevel.Info, $"Minutes ({totalMinutes:D2}) TimTabIni ({foundTimeTable.TIM_INI:D2}) TimTabEnd ({foundTimeTable.TIM_END:D2})"); bool getTimetable = false; if (considerCloseInterval) { getTimetable = totalMinutes <= foundTimeTable.TIM_END && totalMinutes >= foundTimeTable.TIM_INI; } else { getTimetable = totalMinutes < foundTimeTable.TIM_END && totalMinutes >= foundTimeTable.TIM_INI; } if (getTimetable) { trace.Write(TraceLevel.Info, $"Interval Found Minutes {totalMinutes/60:D2}:{totalMinutes%60:D2} < {foundTimeTable.TIM_INI/60:D2}:{foundTimeTable.TIM_INI % 60:D2}"); outTariff = tariff; outTimetable = foundTimeTable; timtableHasBeenFound = true; break; } } } } } catch (Exception error) { trace.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
private Task <Chart> GenerateChartTaskOverTime(List <string> paramsList) { var generateChartTask = Task.Run(() => { if (!_context.SimulationWorkschedules.Any()) { return(null); } SimulationType simType = (paramsList[1].Equals("Decentral")) ? SimulationType.Decentral : SimulationType.Central; Chart chart = new Chart { Type = "scatter" }; // charttype var cc = new ChartColor(); // use available hight in Chart // use available hight in Chart var machinesKpi = _context.Kpis.Where(x => x.SimulationConfigurationId == Convert.ToInt32(paramsList[0]) && x.SimulationType == simType && x.KpiType == KpiType.MachineUtilization && !x.IsKpi && !x.IsFinal && x.SimulationNumber == Convert.ToInt32(paramsList[2])) .ToList(); var settlingTime = _context.SimulationConfigurations.First(x => x.Id == Convert.ToInt32(paramsList[0])).SettlingStart; var machines = machinesKpi.Select(n => n.Name).Distinct().ToList(); var data = new Data { Labels = machines }; // create Dataset for each Lable data.Datasets = new List <Dataset>(); var i = 0; foreach (var machine in machines) { // add zero to start var kpis = new List <LineScatterData> { new LineScatterData { x = "0", y = "0" } }; kpis.AddRange(machinesKpi.Where(x => x.Name == machine).OrderBy(x => x.Time) .Select(x => new LineScatterData { x = x.Time.ToString(), y = (x.Value * 100).ToString() }).ToList()); var lds = new LineScatterDataset() { Data = kpis, BorderWidth = 2, Label = machine, ShowLine = true, Fill = "false", BackgroundColor = cc.Color[i], BorderColor = cc.Color[i++], LineTension = 0 }; data.Datasets.Add(lds); } data.Datasets.Add(new LineScatterDataset() { Data = new List <LineScatterData> { new LineScatterData { x = "0", y = "100" }, new LineScatterData { x = Convert.ToDouble(settlingTime).ToString(), y = "100" } }, BorderWidth = 1, Label = "Settling time", BackgroundColor = "rgba(0, 0, 0, 0.1)", BorderColor = "rgba(0, 0, 0, 0.3)", ShowLine = true, //Fill = true, //SteppedLine = false, LineTension = 0, PointRadius = new List <int> { 0, 0 } }); chart.Data = data; // Specifie xy Axis var xAxis = new List <Scale>() { new CartesianScale { Stacked = false, Display = true } }; var yAxis = new List <Scale>() { new CartesianScale() { Stacked = false, Ticks = new CartesianLinearTick { BeginAtZero = true, Min = 0, Max = 100 }, Display = true, Id = "first-y-axis", Type = "linear", ScaleLabel = new ScaleLabel { LabelString = "Value in %", Display = true, FontSize = 12 }, } }; //var yAxis = new List<Scale>() { new BarScale{ Ticks = new CategoryTick { Min = "0", Max = (yMaxScale * 1.1).ToString() } } }; chart.Options = new Options() { Scales = new Scales { XAxes = xAxis, YAxes = yAxis }, Responsive = true, MaintainAspectRatio = true, Legend = new Legend { Position = "bottom", Display = true, FullWidth = true }, Title = new Title { Text = "Machine Workload over Time", Position = "top", FontSize = 24, FontStyle = "bold", Display = true } }; return(chart); }); return(generateChartTask); }
public override void Handle(PlayerControl innerNetObject, Data data) { Plugin.Log.LogWarning($"{innerNetObject.Data.PlayerId} sent byte {data.SnitchId}"); RoleInfo.SnitchId = data.SnitchId; }
public static vector QrGsSolve(Data data, vector b) { b = data.Q.transpose()*b; var y = BackSub(data.R, b); return y; }
public override void Write(MessageWriter writer, Data data) { writer.Write(data.JesterId); }
internal static bool Equals(Data @this, Data other) => @this.ReadOnlyValue == other.Value; // Extension method.
public override void Write(MessageWriter writer, Data data) { writer.Write(data.WitnessId); }
public override void Write(MessageWriter writer, Data data) { writer.Write(data.SnitchId); }
private string ProcessRequest(HttpListenerContext context) { string result = null; try { string path = context.Request.Url.AbsolutePath; if (!string.IsNullOrEmpty(path) && path.Length > 1) { // Remove beginning forward slash path = path.Substring(1); path = path.Substring("api/".Length); // Split path by forward slashes var paths = path.Split('/'); if (paths.Length > 1 && paths[0] != "/" && !string.IsNullOrEmpty(paths[0])) { switch (paths[0].ToLower()) { case "data": // Remove 'data' from path path = path.Substring(paths[0].Length); // Remove first forward slash path = path.TrimStart('/'); // Process the Data Request and return response if (context.Request.HttpMethod == "GET") { paths = path.Split('/'); if (paths.Length > 0) { switch (paths[0].ToLower()) { case "get": result = Data.Get(context.Request.Url.ToString()); break; } } } else if (context.Request.HttpMethod == "POST") { paths = path.Split('/'); if (paths.Length > 0) { switch (paths[0].ToLower()) { case "update": result = Data.Update(context); break; } } } else { result = "Incorrect REQUEST METHOD"; } break; case "devices": // Remove 'data' from path path = path.Substring(paths[0].Length); // Remove first forward slash path = path.TrimStart('/'); if (context.Request.HttpMethod == "GET") { paths = path.Split('/'); if (paths.Length > 0) { switch (paths[0].ToLower()) { case "list": result = Data.List(context.Request.Url.ToString()); break; } } } break; case "config": var apiConfig = ApiConfiguration.Read(); if (apiConfig != null) { string json = JSON.FromObject(apiConfig); if (json != null) { result = json; } else { result = "Error Reading API Configuration"; } } break; } } } } catch (Exception ex) { Logger.Log("Error Processing Local Server Request :: " + ex.Message, LogLineType.Error); } return(result); }
public override void Write(MessageWriter writer, Data data) { writer.Write(data.KillerId); writer.Write(data.VictimId); }
public ResultWrapper <bool> eth_submitWork(Data nonce, Data headerPowHash, Data mixDigest) { throw new NotImplementedException(); }
public override void Write(MessageWriter writer, Data data) { writer.Write(data.MechanicId); }
public ResultWrapper <Data> eth_getStorageAt(Data address, Quantity positionIndex, BlockParameter blockParameter) { throw new NotImplementedException(); }
private void Construct(Data data) { _data = data; }
/// <summary> /// Loads this instance. /// </summary> //[PermissionSet(SecurityAction.Assert, Unrestricted = true)] public void Load() { if (Game.MapId == GameMapId.HowlingAbyss) { return; } Game.OnUpdate += this.GameOnUpdate; Drawing.OnDraw += this.Drawing_OnDraw; JungleTracker.CampDied += this.JungleTrackerCampDied; Obj_AI_Base.OnTeleport += this.OnTeleport; Obj_AI_Base.OnBuffLose += this.OnBuffLose; Drawing.OnPreReset += args => { this.SpellNameFont.OnLostDevice(); this.CountdownFont.OnLostDevice(); this.Sprite.OnLostDevice(); }; Drawing.OnPostReset += args => { this.SpellNameFont.OnResetDevice(); this.CountdownFont.OnResetDevice(); this.Sprite.OnResetDevice(); }; var names = Assembly.GetExecutingAssembly().GetManifestResourceNames().Skip(1).ToList(); var neededSpells = Data.Get <SpellDatabase>().Spells.Where( x => HeroManager.Enemies.Any( y => x.ChampionName.Equals(y.ChampionName, StringComparison.InvariantCultureIgnoreCase))).Select(x => x.SpellName).ToList(); foreach (var name in names) { try { var spellName = name.Split('.')[3]; if (spellName != "Dragon" && spellName != "Baron" && spellName != "Teleport" && spellName != "Rebirthready" && spellName != "Zacrebirthready") { this.Spells.Add(Data.Get <SpellDatabase>().Spells.First(x => x.SpellName.Equals(spellName))); if (!neededSpells.Contains(spellName)) { continue; } } this.Icons.Add( spellName, Texture.FromStream( Drawing.Direct3DDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream(name))); } catch (Exception) { Console.WriteLine($"Failed to find load image for {name}. Please notify jQuery/ChewyMoon!"); } } foreach (var spell in this.Spells) { if (!this.ChampionSpells.ContainsKey(spell.ChampionName)) { this.ChampionSpells[spell.ChampionName] = new List <SpellSlot>(); } this.ChampionSpells[spell.ChampionName].Add(spell.Slot); } }
public ResultWrapper <Data> eth_sendRawTransaction(Data transation) { throw new NotImplementedException(); }
// } public static string GetRegionWithMostIncome(Data data) { return(null); }
/// <summary> /// Decorates the specified rollbar data. /// </summary> /// <param name="rollbarData">The rollbar data.</param> protected abstract void Decorate(Data rollbarData);