public override async void OnNavigatedTo(INavigationParameters param) { if (Ds.NeedInit) { var path = AppFile.GetPath(); path = Path.Combine(path, AppUtils.DbName); await Ds.Init(path); } var runTimer5 = param?[nameof(NavParamEnum.RunTimer5)] as bool?; if (runTimer5 != null && (bool)runTimer5) { var objGameName = param?[nameof(NavParamEnum.GameName)]; if (objGameName != null) { _gameName = objGameName.ToString(); if (_timer == null) { _timer = new ActionTimer(); _timer.InitAndStart(ShowMess); } else { _timer.Restart(); } } } await InitGames(); }
static void Main(string[] args) { //Day 1 Day1Contents d1 = new Day1Contents(); ///Day 2 - classes Parent p1 = new Parent("Hoon"); p1.Hello(); Child c1 = new Child("Hoon", 29); c1.Name = "HoonK"; c1.Hello(); //Day 2 - Delegate DelegateDemo del1 = new DelegateDemo(); del1.PrintWhatEver(10); del1.PrintWhatEver(10.0f); del1.PrintWhatEver("111"); del1.RunHandlers(); //Day 3 - DataStructure Ds ds = new Ds(); }
void SettingTheFirstObjHasActiveOrNot(bool active) { foreach (GameObject Ds in FirstDisActiveObj) { Ds.SetActive(active); } }
public override global::System.Data.DataSet Clone() { Ds cln = ((Ds)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
private void AddText(Line line, string text, Ds ds) { short style = ds.index; for (int i = 0; i < text.Length; i++) { line.Chars_Add(new Char(text[i], style)); } }
public void AddNewVariable(int no) { // if the variable subspacing is disabled, all constants are in this DS too if (!Ds.IsVariableIncluded(no)) { Ds.AddVariable(no); this.m_newVariables.Add(no); } }
public override void PostSimulationStep() { // prepare for new inference of motivaiton from the hierarchy base.PostSimulationStep(); base.m_motivatonSource.MakeStep(); m_prev_st = Ds.GetCurrentState(); this.m_newVariables.Clear(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Ds ds = new Ds(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public void khoitao() { Playercurrent = 0; Button btn = new Button(); Button btn2 = new Button(); btn.Image = Image.FromFile(Application.StartupPath + "\\Images\\icons8-circled-0-42.png"); btn2.Image = Image.FromFile(Application.StartupPath + "\\\\Images\\icons8-x-42.png"); this.Ds = new List <Button>(); Ds.Add(btn); Ds.Add(btn2); }
public void Write(string text, Ds ds) { int index = controller.Lines.charsCount; controller.ClearMinorSelections(); controller.PutCursor(controller.Lines.PlaceOf(controller.Lines.charsCount), false); controller.Lines.InsertText(index, text); if (ds != null) { controller.SetStyleRange(new StyleRange(index, text.Length, ds.index)); } controller.NeedScrollToCaret(); }
private void AddLine(string text, Ds ds) { Line line = new Line(text.Length + 1); line.tabSize = tabSize; short style = ds.index; for (int i = 0; i < text.Length; i++) { line.Chars_Add(new Char(text[i], style)); } line.Chars_Add(new Char('\n', 0)); lines.AddLineUnsafely(line); }
public void UpdateItem(string tableName, Dictionary <string, string> myCurrentData, Dictionary <string, string> myNewData) { var xmldt = GetItem(tableName); if (xmldt != null) { xmldt.Update(myCurrentData, myNewData); Ds.AcceptChanges(); Ds.WriteXml(DataBasePathFile); } if (LogDataObject != null) { AddLogItem(myNewData, "update", tableName); } }
void FillDesignation() { using (SqlConnection con = GetSqlConnection()) { using (SqlCommand com = new SqlCommand("select * from Designation", con)) { con.Open(); SqlDataReader read = com.ExecuteReader(); Ds.DataSource = read; Ds.DataTextField = "Desname"; Ds.DataValueField = "Desid"; Ds.DataBind(); con.Close(); } } }
public void RemoveItem(string tableName, Dictionary <string, string> myData) { var xmldt = GetItem(tableName); if (xmldt != null) { xmldt.Remove(myData); Ds.AcceptChanges(); Ds.WriteXml(DataBasePathFile); } if (LogDataObject != null) { AddLogItem(myData, "remove", tableName); } }
public static string GetTarjetaNine(string lngClienteID, DateTime fecha) { string functionReturnValue = ""; try { objCapaDatos = new ClsCapaDatos(); objCapaDatos.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ConnectionString; DataSet Ds; string strSQL = null; if (lngClienteID != "-1") { strSQL = "SELECT tarj.NumTarjeta FROM N_CLIENTES_GENERAL cg WITH (NOLOCK) INNER JOIN N_CLIENTES_TARJETAS_FIDELIDAD tarj WITH (NOLOCK) "; strSQL += " ON cg.Id_cliente=tarj.IdCliente WHERE cg.Id_Cliente=" + lngClienteID; strSQL += " AND tarj.FechaCaducidad >= CONVERT(DATETIME,'" + fecha.ToShortDateString() + "',103) AND ISNULL(tarj.IdBaja,0)=0 ORDER BY tarj.IdTarjeta DESC "; Ds = objCapaDatos.GEtSQLDataset(strSQL); if (Ds.Tables[0].Rows.Count > 0) { functionReturnValue = Ds.Tables[0].Rows[0]["NumTarjeta"].ToString().Trim(); } else { functionReturnValue = ""; } Ds.Dispose(); } else { functionReturnValue = ""; } } catch (Exception ex) { log.Error(ex); } return(functionReturnValue); }
public override int GetHashCode() { int hash = 1; if (S != 0D) { hash ^= S.GetHashCode(); } if (Ds != 0D) { hash ^= Ds.GetHashCode(); } if (Dds != 0D) { hash ^= Dds.GetHashCode(); } return(hash); }
public void AddListItem(string tableName, List <Dictionary <string, string> > myData) { var xmldt = GetItem(tableName); if (xmldt != null) { foreach (var item in myData) { AddItem(tableName, item); if (LogDataObject != null) { AddLogItem(item, "add", tableName); } } Ds.AcceptChanges(); Ds.WriteXml(DataBasePathFile); } }
public async Task UpdateDb(DataTable table) { try { using (var connection = new SqlConnection(ConnectionBuilder.ConnectionString)) { await connection.OpenAsync(); var commandBuilder = new SqlCommandBuilder(Adapter); Adapter.Update(Ds); Ds.Clear(); Adapter.Fill(Ds); MainWindow.CustomGrid.DataContext = Ds.Tables["persons"]; } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
public void Learn() { int[] s_tt = Ds.GetCurrentState(); float r_t = Ds.GetReward(); int a_t = Ds.GetLastExecutedAction(); if (a_t == this.m_prevSelectedAction) { base.SetJustExecuted(true); } if (a_t < 0) { // aciton ignored and nothing happened if (r_t == 0) { return; } // action adding, reward received as a result of unknown action List <int> toBeAdded = Ds.GetLastExecutedActions(); this.PerformActionAdding(toBeAdded); return; } if (m_setup.OnlineSubspaceVariables) { m_mlvh.monitorVariableChanges(this); } LearningAlgorithm.Learn(r_t, s_tt, a_t); if (r_t > 0) { // SRP is also an action, if the reward is received means that it just has been executed base.SetJustExecuted(true); this.ResetMotivationSource(); m_mlvh.performOnlineVariableRemoving(this); } }
public float[] SelectAction() { int[] s_tt = Ds.GetCurrentState(); float[] utils; // use own asm to select one action? if (m_setup.UseHierarchicalASM) { utils = this.Rescale(m_asm.SelectAction(Mem.ReadData(s_tt))); } else { utils = this.Rescale(Mem.ReadData(s_tt)); } if (m_setup.PropagateUtilitiesInHierarchy) { float myMot = this.GetMyTotalMotivation(); Ds.PromoteUtilitiesToChilds(utils, myMot); } this.MarkSelection(utils); return(utils); }
public static int checkTiendaCamper() { int valor = 0; int TiendaCamper = 0; try { objCapaDatos = new ClsCapaDatos(); objCapaDatos.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ConnectionString; DataSet Ds; string strSQL = ""; strSQL = "select Valor from CONFIGURACIONES_TPV_AVANZADO WHERE NombreCampo='UsoCliente9' and IdTienda =(Select Tienda from configuraciones_tpv)"; Ds = objCapaDatos.GEtSQLDataset(strSQL); if (Ds.Tables[0].Rows.Count > 0) { valor = Convert.ToInt32(Ds.Tables[0].Rows[0][0].ToString()); if (valor == 0) { TiendaCamper = 1; } } Ds.Dispose(); } catch (Exception ex) { log.Error(ex); } return(TiendaCamper); }
public void LoadXmlDb() { this.ClearData(); if (File.Exists(DataBasePathFile)) { Ds.ReadXml(DataBasePathFile); foreach (DataTable dt in Ds.Tables) { XmlTable myXmlData = new XmlTable { TableName = dt.TableName, Dt = dt }; foreach (DataColumn dc in dt.Columns) { myXmlData.Properties.Add(dc.ColumnName, dc.DataType); } ListDataObjects.Add(myXmlData); } } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); Ds ds = new Ds(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "tblProcessInfoDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Ds ds = new Ds(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
static void Main(string[] args) { XDocument xdoc1 = new XDocument(); XElement product1 = new XElement("Product"); XElement product1Name = new XElement("NameOfProduct", "Potato"); XElement product1Calories = new XElement("Calories", "74"); product1.Add(product1Name); product1.Add(product1Calories); XElement product2 = new XElement("Product"); XElement product2Name = new XElement("NameOfProduct", "Tomato"); XElement product2Calories = new XElement("Calories", "20"); product2.Add(product2Name); product2.Add(product2Calories); XElement product3 = new XElement("Product"); XElement product3Name = new XElement("NameOfProduct", "Carrot"); XElement product3Calories = new XElement("Calories", "34"); product3.Add(product3Name); product3.Add(product3Calories); XElement product4 = new XElement("Product"); XElement product4Name = new XElement("NameOfProduct", "Beef"); XElement product4Calories = new XElement("Calories", "250"); product4.Add(product4Name); product4.Add(product4Calories); XElement product5 = new XElement("Product"); XAttribute product5Attr = new XAttribute("TypeProduct", "Eggs"); XElement product5Name = new XElement("NameOfProduct", "Eggs"); XElement product5Calories = new XElement("Calories", "150"); product5.Add(product5Attr); product5.Add(product5Name); product5.Add(product5Calories); XElement product6 = new XElement("Product"); XElement product6Name = new XElement("NameOfProduct", "Apple"); XElement product6Calories = new XElement("Calories", "47"); product6.Add(product6Name); product6.Add(product6Calories); XElement product7 = new XElement("Product"); XElement product7Name = new XElement("NameOfProduct", "Oats"); XElement product7Calories = new XElement("Calories", "357"); product7.Add(product7Name); product7.Add(product7Calories); XElement foodstuff = new XElement("Foodstuff"); foodstuff.Add(product1); foodstuff.Add(product2); foodstuff.Add(product3); foodstuff.Add(product4); foodstuff.Add(product5); foodstuff.Add(product6); foodstuff.Add(product7); xdoc1.Add(foodstuff); xdoc1.Save("Foodstuff.xml"); XDocument xdoc2 = new XDocument(); XElement dish1 = new XElement("Dish"); XElement dish1Name = new XElement("Name", "Mash Potatoes"); XElement dish1QuantityProducts1 = new XElement("QuantityOfGramProduct1", "400"); XAttribute dish1Product1 = new XAttribute("Product", "Potato"); XElement dish1QuantityProducts2 = new XElement("QuantityOfGramProduct2", "100"); XAttribute dish1Product2 = new XAttribute("Product", "Tomato"); XElement dish1QuantityProducts3 = new XElement("QuantityOfGramProduct3", "100"); XAttribute dish1Product3 = new XAttribute("Product", "Egg"); dish1QuantityProducts1.Add(dish1Product1); dish1QuantityProducts2.Add(dish1Product2); dish1QuantityProducts3.Add(dish1Product3); dish1.Add(dish1Name); dish1.Add(dish1QuantityProducts1); dish1.Add(dish1QuantityProducts2); dish1.Add(dish1QuantityProducts3); XElement dish2 = new XElement("Dish"); XElement dish2Name = new XElement("Name", "Salad"); XElement dish2QuantityProducts1 = new XElement("QuantityOfGramProduct1", "200"); XAttribute dish2Product1 = new XAttribute("Product", "Tomato"); XElement dish2QuantityProducts2 = new XElement("QuantityOfGramProduct2", "300"); XAttribute dish2Product2 = new XAttribute("Product", "Carrot"); XElement dish2QuantityProducts3 = new XElement("QuantityOfGramProduct3", "100"); XAttribute dish2Product3 = new XAttribute("Product", "Apple"); dish2QuantityProducts1.Add(dish2Product1); dish2QuantityProducts2.Add(dish2Product2); dish2QuantityProducts3.Add(dish2Product3); dish2.Add(dish2Name); dish2.Add(dish2QuantityProducts1); dish2.Add(dish2QuantityProducts2); dish2.Add(dish2QuantityProducts3); XElement dish3 = new XElement("Dish"); XElement dish3Name = new XElement("Name", "Beef Staek"); XElement dish3QuantityProducts1 = new XElement("QuantityOfGramProduct1", "200"); XAttribute dish3Product1 = new XAttribute("Product", "Beef"); XElement dish3QuantityProducts2 = new XElement("QuantityOfGramProduct2", "200"); XAttribute dish3Product2 = new XAttribute("Product", "Tomato"); XElement dish3QuantityProducts3 = new XElement("QuantityOfGramProduct3", "100"); XAttribute dish3Product3 = new XAttribute("Product", "Carrot"); dish3QuantityProducts1.Add(dish3Product1); dish3QuantityProducts2.Add(dish3Product2); dish3QuantityProducts3.Add(dish3Product3); dish3.Add(dish3Name); dish3.Add(dish3QuantityProducts1); dish3.Add(dish3QuantityProducts2); dish3.Add(dish3QuantityProducts3); XElement dish4 = new XElement("Dish"); XElement dish4Name = new XElement("Name", "Morning Oats"); XElement dish4QuantityProducts1 = new XElement("QuantityOfGramProduct1", "200"); XAttribute dish4Product1 = new XAttribute("Product", "Oats"); XElement dish4QuantityProducts2 = new XElement("QuantityOfGramProduct2", "100"); XAttribute dish4Product2 = new XAttribute("Product", "Egg"); XElement dish4QuantityProducts3 = new XElement("QuantityOfGramProduct3", "200"); XAttribute dish4Product3 = new XAttribute("Product", "Apple"); dish4QuantityProducts1.Add(dish4Product1); dish4QuantityProducts2.Add(dish4Product2); dish4QuantityProducts3.Add(dish4Product3); dish4.Add(dish4Name); dish4.Add(dish4QuantityProducts1); dish4.Add(dish4QuantityProducts2); dish4.Add(dish4QuantityProducts3); XElement dishes = new XElement("Dishes"); dishes.Add(dish1); dishes.Add(dish2); dishes.Add(dish3); dishes.Add(dish4); xdoc2.Add(dishes); xdoc2.Save("Dishes.xml"); XDocument xdoc3 = new XDocument(); XElement menu1 = new XElement("Menu"); XElement menu1Date = new XElement("Date", "25.06.18 12:00"); XElement menu1Dish = new XElement("Dish", "Beef Steak"); XElement menu1Price = new XElement("Price", "400"); menu1.Add(menu1Date); menu1.Add(menu1Dish); menu1.Add(menu1Price); XElement menu2 = new XElement("Menu"); XElement menu2Date = new XElement("Date", "13.11.18 9:00"); XElement menu2Dish = new XElement("Dish", "Morning Oats"); XElement menu2Price = new XElement("Price", "247"); menu2.Add(menu2Date); menu2.Add(menu2Dish); menu2.Add(menu2Price); XElement menu3 = new XElement("Menu"); XElement menu3Date = new XElement("Date", "16.03.18 12:54"); XElement menu3Dish = new XElement("Dish", "Mash Potatoes"); XElement menu3Price = new XElement("Price", "150"); menu3.Add(menu3Date); menu3.Add(menu3Dish); menu3.Add(menu3Price); XElement menu4 = new XElement("Menu"); XElement menu4Date = new XElement("Date", "20.06.18 13:00"); XElement menu4Dish = new XElement("Dish", "Salad"); XElement menu4Price = new XElement("Price", "86"); menu4.Add(menu4Date); menu4.Add(menu4Dish); menu4.Add(menu4Price); XElement fullMenu = new XElement("FullMenu"); fullMenu.Add(menu1); fullMenu.Add(menu2); fullMenu.Add(menu3); fullMenu.Add(menu4); xdoc3.Add(fullMenu); xdoc3.Save("Menu.xml"); Console.WriteLine(xdoc1); Console.WriteLine(xdoc2); Console.WriteLine(xdoc3); XDocument products = XDocument.Load("Foodstuff.xml"); Console.WriteLine("1) Список всех продуктов:"); Console.WriteLine(); foreach (XElement xElement in products.Element("Foodstuff").Elements("Product")) { XElement nameOfProduct = xElement.Element("NameOfProduct"); XElement Calories = xElement.Element("Calories"); if (nameOfProduct != null && Calories != null) { Console.WriteLine($"Name of product: {nameOfProduct.Value}"); Console.WriteLine($"Calories of product: {Calories.Value}"); } Console.WriteLine(); } XDocument Dishes = XDocument.Load("Dishes.xml"); Console.WriteLine("2) Список всех блюд:"); Console.WriteLine(); foreach (XElement xElement in Dishes.Element("Dishes").Elements("Dish")) { XElement Name = xElement.Element("Name"); XElement QuantityProduct1 = xElement.Element("QuantityOfGramProduct1"); XAttribute Product1 = xElement.Element("QuantityOfGramProduct1").Attribute("Product"); XElement QuantityProduct2 = xElement.Element("QuantityOfGramProduct2"); XAttribute Product2 = xElement.Element("QuantityOfGramProduct2").Attribute("Product"); XElement QuantityProduct3 = xElement.Element("QuantityOfGramProduct3"); XAttribute Product3 = xElement.Element("QuantityOfGramProduct3").Attribute("Product"); if (Name != null && QuantityProduct1 != null && Product1 != null && QuantityProduct2 != null && Product2 != null && QuantityProduct3 != null && Product3 != null) { Console.WriteLine($"Название блюда: {Name.Value}"); Console.WriteLine($"Местит: {Product1.Value} {QuantityProduct1.Value} грамм, {Product2.Value} {QuantityProduct2.Value} грамм, {Product3.Value} {QuantityProduct3.Value} грамм."); } Console.WriteLine(); } XDocument Menu = XDocument.Load("Menu.xml"); Console.WriteLine("3) Список всех меню:"); Console.WriteLine(); foreach (XElement xElement in Menu.Element("FullMenu").Elements("Menu")) { XElement Date = xElement.Element("Date"); XElement Dish = xElement.Element("Dish"); XElement Price = xElement.Element("Price"); if (Date != null && Dish != null && Price != null) { Console.WriteLine($"{Dish.Value} приготовлен {Date.Value}"); Console.WriteLine($"Цена: {Price.Value}"); } Console.WriteLine(); } Console.WriteLine("4)Список продуктов, калорийность которых больше 150:"); Console.WriteLine(); var result1 = from item in products.Element("Foodstuff").Elements("Product") where Convert.ToInt32(item.Element("Calories").Value) > 150 select item; foreach (XElement xElement in result1) { XElement nameOfProduct = xElement.Element("NameOfProduct"); XElement Calories = xElement.Element("Calories"); if (nameOfProduct != null && Calories != null) { Console.WriteLine($"Name of product: {nameOfProduct.Value}"); Console.WriteLine($"Calories of product: {Calories.Value}"); } Console.WriteLine(); } Console.WriteLine("5)Список блюд, которые имеют вес продукта в составе больше 200 грамм:"); Console.WriteLine(); var result2 = Dishes.Element("Dishes").Elements("Dish").Where(item => (Convert.ToInt32(item.Element("QuantityOfGramProduct1").Value) > 200 || Convert.ToInt32(item.Element("QuantityOfGramProduct2").Value) > 200 || Convert.ToInt32(item.Element("QuantityOfGramProduct3").Value) > 200)); foreach (XElement xElement in result2) { XElement Name = xElement.Element("Name"); XElement QuantityProduct1 = xElement.Element("QuantityOfGramProduct1"); XAttribute Product1 = xElement.Element("QuantityOfGramProduct1").Attribute("Product"); XElement QuantityProduct2 = xElement.Element("QuantityOfGramProduct2"); XAttribute Product2 = xElement.Element("QuantityOfGramProduct2").Attribute("Product"); XElement QuantityProduct3 = xElement.Element("QuantityOfGramProduct3"); XAttribute Product3 = xElement.Element("QuantityOfGramProduct3").Attribute("Product"); if (Name != null && QuantityProduct1 != null && Product1 != null && QuantityProduct2 != null && Product2 != null && QuantityProduct3 != null && Product3 != null) { Console.WriteLine($"Название блюда: {Name.Value}"); Console.WriteLine($"Местит: {Product1.Value} {QuantityProduct1.Value} грамм, {Product2.Value} {QuantityProduct2.Value} грамм, {Product3.Value} {QuantityProduct3.Value} грамм."); } Console.WriteLine(); } Console.WriteLine("6)Список список продуктов отсортированых за алфавитом:"); Console.WriteLine(); var result3 = products.Element("Foodstuff").Elements("Product").OrderBy(item => item.Element("NameOfProduct").Value); foreach (XElement xElement in result3) { XElement nameOfProduct = xElement.Element("NameOfProduct"); XElement Calories = xElement.Element("Calories"); if (nameOfProduct != null && Calories != null) { Console.WriteLine($"Name of product: {nameOfProduct.Value}"); Console.WriteLine($"Calories of product: {Calories.Value}"); } Console.WriteLine(); } Console.WriteLine("7)Список блюд в меню, отсортированных по цене по убыванию:"); Console.WriteLine(); var result4 = Menu.Element("FullMenu").Elements("Menu").OrderByDescending(item => Convert.ToInt32(item.Element("Price").Value)); foreach (XElement xElement in result4) { XElement Date = xElement.Element("Date"); XElement Dish = xElement.Element("Dish"); XElement Price = xElement.Element("Price"); if (Date != null && Dish != null && Price != null) { Console.WriteLine($"{Dish.Value} приготовлен {Date.Value}"); Console.WriteLine($"Цена: {Price.Value}"); } Console.WriteLine(); } Console.WriteLine("8)Список блюд, в которых есть томат:"); Console.WriteLine(); var result5 = Dishes.Element("Dishes").Elements("Dish").Where(item => (item.Element("QuantityOfGramProduct1").Attribute("Product").Value == "Tomato" || item.Element("QuantityOfGramProduct2").Attribute("Product").Value == "Tomato" || item.Element("QuantityOfGramProduct3").Attribute("Product").Value == "Tomato")); foreach (XElement xElement in result5) { XElement Name = xElement.Element("Name"); XElement QuantityProduct1 = xElement.Element("QuantityOfGramProduct1"); XAttribute Product1 = xElement.Element("QuantityOfGramProduct1").Attribute("Product"); XElement QuantityProduct2 = xElement.Element("QuantityOfGramProduct2"); XAttribute Product2 = xElement.Element("QuantityOfGramProduct2").Attribute("Product"); XElement QuantityProduct3 = xElement.Element("QuantityOfGramProduct3"); XAttribute Product3 = xElement.Element("QuantityOfGramProduct3").Attribute("Product"); if (Name != null && QuantityProduct1 != null && Product1 != null && QuantityProduct2 != null && Product2 != null && QuantityProduct3 != null && Product3 != null) { Console.WriteLine($"Название блюда: {Name.Value}"); Console.WriteLine($"Местит: {Product1.Value} {QuantityProduct1.Value} грамм, {Product2.Value} {QuantityProduct2.Value} грамм, {Product3.Value} {QuantityProduct3.Value} грамм."); } Console.WriteLine(); } Console.WriteLine("9)Сумма за все блюда в меню:"); Console.WriteLine(); var result6 = Menu.Element("FullMenu").Elements("Menu").Sum(item => Convert.ToInt32(item.Element("Price").Value)); Console.WriteLine(result6 + " грн."); Console.WriteLine(); Console.WriteLine("10)Максимальный и минимальный вес блюда в меню:"); Console.WriteLine(); var result7 = Dishes.Element("Dishes").Elements("Dish").Max(item => Convert.ToInt32(item.Element("QuantityOfGramProduct1").Value) + Convert.ToInt32(item.Element("QuantityOfGramProduct2").Value) + Convert.ToInt32(item.Element("QuantityOfGramProduct3").Value)); var result8 = Dishes.Element("Dishes").Elements("Dish").Min(item => Convert.ToInt32(item.Element("QuantityOfGramProduct1").Value) + Convert.ToInt32(item.Element("QuantityOfGramProduct2").Value) + Convert.ToInt32(item.Element("QuantityOfGramProduct3").Value)); Console.WriteLine("Максимальный вес блюда:" + result7 + " грамм"); Console.WriteLine("Минимальный вес блюда: " + result8 + " грамм"); Console.WriteLine(); var result10 = from Mn in Menu.Element("FullMenu").Elements("Menu") join Ds in Dishes.Element("Dishes").Elements("Dish") on Mn.Element("Dish").Value equals Ds.Element("Name").Value select new { NameOfDish = Mn.Element("Dish").Value, PriceOfDish = Mn.Element("Price").Value, NameProduct1 = Ds.Element("QuantityOfGramProduct1").Attribute("Product").Value, NameProduct2 = Ds.Element("QuantityOfGramProduct2").Attribute("Product").Value, NameProduct3 = Ds.Element("QuantityOfGramProduct3").Attribute("Product").Value }; foreach (var item in result10) { Console.WriteLine(item.NameOfDish + " По цене " + item.PriceOfDish + " грн." + " состоит из " + item.NameProduct1 + ", " + item.NameProduct2 + ", " + item.NameProduct3); } }
public DataSet CargaPagos() { DataSet Ds; DLLGestionVenta.ProcesarVenta objVenta = new DLLGestionVenta.ProcesarVenta(); objVenta.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ToString(); Ds = objVenta.GetPago(this.IdCarrito); float total = 0; if (Ds.Tables.Count > 0) { //this.DatosCliente9.TotalPagosPar9 = (from DataRow Dr in Ds.Tables[0].Rows where Dr["Tipo"].ToString().ToUpper().Equals("PAR 9") select Dr).Count(); //this.DatosCliente9.TotalPagosBolsa5 = (from DataRow Dr in Ds.Tables[0].Rows where Dr["Tipo"].ToString().ToUpper().Equals("BOLSA 5") select Dr).Count(); //this.DatosCliente9.TotalPagosPuntos9 = (from DataRow Dr in Ds.Tables[0].Rows where Dr["Tipo"].ToString().ToUpper().Equals("PUNTOS 9") select Dr).Count(); foreach (DataRow Dr in Ds.Tables[0].Rows) { total += float.Parse(Dr["Importe"].ToString()); if (Dr["Tipo"].ToString().Equals("PAR 9")) { this.DatosCliente9.TotalPagosPar9++; } if (Dr["Tipo"].ToString().Equals("BOLSA 5")) { this.DatosCliente9.TotalPagosBolsa5++; } if (Dr["Tipo"].ToString().Equals("PUNTOS 9")) { this.DatosCliente9.TotalPagosPar9++; } } DataRow row = Ds.Tables[0].NewRow(); row["Tipo"] = "Total Pagado:"; row["Importe"] = total; this.TotalPagado = total; Ds.Tables[0].Rows.Add(row); Ds.AcceptChanges(); } else { //divResumen.Visible = false; } return(Ds); //float fSubtotal = 0; //float fDescuento = 0; //float fTotalPagar = 0; //if (float.TryParse(ViewState["SubTotal"].ToString(), out fSubtotal)) //{ // fDescuento = float.Parse(ViewState["ImporteDescuentos"].ToString()); // fTotalPagar = (fSubtotal - fDescuento); //} //float fTotal = (fTotalPagar - TotalPagado); //TotPendiente.Text = FormateaNumero(fTotal.ToString()); //if (fTotal == 0 && fTotalPagar > 0) //{ // Divfinalizar.Visible = true; // RadioButtonlTipoPago.CssClass = "ocul1"; // RadioButton1.CssClass = "Ocultarcontrol"; // btnEnviarPOS.Visible = false; // RadioButton1.CssClass = "Ocultarcontrol"; //} //if (Session["ClienteNine"] != null) //{ // int pares; // int paresRegalado; // int Bolsa; // int BolsaRegalado; // CLIENTE9 objCliente = (CLIENTE9)(Session["ClienteNine"]); // if (objCliente.BolsaPagada > 0 || objCliente.ParPagado > 0 || objCliente.PuntosPagados > 0) // { // Label10.Text = (double.Parse(Label10.Text.ToString()) - objCliente.PuntosPagados).ToString(); // pares = int.Parse(Label13.Text.ToString().Split('(')[0].ToString()); // paresRegalado = int.Parse(Label13.Text.ToString().Split('(')[1].ToString().Replace(")", "")); // Bolsa = int.Parse(Label14.Text.ToString().Split('(')[0].ToString()); // BolsaRegalado = int.Parse(Label14.Text.ToString().Split('(')[1].ToString().Replace(")", "")); // pares = pares - (int.Parse(objCliente.ParPagado.ToString())) * 8; // paresRegalado = (paresRegalado > 0 ? paresRegalado - int.Parse(objCliente.ParPagado.ToString()) : 0); // Bolsa = Bolsa - (int.Parse(objCliente.BolsaPagada.ToString())) * 4; // BolsaRegalado = (BolsaRegalado > 0 ? BolsaRegalado - int.Parse(objCliente.BolsaPagada.ToString()) : 0); // Label11.Text = (paresRegalado > 0 ? Label11.Text : "0"); // Label12.Text = (BolsaRegalado > 0 ? Label12.Text : "0"); // Label13.Text = pares.ToString() + "(" + paresRegalado.ToString() + ")"; // Label14.Text = Bolsa + "(" + BolsaRegalado.ToString() + ")"; // //VALIDAMOS PAR9 // if (Int64.Parse(paresRegalado.ToString()) > 0) // { // RadioButton3.Enabled = true; // } // else // { // RadioButton3.Enabled = false; // } // //VALIDAMOS BOLSA5 // if (Int64.Parse(BolsaRegalado.ToString()) > 0) // { // RadioButton4.Enabled = true; // } // else // { // RadioButton4.Enabled = false; // } // } //} }
public void WriteLine(string text, Ds ds) { Write(text + "\n", ds); }
private async Task InitGames() { _fullItems = await Ds.GetTitles(); GameTitles = new ObservableCollection <GameTitle>(_fullItems); }
public static Buffer NewHelpBuffer(Settings settings, Commander commander) { List <StyleRange> ranges = new List <StyleRange>(); StringBuilder builder = new StringBuilder(); AddHead(builder, "Input mode"); builder.AppendLine("# Command line options"); builder.AppendLine(); builder.AppendLine(GetExeHelp()); builder.AppendLine(); builder.AppendLine("# Actions"); builder.AppendLine(); builder.AppendLine("┌──────────────────────────────────────────────────────────────────────────────────────────┐"); builder.AppendLine("│ IF YOU DON'T KNOW \"HOW TO DO IT\" PRESS `Ctrl+Shift+P` AT FIRST - IT'S SUPERIOR KNOWLEDGE │"); builder.AppendLine("└──────────────────────────────────────────────────────────────────────────────────────────┘"); builder.AppendLine("- All not-vi actions are represented in menu (use this `Ctrl+Shift+P` to search menu item)"); builder.AppendLine("- Menu subitems are depended on frame with cursor"); builder.AppendLine("- [] in menu item denotes complex shortcut, i.e. for `Ctrl+Tab`:"); builder.AppendLine(" Ctrl↓, Tab↓↑, Ctrl↑ - switch back / forward between 2 tabs"); builder.AppendLine(" Ctrl↓, Tab↓↑, Tab↓↑, Ctrl↑ - switch back / forward between 3 tabs"); AddViMode(builder, settings); builder.AppendLine("- To leart more abot vi-mode use `Shift+F1` or :vh command"); builder.AppendLine(); builder.AppendLine(commander.GetHelpText()); builder.AppendLine(settings.GetHelpText()); builder.AppendLine("# Snippets"); builder.AppendLine(); builder.AppendLine("Executes if `Tab` pressed after key in input mode, next `Tab` put cursor to next entry."); builder.AppendLine("To see all accessible snippets press `Ctrl+Shift+Tab` in input mode"); builder.AppendLine("Snippet file format:"); builder.AppendLine(); builder.AppendLine(" # <comment>"); builder.AppendLine(" snippet <key> [action:]<description>"); builder.AppendLine(" <body>"); builder.AppendLine(); builder.AppendLine("Body variables:"); builder.AppendLine(" ${1} - first cursor entry"); builder.AppendLine(" ${1:<default text>} - this text remains if cursor switched to next entry by `Tab`"); builder.AppendLine(" ${1:Regex#<c# regex>} - using (group) as default text"); builder.AppendLine(" ${0} - last cursor entry"); builder.AppendLine(" $1 - first cursor input text"); builder.AppendLine(" `g:snips_author` - snipsAuthor from config"); builder.AppendLine(" `strftime(\"<format>\")` - onboard clock snippet execution time"); builder.AppendLine(" %Y - full year, i.e. 2017"); builder.AppendLine(" %m - month, i.e. 09"); builder.AppendLine(" %d - day, i.e. 05"); builder.AppendLine(" %H - hours, i.e. 14"); builder.AppendLine(" %M - minutes, i.e. 48"); builder.AppendLine(" %S - seconds, i.e. 34"); builder.AppendLine(" %a - week day, i.e. Tue"); builder.AppendLine(" %A - full week day, i.e. Tuesday"); builder.AppendLine(" %b - month, i.e. Sep"); builder.AppendLine(" %B - full month, i.e. September"); builder.AppendLine(" %f%, %n%, … - command dialog variables, suffixes allowed"); builder.AppendLine("If description starts with 'action:' then <body> will be parsed as command"); builder.AppendLine(); builder.AppendLine("# Syntax highlighting styles"); builder.AppendLine(); { int cols = 5; int rows = Math.Max(1, (Ds.all.Count + cols - 1) / cols); Ds[,] grid = new Ds[cols, rows]; for (int i = 0; i < Ds.all.Count; ++i) { Ds ds = Ds.all[i]; grid[i / rows, i % rows] = ds; } int[] maxSizes = new int[cols]; for (int col = 0; col < cols; ++col) { for (int row = 0; row < rows; ++row) { Ds ds = grid[col, row]; if (ds != null && maxSizes[col] < ds.name.Length) { maxSizes[col] = ds.name.Length; } } } for (int row = 0; row < rows; ++row) { for (int col = 0; col < cols; ++col) { Ds ds = grid[col, row]; if (ds != null) { ranges.Add(new StyleRange(builder.Length, ds.name.Length, ds.index)); builder.Append(ds.name); builder.Append(new string(' ', maxSizes[col] - ds.name.Length)); } else { builder.Append(new string(' ', maxSizes[col])); } if (col != cols - 1) { builder.Append(" │ "); } } builder.AppendLine(); } } builder.AppendLine(); builder.AppendLine("Learn more about syntax.xml files in \"?\\Kate syntax highlighting help…\" menu item"); Buffer buffer = new Buffer(null, "Help.twh", SettingsMode.Help); buffer.tags = BufferTag.Other; buffer.Controller.isReadonly = true; buffer.Controller.InitText(builder.ToString()); buffer.Controller.Lines.ranges = ranges; return(buffer); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); Ds ds = new Ds(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "DTDelDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }