public void setData(int offerid, SQLConnector scon) { sCon = scon; dS = new DataSet(); OfferID = offerid; if (offerid >= 0) { lb_id.Text = "Offer-ID: " + offerid; } //load tours, offer Data from Server sDA_tour = sCon.getShip_Tours_List(dS, null); sDA_offer = sCon.getOffer(dS, "offer", null, OfferID); lBox_tour.DataSource = dS.Tables["ship_tours"]; lBox_tour.DisplayMember = "TourName"; lBox_tour.ValueMember = "TourID"; if (dS.Tables["offer"].Rows.Count > 0) { lb_id.Text = "Offer-ID: " + dS.Tables["offer"].Rows[0]["ID"]; lBox_tour.SelectedValue = dS.Tables["offer"].Rows[0]["tourID"]; dTP_createDate.Value = (DateTime)dS.Tables["offer"].Rows[0]["create_date"]; dTP_createTime.Value = (DateTime)dS.Tables["offer"].Rows[0]["create_date"]; dTP_expireDate.Value = (DateTime)dS.Tables["offer"].Rows[0]["expire_date"]; dTP_expireTime.Value = (DateTime)dS.Tables["offer"].Rows[0]["expire_date"]; nTB_price.Text = ((Decimal)dS.Tables["offer"].Rows[0]["price"]).ToString(); tB_name.Text = (string)dS.Tables["offer"].Rows[0]["name"]; } }
public void setData(int transid, SQLConnector scon) { sCon = scon; dS = new DataSet(); TransID = transid; if (transid >= 0) { lb_id.Text = "Trans-ID: " + transid; } //load DataSets sDA_offers = sCon.getOffers_List(dS, null); sDA_sellers = sCon.getSellers_List_FullName(dS, null); sDA_transaction = sCon.getTransaction(dS, "transaction", null, TransID); //set Data to Form-Elements lBox_offer.DataSource = dS.Tables["offers"]; lBox_offer.DisplayMember = "OfferName"; lBox_offer.ValueMember = "OfferID"; lBox_seller.DataSource = dS.Tables["sellers"]; lBox_seller.DisplayMember = "SellerName"; lBox_seller.ValueMember = "SellerID"; if (dS.Tables["transaction"].Rows.Count > 0) { lb_id.Text = "Trans-ID: " + dS.Tables["transaction"].Rows[0]["ID"]; lBox_offer.SelectedValue = dS.Tables["transaction"].Rows[0]["offerID"]; lBox_seller.SelectedValue = dS.Tables["transaction"].Rows[0]["sellerID"]; nTB_contingent.Text = ((int)dS.Tables["transaction"].Rows[0]["seller_contingent"]).ToString(); } }
public void setData(int tourid, SQLConnector scon) { sCon = scon; dS = new DataSet(); TourID = tourid; if (tourid >= 0) { lb_id.Text = "Tour-ID: " + tourid; } //load ship, route Data from Server sDA_routes = sCon.getShip_Route_List_sort(dS, null); sDA_ships = sCon.getShips_List(dS, null); sDA_tour = sCon.getShip_Tour(dS, "tour", null, tourid); //set Data to Form-Elements lBox_ship.DataSource = dS.Tables["ships"]; lBox_ship.DisplayMember = "name"; lBox_ship.ValueMember = "ShipID"; lBox_route.DataSource = dS.Tables["ship_routes"]; lBox_route.DisplayMember = "RouteName"; lBox_route.ValueMember = "RouteID"; if (dS.Tables["tour"].Rows.Count > 0) { lb_id.Text = "Tour-ID: " + dS.Tables["tour"].Rows[0]["ID"]; lBox_ship.SelectedValue = dS.Tables["tour"].Rows[0]["shipID"]; lBox_route.SelectedValue = dS.Tables["tour"].Rows[0]["routeID"]; dTP_sailingDate.Value = (DateTime)dS.Tables["tour"].Rows[0]["sailing_time"]; dTP_sailingTime.Value = (DateTime)dS.Tables["tour"].Rows[0]["sailing_time"]; dTP_returnDate.Value = (DateTime)dS.Tables["tour"].Rows[0]["return_time"]; dTP_returnTime.Value = (DateTime)dS.Tables["tour"].Rows[0]["return_time"]; nTB_tour_costs.Text = ((Decimal)dS.Tables["tour"].Rows[0]["tour_costs"]).ToString(); tB_name.Text = (string)dS.Tables["tour"].Rows[0]["name"]; } }
public void setData(int routeid, SQLConnector scon) { sCon = scon; dS = new DataSet(); RouteID = routeid; if (routeid >= 0) { lb_id.Text = "Route-ID: " + routeid; } //load Loaction Data from Server sDA_location = sCon.getLocations_List(dS, "from_location", null); sDA_location.Fill(dS, "to_location"); sDA_route = sCon.getShip_Route(dS, "route", null, routeid); //set Data to Form-Elements lBox_from_location.DataSource = dS.Tables["from_location"]; lBox_from_location.DisplayMember = "name"; lBox_from_location.ValueMember = "LocationID"; lBox_to_location.DataSource = dS.Tables["to_location"]; lBox_to_location.DisplayMember = "name"; lBox_to_location.ValueMember = "LocationID"; if (dS.Tables["route"].Rows.Count > 0) { lb_id.Text = "Route-ID: " + dS.Tables["route"].Rows[0]["RouteID"]; lBox_from_location.SelectedValue = dS.Tables["route"].Rows[0]["from_locationID"]; lBox_to_location.SelectedValue = dS.Tables["route"].Rows[0]["to_locationID"]; tB_name.Text = (string)dS.Tables["route"].Rows[0]["RouteName"]; nTB_distance.Text = ((Decimal)dS.Tables["route"].Rows[0]["distance_km"]).ToString(); } }
public void setData(int passengerid, int sellerID, SQLConnector scon) { sCon = scon; dS = new DataSet(); PassengerID = passengerid; if (passengerid >= 0) { lb_id.Text = "Passenger-ID: " + passengerid; } //load DataSets sDA_sellers = sCon.getSellers_List_FullName(dS, null); sDA_customers = sCon.getCustomers_List_FullName(dS, null); sDA_passenger = sCon.getPassenger(dS, "passenger", null, PassengerID); //set Data to Form-Elements lBox_customer.DataSource = dS.Tables["customers"]; lBox_customer.DisplayMember = "CustomerName"; lBox_customer.ValueMember = "CustomerID"; coB_select_seller.DataSource = dS.Tables["sellers"]; coB_select_seller.DisplayMember = "SellerName"; coB_select_seller.ValueMember = "SellerID"; if (sellerID >= 0) coB_select_seller.SelectedValue = sellerID; if (dS.Tables["passenger"].Rows.Count > 0) { if (sellerID < 0) { sDA_passenger_seller = sCon.getPassenger_Seller(dS, "passenger_seller", null, PassengerID); if (dS.Tables["passenger_seller"].Rows.Count > 0) coB_select_seller.SelectedValue = dS.Tables["passenger_seller"].Rows[0]["sellerID"]; } lb_id.Text = "Passenger-ID: " + dS.Tables["passenger"].Rows[0]["ID"]; lBox_customer.SelectedValue = dS.Tables["passenger"].Rows[0]["customerID"]; lBox_transaction.SelectedValue = dS.Tables["passenger"].Rows[0]["transactionID"]; nTB_price.Text = ((decimal)dS.Tables["passenger"].Rows[0]["price"]).ToString(); //if ((byte)dS.Tables["passenger"].Rows[0]["is_paid"] == 0) cB_is_paid.Checked = false; else cB_is_paid.Checked = true; cB_is_paid.Checked = Convert.ToBoolean((byte)dS.Tables["passenger"].Rows[0]["is_paid"]); dTP_booked_date.Value = (DateTime)dS.Tables["passenger"].Rows[0]["booked_time"]; dTP_booked_time.Value = (DateTime)dS.Tables["passenger"].Rows[0]["booked_time"]; } }
public override void doRuleQuickFix(SQLConnector eaConnector, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { throw new NotImplementedException(); }
public static string Gossip() { if (Storage.Gossips.IsEmpty) { return(String.Empty); } // `creature_template` var gossipIds = new Dictionary <uint, UnitGossip>(); foreach (var gossip in Storage.Gossips) { if (gossip.Value.ObjectType != ObjectType.Unit) { continue; } // no support for entries with multiple gossips (i.e changed by script) if (gossipIds.ContainsKey(gossip.Value.ObjectEntry)) { continue; } UnitGossip a; a.GossipId = gossip.Key.Item1; gossipIds.Add(gossip.Value.ObjectEntry, a); } var entries = gossipIds.Keys.ToList(); var gossipIdsDb = SQLDatabase.GetDict <uint, UnitGossip>(entries); var result = SQLUtil.CompareDicts(gossipIds, gossipIdsDb, StoreNameType.Unit); // `gossip` if (SQLConnector.Enabled) { var query = new StringBuilder("SELECT `entry`,`text_id` FROM `world`.`gossip_menu` WHERE "); foreach (Tuple <uint, uint> gossip in Storage.Gossips.Keys) { query.Append("(`entry`=").Append(gossip.Item1).Append(" AND "); query.Append("`text_id`=").Append(gossip.Item2).Append(") OR "); } query.Remove(query.Length - 4, 4).Append(";"); var rows = new List <QueryBuilder.SQLInsertRow>(); using (var reader = SQLConnector.ExecuteQuery(query.ToString())) { if (reader != null) { while (reader.Read()) { var values = new object[2]; var count = reader.GetValues(values); if (count != 2) { break; // error in query } var entry = Convert.ToUInt32(values[0]); var textId = Convert.ToUInt32(values[1]); // our table is small, 2 fields and both are PKs; no need for updates if (!Storage.Gossips.ContainsKey(Tuple.Create(entry, textId))) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("entry", entry); row.AddValue("text_id", textId); row.Comment = StoreGetters.GetName(StoreNameType.Unit, // BUG: GOs can send gossips too (int)entry, false); rows.Add(row); } } } } result += new QueryBuilder.SQLInsert("gossip_menu", rows, 2).Build(); } else { var rows = new List <QueryBuilder.SQLInsertRow>(); foreach (var gossip in Storage.Gossips) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("entry", gossip.Key.Item1); row.AddValue("text_id", gossip.Key.Item2); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.ObjectType), (int)gossip.Value.ObjectEntry, false); rows.Add(row); } result += new QueryBuilder.SQLInsert("gossip_menu", rows, 2).Build(); } // `gossip_menu_option` if (SQLConnector.Enabled) { var rowsIns = new List <QueryBuilder.SQLInsertRow>(); var rowsUpd = new List <QueryBuilder.SQLUpdateRow>(); foreach (var gossip in Storage.Gossips) { if (gossip.Value.GossipOptions == null) { continue; } foreach (var gossipOption in gossip.Value.GossipOptions) { var query = // 0 1 2 3 4 5 6 string.Format("SELECT menu_id,id,option_icon,box_coded,box_money,box_text,option_text " + "FROM world.gossip_menu_option WHERE menu_id={0} AND id={1};", gossip.Key.Item1, gossipOption.Index); using (var reader = SQLConnector.ExecuteQuery(query)) { if (reader.HasRows) // possible update { while (reader.Read()) { var row = new QueryBuilder.SQLUpdateRow(); if (!Utilities.EqualValues(reader.GetValue(2), gossipOption.OptionIcon)) { row.AddValue("option_icon", gossipOption.OptionIcon); } if (!Utilities.EqualValues(reader.GetValue(3), gossipOption.Box)) { row.AddValue("box_coded", gossipOption.Box); } if (!Utilities.EqualValues(reader.GetValue(4), gossipOption.RequiredMoney)) { row.AddValue("box_money", gossipOption.RequiredMoney); } if (!Utilities.EqualValues(reader.GetValue(5), gossipOption.BoxText)) { row.AddValue("box_text", gossipOption.BoxText); } if (!Utilities.EqualValues(reader.GetValue(6), gossipOption.OptionText)) { row.AddValue("option_text", gossipOption.OptionText); } row.AddWhere("menu_id", gossip.Key.Item1); row.AddWhere("id", gossipOption.Index); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.ObjectType), (int)gossip.Value.ObjectEntry, false); row.Table = "gossip_menu_option"; if (row.ValueCount != 0) { rowsUpd.Add(row); } } } else // insert { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("menu_id", gossip.Key.Item1); row.AddValue("id", gossipOption.Index); row.AddValue("option_icon", gossipOption.OptionIcon); row.AddValue("option_text", gossipOption.OptionText); row.AddValue("box_coded", gossipOption.Box); row.AddValue("box_money", gossipOption.RequiredMoney); row.AddValue("box_text", gossipOption.BoxText); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.ObjectType), (int)gossip.Value.ObjectEntry, false); rowsIns.Add(row); } } } } result += new QueryBuilder.SQLInsert("gossip_menu_option", rowsIns, 2).Build() + new QueryBuilder.SQLUpdate(rowsUpd).Build(); } else { var rows = new List <QueryBuilder.SQLInsertRow>(); foreach (var gossip in Storage.Gossips) { if (gossip.Value.GossipOptions != null) { foreach (var gossipOption in gossip.Value.GossipOptions) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("menu_id", gossip.Key.Item1); row.AddValue("id", gossipOption.Index); row.AddValue("option_icon", gossipOption.OptionIcon); row.AddValue("option_text", gossipOption.OptionText); row.AddValue("box_coded", gossipOption.Box); row.AddValue("box_money", gossipOption.RequiredMoney); row.AddValue("box_text", gossipOption.BoxText); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.ObjectType), (int)gossip.Value.ObjectEntry, false); rows.Add(row); } } } result += new QueryBuilder.SQLInsert("gossip_menu_option", rows, 2).Build(); } return(result); }
private static void Main(string[] args) { SetUpConsole(); var files = args.ToList(); if (files.Count == 0) { PrintUsage(); return; } Console.WriteLine("Press enter to start."); Console.ReadLine(); // config options are handled in Misc.Settings Utilities.RemoveConfigOptions(ref files); if (!Utilities.GetFiles(ref files)) { EndPrompt(); return; } Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; // Disable DB when we don't need its data (dumping to a binary file) if (!Settings.DumpFormatWithSQL()) { SQLConnector.Enabled = false; SSHTunnel.Enabled = false; } else { Filters.Initialize(); } SQLConnector.ReadDB(); var count = 0; foreach (var file in files) { SessionHandler.ZStreams.Clear(); ClientVersion.SetVersion(Settings.ClientBuild); var sf = new SniffFile(file, Settings.DumpFormat, Tuple.Create(++count, files.Count)); sf.ProcessFile(); } if (!String.IsNullOrWhiteSpace(Settings.SQLFileName) && Settings.DumpFormatWithSQL()) { Builder.DumpSQL("Dumping global sql", Settings.SQLFileName, SniffFile.GetHeader("multi")); } SQLConnector.Disconnect(); SSHTunnel.Disconnect(); if (Settings.LogErrors) { Logger.WriteErrors(); } Trace.Listeners.Remove("ConsoleMirror"); EndPrompt(); }
protected void Page_Load(object sender, EventArgs e) { string MovieId = Request.QueryString["Id"]; if (!string.IsNullOrEmpty(MovieId)) { SQLConnector con = new SQLConnector(); List <MovieDTO> listMovies = new List <MovieDTO>(); listMovies = con.GetAll("Movie").Cast <MovieDTO>().ToList(); List <ScreeningDTO> listScreening = new List <ScreeningDTO>(); listScreening = con.GetAll("Screening", "MovieId", MovieId, typeof(int)).Cast <ScreeningDTO>().ToList(); if (listMovies.Count > 0) { foreach (MovieDTO Movie in listMovies) { if (Movie.Id == Convert.ToInt32(MovieId)) { //wrapper div for movie HtmlGenericControl MovieWrapperDiv = new HtmlGenericControl("DIV"); MovieWrapperDiv.Attributes["class"] = "row"; ScreeningBody.Controls.Add(MovieWrapperDiv); //adding div for movie HtmlGenericControl MovieDiv = new HtmlGenericControl("DIV"); MovieDiv.Attributes["class"] = "col-md-12"; string StringDivId = "div-mov-" + Movie.Id; MovieDiv.Attributes["Id"] = StringDivId; MovieWrapperDiv.Controls.Add(MovieDiv); //Adding div for poster HtmlGenericControl PosterDiv = new HtmlGenericControl("DIV"); PosterDiv.Attributes["class"] = "col-md-4 class"; string StringPosterDivId = "div-poster-" + Movie.Id; PosterDiv.Attributes["Id"] = StringPosterDivId; MovieDiv.Controls.Add(PosterDiv); //Adding poster img to poster div HtmlGenericControl MoviePosterImg = new HtmlGenericControl("IMG"); MoviePosterImg.Attributes["src"] = "/content/images/" + Movie.PosterFileName; MoviePosterImg.Attributes["height"] = "450px"; MoviePosterImg.Attributes["width"] = "300px"; string StringPosterImgId = "img-poster-" + Movie.Id; MoviePosterImg.Attributes["Id"] = StringPosterImgId; PosterDiv.Controls.Add(MoviePosterImg); //Adding div for movie details HtmlGenericControl DetailDiv = new HtmlGenericControl("DIV"); DetailDiv.Attributes["class"] = "col-md-8"; string StringDetailDivId = "div-detail-" + Movie.Id; DetailDiv.Attributes["Id"] = StringDetailDivId; MovieDiv.Controls.Add(DetailDiv); //Adding Label for movie in movie detail div HtmlGenericControl MovieH1Title = new HtmlGenericControl("H1"); MovieH1Title.InnerHtml = Movie.Title; DetailDiv.Controls.Add(MovieH1Title); //Adding description for movie in movie detail div HtmlGenericControl Description = new HtmlGenericControl("P"); Description.InnerText = Movie.Description; DetailDiv.Controls.Add(Description); HtmlGenericControl LineBreak = new HtmlGenericControl("BR"); ScreeningBody.Controls.Add(LineBreak); } } } //Wrapper div for Screenings HtmlGenericControl ScreeningWrapperDiv = new HtmlGenericControl("DIV"); ScreeningWrapperDiv.Attributes["class"] = "row"; ScreeningBody.Controls.Add(ScreeningWrapperDiv); if (listScreening.Count > 0) { //adding div for screenings HtmlGenericControl ScreeningDiv = new HtmlGenericControl("DIV"); ScreeningDiv.Attributes["class"] = "col-md-12"; string StringDivSId = "div-scr-" + 0; ScreeningDiv.Attributes["Id"] = StringDivSId; ScreeningWrapperDiv.Controls.Add(ScreeningDiv); //Adding div for column 1 HtmlGenericControl ScreeningColumn1 = new HtmlGenericControl("DIV"); ScreeningColumn1.Attributes["class"] = "col-md-4 class"; string StringScreeningsDivId1 = "div-scr-" + 1; ScreeningColumn1.Attributes["Id"] = StringScreeningsDivId1; ScreeningDiv.Controls.Add(ScreeningColumn1); //Adding div for column 2 HtmlGenericControl ScreeningColumn2 = new HtmlGenericControl("DIV"); ScreeningColumn2.Attributes["class"] = "col-md-4 class"; string StringScreeningsDivId2 = "div-scr-" + 2; ScreeningColumn2.Attributes["Id"] = StringScreeningsDivId2; ScreeningDiv.Controls.Add(ScreeningColumn2); //Adding div for column 3 HtmlGenericControl ScreeningColumn3 = new HtmlGenericControl("DIV"); ScreeningColumn3.Attributes["class"] = "col-md-4 class"; string StringScreeningsDivId3 = "div-scr-" + 3; ScreeningColumn3.Attributes["Id"] = StringScreeningsDivId3; ScreeningDiv.Controls.Add(ScreeningColumn3); int intCount = -1; foreach (ScreeningDTO Screening in listScreening) { //Adding start date to columns HtmlGenericControl ScreeningStart = new HtmlGenericControl("A"); ScreeningStart.Attributes["href"] = "/moviereservation.aspx?Id=" + Screening.Id; ScreeningStart.InnerHtml = Convert.ToString(Screening.StartDate); HtmlGenericControl LineBreak = new HtmlGenericControl("BR"); if (intCount < listScreening.Count / 3) { ScreeningColumn1.Controls.Add(ScreeningStart); ScreeningColumn1.Controls.Add(LineBreak); } else if (intCount < (2 * listScreening.Count) / 3) { ScreeningColumn2.Controls.Add(ScreeningStart); ScreeningColumn2.Controls.Add(LineBreak); } else { ScreeningColumn3.Controls.Add(ScreeningStart); ScreeningColumn3.Controls.Add(LineBreak); } intCount++; } } else { HtmlGenericControl ParagraphForNoScreenings = new HtmlGenericControl("P"); ParagraphForNoScreenings.InnerText = "No screenings found."; ScreeningBody.Controls.Add(ParagraphForNoScreenings); } } }
public AdminRightsChecker(int userID) { String query = "SELECT CzyAdmin FROM Users WHERE UserID = '" + userID + "';"; this.rights = GetRightsFromSQL(query, SQLConnector.GetSQLConnection()); }
//checks over all databases that were restored and checks there state. If any are stuck in restoring state, then restore them again (single threaded at this point) private void stuckRestoringCheck(string[] filesToRestore, SQLConnector conn) { conn.Open(); var dbResults = conn.ReadResults(conn.CreateCommand("SELECT NAME FROM SYS.DATABASES WHERE NAME NOT IN ('tempdb', 'master', 'model', 'msdb')")); List <string> databases = new List <string>(); while (dbResults.Read()) { databases.Add(dbResults[0].ToString()); } conn.Close(); Boolean keepgoing = true; //make sure all other background workers are done with their restoring before proceeding while (keepgoing) { int workersWorking = 0; if (backgroundWorker1.IsBusy) { workersWorking++; } if (backgroundWorker3.IsBusy) { workersWorking++; } if (backgroundWorker4.IsBusy) { workersWorking++; } if (backgroundWorker5.IsBusy) { workersWorking++; } if (workersWorking == 1) { keepgoing = false; } } //Console.Clear(); //this line seems to cause problems for some reason. didn't investigate, just disabled since non-essential for (int i = 0; i < databases.Count; i++) { string dbName = databases[i]; string sql_check_state = $"SELECT DATABASEPROPERTYEX('{dbName}', 'Status')"; string result; if (conn.GetConnectionState() == ConnectionState.Open) { conn.Close(); } try { conn.Open(); var reader = conn.ReadResults(conn.CreateCommand(sql_check_state)); reader.Read(); result = reader[0].ToString(); //read the result's first row grab its first column Console.WriteLine(dbName + ": " + result); conn.Close(); } catch (Exception ex) { Console.WriteLine(ex); if (conn != null && conn.GetConnectionState() == ConnectionState.Open) { conn.Close(); } result = "failed"; } if (!result.Equals("ONLINE")) //if this database's state is not ONLINE then restore it again { Console.WriteLine($"{dbName} currently in state: {result}"); Console.WriteLine("restoring... starting check over again"); Logger.Info($"{dbName} currently in state: {result} - restoring... starting check over again"); restoreDatabase(i, filesToRestore, conn, "Final Check"); i = -1; //reset, start check over again to check this one again } } }
public static string NpcName() { var result = ""; if (Storage.UnitTemplates.IsEmpty()) { return(String.Empty); } if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_template)) { return(string.Empty); } const string tableName = "creature_template"; if (SQLConnector.Enabled) { var rowsUpd = new List <QueryBuilder.SQLUpdateRow>(); foreach (var npcName in Storage.UnitTemplates) { var query = string.Format("SELECT name FROM {0}.creature_template WHERE entry={1};", Settings.TDBDatabase, npcName.Key); using (var reader = SQLConnector.ExecuteQuery(query)) { if (reader.HasRows) // possible update { while (reader.Read()) { var row = new QueryBuilder.SQLUpdateRow(); if (!Utilities.EqualValues(reader.GetValue(0), npcName.Value.Item1.Name)) { row.AddValue("name", npcName.Value.Item1.Name); } if (Utilities.EqualValues(reader.GetValue(0), npcName.Value.Item1.Name) && npcName.Value.Item1.femaleName != null) { row.AddValue("femaleName", npcName.Value.Item1.femaleName); } row.AddWhere("entry", npcName.Key); row.Table = tableName; if (row.ValueCount != 0) { rowsUpd.Add(row); } } } } } result += new QueryBuilder.SQLUpdate(rowsUpd).Build(); } return(result); }
private static bool LoginValidate(String login) { if (login.Length <= 0) // pusty { return(false); } else { SQLResTable[] SQLResults = GetLoginsFromSQL("SELECT Login FROM Users WHERE Login = '******'", SQLConnector.GetSQLConnection()); if ((SQLResults != null) && (SQLResults.Length > 0)) { return(false); // login zajęty } else { return(true); } } }
private static Boolean markConnectorInProjectBrowser(SQLConnector con, SQLRepository rep) { SQLElement client = rep.GetElementByID(con.ClientID); return(markElementInProjectBrowser(client, rep)); }
public Principal() { InitializeComponent(); coneccion = new SQLConnector(); }
private static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; // Read config options string[] filters = null; string[] ignoreFilters = null; bool sqlOutput = false; DumpFormatType dumpFormat = DumpFormatType.Text; int packetsToRead = 0; // 0 -> All packets int packetNumberLow = 0; // 0 -> No low limit int packetNumberHigh = 0; // 0 -> No high limit bool prompt = false; int threads = 0; try { ClientVersion.SetVersion(Settings.GetEnum <ClientVersionBuild>("ClientBuild")); packetNumberLow = Settings.GetInt32("FilterPacketNumLow"); packetNumberHigh = Settings.GetInt32("FilterPacketNumHigh"); if (packetNumberLow > 0 && packetNumberHigh > 0 && packetNumberLow > packetNumberHigh) { throw new Exception("FilterPacketNumLow must be less or equal than FilterPacketNumHigh"); } string filtersString = Settings.GetString("Filters"); if (filtersString != null) { filters = filtersString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } filtersString = Settings.GetString("IgnoreFilters"); if (filtersString != null) { ignoreFilters = filtersString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } sqlOutput = Settings.GetBoolean("SQLOutput"); dumpFormat = (DumpFormatType)Settings.GetInt32("DumpFormat"); packetsToRead = Settings.GetInt32("PacketsNum"); prompt = Settings.GetBoolean("ShowEndPrompt"); threads = Settings.GetInt32("Threads"); // Disable DB and DBCs when we don't need its data (dumping to a binary file) if (dumpFormat == DumpFormatType.Bin || dumpFormat == DumpFormatType.Pkt) { DBCStore.Enabled = false; SQLConnector.Enabled = false; } } catch (Exception ex) { Console.WriteLine(ex.GetType()); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } // Quit if no arguments are given if (args.Length == 0) { Console.WriteLine("No files specified."); EndPrompt(prompt); return; } // Read DBCs if (DBCStore.Enabled) { var startTime = DateTime.Now; Console.WriteLine("Loading DBCs..."); new DBCLoader(); var endTime = DateTime.Now; var span = endTime.Subtract(startTime); Console.WriteLine("Finished loading DBCs - {0} Minutes, {1} Seconds and {2} Milliseconds.", span.Minutes, span.Seconds, span.Milliseconds); Console.WriteLine(); } // Read DB if (SQLConnector.Enabled) { var startTime = DateTime.Now; Console.WriteLine("Loading DB..."); try { SQLConnector.Connect(); SQLDatabase.GrabData(); } catch (Exception ex) { Console.WriteLine(ex.Message); SQLConnector.Enabled = false; // Something failed, disabling everything SQL related } var endTime = DateTime.Now; var span = endTime.Subtract(startTime); Console.WriteLine("Finished loading DB - {0} Minutes, {1} Seconds and {2} Milliseconds.", span.Minutes, span.Seconds, span.Milliseconds); Console.WriteLine(); } // Read binaries string[] files = args; if (args.Length == 1 && args[0].Contains('*')) { try { files = Directory.GetFiles(@".\", args[0]); } catch (Exception ex) { Console.WriteLine(ex.GetType()); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } } if (threads == 0) // Number of threads is automatically choosen by the Parallel library { files.AsParallel().SetCulture().ForAll(file => ReadFile(file, filters, ignoreFilters, packetNumberLow, packetNumberHigh, packetsToRead, dumpFormat, threads, sqlOutput, prompt)); } else { files.AsParallel().SetCulture().WithDegreeOfParallelism(threads).ForAll(file => ReadFile(file, filters, ignoreFilters, packetNumberLow, packetNumberHigh, packetsToRead, dumpFormat, threads, sqlOutput, prompt)); } }
public String CheckPass(String login, String password) { // Zwraca hash hasła, jeśli prawidłowe lub null, jeśli nieprawidłowe LoginRes[] SQLResults = GetLoginsFromSQL("SELECT Login, PasswordSalt, PasswordHash FROM Users WHERE Login = '******'", SQLConnector.GetSQLConnection()); // zakładamy, że może być tylko jedna osoba z danym loginem if ((SQLResults != null) && (SQLResults.Length == 1)) { String PasswordSalt = SQLResults[0].PasswordSalt; String PasswordHash = SQLResults[0].PasswordHash; if (HashGen.CreateSHAHash(password, PasswordSalt).Equals(PasswordHash)) { return(PasswordHash); } else { return(null); } } else { return(null); // W zasadzie wyłapujemy tu przypadek braku loginu w bazie. } }
private void onTggLvDoubleClicked(SQLRepository sqlRepository, SQLConnector doubleClickedConnector) { TGGLinkVariable tggLv = new TGGLinkVariable(doubleClickedConnector, sqlRepository); this.LinkVariableDialog = new LinkVariablePropertiesForm(tggLv, sqlRepository, true); }
public CancelReser(UsuarioLogueado userLog) { idGral = userLog.conseguirIdUser(); conexion = userLog.getConexion(); txtFecCancel.Text = fechaActualSistema.ToString("yyyyMMdd"); }
public CancelReser(SQLConnector conecc, string criterio) { InitializeComponent(); txtFecCancel.Text = fechaActualSistema.ToString("yyyyMMdd"); conexion = conecc; }
public static string QuestObjective() { var result = ""; if (Storage.QuestObjectives.IsEmpty()) { return(String.Empty); } if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.quest_template)) { return(String.Empty); } var entries = Storage.QuestObjectives.Keys(); var templatesDb = SQLDatabase.GetDict <uint, QuestInfoObjective>(entries, "Id"); result += SQLUtil.CompareDicts(Storage.QuestObjectives, templatesDb, StoreNameType.QuestObjective, "Id"); var rowsIns = new List <QueryBuilder.SQLInsertRow>(); var rowsUpd = new List <QueryBuilder.SQLUpdateRow>(); foreach (var questObjectives in Storage.QuestObjectives) { foreach (var visualEffectIds in questObjectives.Value.Item1.VisualEffectIds) { if (SQLConnector.Enabled) { var query = string.Format("SELECT `VisualEffect`, `VerifiedBuild` FROM {0}.quest_visual_effect WHERE `Id`={1} AND `Index`={2};", Settings.TDBDatabase, questObjectives.Key, visualEffectIds.Index); using (var reader = SQLConnector.ExecuteQuery(query)) { if (reader.HasRows) // possible update { while (reader.Read()) { var row = new QueryBuilder.SQLUpdateRow(); if (!Utilities.EqualValues(reader.GetValue(0), visualEffectIds.VisualEffect)) { row.AddValue("VisualEffect", visualEffectIds.VisualEffect); } if (!Utilities.EqualValues(reader.GetValue(1), questObjectives.Value.Item1.VerifiedBuild)) { row.AddValue("VerifiedBuild", questObjectives.Value.Item1.VerifiedBuild); } row.AddWhere("Id", questObjectives.Key); row.AddWhere("Index", visualEffectIds.Index); row.Table = "quest_visual_effect"; if (row.ValueCount != 0) { rowsUpd.Add(row); } } } else // insert { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("Id", questObjectives.Key); row.AddValue("Index", visualEffectIds.Index); row.AddValue("VisualEffect", visualEffectIds.VisualEffect); row.AddValue("VerifiedBuild", questObjectives.Value.Item1.VerifiedBuild); rowsIns.Add(row); } } } else // insert { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("Id", questObjectives.Key); row.AddValue("Index", visualEffectIds.Index); row.AddValue("VisualEffect", visualEffectIds.VisualEffect); row.AddValue("VerifiedBuild", questObjectives.Value.Item1.VerifiedBuild); rowsIns.Add(row); } } } result += new QueryBuilder.SQLInsert("quest_visual_effect", rowsIns, 2).Build() + new QueryBuilder.SQLUpdate(rowsUpd).Build(); return(result); }
protected void ReservationConfirm_Click(object sender, EventArgs e) { // Input checks if (String.IsNullOrEmpty(ChosenSeatString.Value)) { RaiseAlert("Minimum et sæde skal vælges."); return; } // Initialize variables int ScreeningId = Convert.ToInt32(Request.QueryString["Id"]); int UserId = 0; List <ResourceDTO> Resource = new List <ResourceDTO>(); ResourceDTO resourceSingle = new ResourceDTO(); SQLConnector con = new SQLConnector(); Resource = con.GetAll("Resource", "LoginName", Context.User.Identity.Name, typeof(string)).Cast <ResourceDTO>().ToList(); try { resourceSingle = Resource[0]; } catch (Exception) { throw; } UserId = resourceSingle.Id; MovieScreeningDTO MovieScreeningSingle = new MovieScreeningDTO(); List <MovieScreeningDTO> MovieScreening = new List <MovieScreeningDTO>(); MovieScreening = con.GetAll("MovieScreening", "ScreeningId", ScreeningId.ToString(), typeof(int)).Cast <MovieScreeningDTO>().ToList(); try { MovieScreeningSingle = MovieScreening[0]; } catch (Exception) { return; } List <String> ConfirmedSeats; ConfirmedSeats = ChosenSeatString.Value.Split(',').ToList(); ReservationDTO Reservation = new ReservationDTO() { ResourceId = UserId, ScreeningId = ScreeningId }; // Ensure that other users haven't reserved we're about to insert. // Get existing reservations List <ReservationDTO> ExistingReservation = new List <ReservationDTO>(); ExistingReservation = con.GetAll("Reservation", "ScreeningId", ScreeningId.ToString(), typeof(int)).Cast <ReservationDTO>().ToList(); // Only check against ConfirmedSeats if there are existing reservations if (ExistingReservation.Count() > 0) { foreach (var item in ConfirmedSeats) { if (ExistingReservation.Where(x => x.SeatId == Convert.ToInt32(item.Substring(12))).Count() > 0) { Response.Redirect("~/MovieReservation?ScreeningId=" + ScreeningId.ToString() + "\""); RaiseAlert("Sæderne er ikke længere ledige - prøv igen"); return; } } } // Opret nye reservationer foreach (var item in ConfirmedSeats) { Reservation.SeatId = Convert.ToInt32(item.Substring(12)); // Create screening con.CreateObject(Reservation); } // Redirect to same page string strMessage = string.Format("Hej {0}, tak for din bestilling!\r\n\r\nDu har reserveret {1} {3} til filmen {2}\r\n\r\nMvh.\r\nTEC BioBooking!", resourceSingle.FirstName, ConfirmedSeats.Count().ToString(), MovieScreeningSingle.MovieTitle, (ConfirmedSeats.Count() == 1 ? "billet" : "billetter")); string strSubject = string.Format("Tak for din bestilling"); Mailor mailor = new Mailor(); mailor.SendMail(resourceSingle.Email, strSubject, strMessage); Response.Redirect("/MovieReservation?Id=" + ScreeningId.ToString() + "&Done=1"); }
public RegConsumible(SQLConnector conecc) { InitializeComponent(); conexion = conecc; }
public static string CreatureText() { if (Storage.CreatureTexts.IsEmpty()) { return(string.Empty); } if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_text)) { return(string.Empty); } // For each sound and emote, if the time they were send is in the +1/-1 seconds range of // our texts, add that sound and emote to our Storage.CreatureTexts foreach (var text in Storage.CreatureTexts) { // For each text foreach (var textValue in text.Value) { // For each emote foreach (var emote in Storage.Emotes) { // Emote packets always have a sender (guid); // skip this one if it was sent by a different creature if (emote.Key.GetEntry() != text.Key) { continue; } foreach (var emoteValue in emote.Value) { var timeSpan = textValue.Item2 - emoteValue.Item2; if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1)) { textValue.Item1.Emote = emoteValue.Item1; } } } // For each sound foreach (var sound in Storage.Sounds) { var timeSpan = textValue.Item2 - sound.Item2; if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1)) { textValue.Item1.Sound = sound.Item1; } } } } /* can't use compare DB without knowing values of groupid or id * var entries = Storage.CreatureTexts.Keys.ToList(); * var creatureTextDb = SQLDatabase.GetDict<uint, CreatureText>(entries); */ const string tableName = "creature_text"; var rows = new List <QueryBuilder.SQLInsertRow>(); foreach (var text in Storage.CreatureTexts) { foreach (var textValue in text.Value) { var row = new QueryBuilder.SQLInsertRow(); var query = new StringBuilder(string.Format("SELECT Id FROM {1}.broadcast_text WHERE MaleText='{0}' OR FemaleText='{0}';", MySqlHelper.DoubleQuoteString(textValue.Item1.Text), Settings.TDBDatabase)); string broadcastTextId = ""; if (Settings.DevMode) { using (var reader = SQLConnector.ExecuteQuery(query.ToString())) { if (reader != null) { while (reader.Read()) { var values = new object[1]; var count = reader.GetValues(values); if (count != 1) { break; // error in query } if (!String.IsNullOrWhiteSpace(broadcastTextId)) { broadcastTextId += " - " + Convert.ToInt32(values[0]); } else { broadcastTextId += Convert.ToInt32(values[0]); } } } } } row.AddValue("entry", text.Key); row.AddValue("groupid", "x", false, true); row.AddValue("id", "x", false, true); row.AddValue("text", textValue.Item1.Text); row.AddValue("type", textValue.Item1.Type); row.AddValue("language", textValue.Item1.Language); row.AddValue("probability", 100.0); row.AddValue("emote", textValue.Item1.Emote); row.AddValue("duration", 0); row.AddValue("sound", textValue.Item1.Sound); if (Settings.DevMode) { row.AddValue("BroadcastTextID", broadcastTextId); } row.AddValue("comment", textValue.Item1.Comment); rows.Add(row); } } return(new QueryBuilder.SQLInsert(tableName, rows, 1, false).Build()); }
public AltaCliente(SQLConnector conec) { InitializeComponent(); inicializar(); conexion = conec; }
public ABMHabitacion(SQLConnector conec, UsuarioLogueado user) { InitializeComponent(); conexion = conec; hotelId = user.getHotelAsignado(); }
// Use this for initialization public SQLConnector() { if (s_Instance == null) s_Instance = this; }
public static string Gossip() { // TODO: This should be rewritten if (Storage.Gossips.IsEmpty()) { return(string.Empty); } var result = ""; // `gossip` if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gossip_menu)) { if (SQLConnector.Enabled) { var query = new StringBuilder(string.Format("SELECT `entry`,`text_id` FROM {0}.`gossip_menu` WHERE ", Settings.TDBDatabase)); foreach (Tuple <uint, uint> gossip in Storage.Gossips.Keys()) { query.Append("(`entry`=").Append(gossip.Item1).Append(" AND "); query.Append("`text_id`=").Append(gossip.Item2).Append(") OR "); } query.Remove(query.Length - 4, 4).Append(";"); var rows = new List <QueryBuilder.SQLInsertRow>(); using (var reader = SQLConnector.ExecuteQuery(query.ToString())) { if (reader != null) { while (reader.Read()) { var values = new object[2]; var count = reader.GetValues(values); if (count != 2) { break; // error in query } var entry = Convert.ToUInt32(values[0]); var textId = Convert.ToUInt32(values[1]); // our table is small, 2 fields and both are PKs; no need for updates if (!Storage.Gossips.ContainsKey(Tuple.Create(entry, textId))) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("entry", entry); row.AddValue("text_id", textId); row.Comment = StoreGetters.GetName(StoreNameType.Unit, // BUG: GOs can send gossips too (int)entry, false); rows.Add(row); } } } } result += new QueryBuilder.SQLInsert("gossip_menu", rows, 2).Build(); } else { var rows = new List <QueryBuilder.SQLInsertRow>(); foreach (var gossip in Storage.Gossips) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("entry", gossip.Key.Item1); row.AddValue("text_id", gossip.Key.Item2); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.Item1.ObjectType), (int)gossip.Value.Item1.ObjectEntry, false); rows.Add(row); } result += new QueryBuilder.SQLInsert("gossip_menu", rows, 2).Build(); } } // `gossip_menu_option` if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gossip_menu_option)) { if (SQLConnector.Enabled) { var rowsIns = new List <QueryBuilder.SQLInsertRow>(); var rowsUpd = new List <QueryBuilder.SQLUpdateRow>(); foreach (var gossip in Storage.Gossips) { if (gossip.Value.Item1.GossipOptions == null) { continue; } foreach (var gossipOption in gossip.Value.Item1.GossipOptions) { var query = // 0 1 2 3 4 5 6 string.Format( "SELECT menu_id,id,option_icon,box_coded,box_money,box_text,option_text " + "FROM {2}.gossip_menu_option WHERE menu_id={0} AND id={1};", gossip.Key.Item1, gossipOption.Index, Settings.TDBDatabase); using (var reader = SQLConnector.ExecuteQuery(query)) { if (reader.HasRows) // possible update { while (reader.Read()) { var row = new QueryBuilder.SQLUpdateRow(); if (!Utilities.EqualValues(reader.GetValue(2), gossipOption.OptionIcon)) { row.AddValue("option_icon", gossipOption.OptionIcon); } if (!Utilities.EqualValues(reader.GetValue(3), gossipOption.Box)) { row.AddValue("box_coded", gossipOption.Box); } if (!Utilities.EqualValues(reader.GetValue(4), gossipOption.RequiredMoney)) { row.AddValue("box_money", gossipOption.RequiredMoney); } if (!Utilities.EqualValues(reader.GetValue(5), gossipOption.BoxText)) { row.AddValue("box_text", gossipOption.BoxText); } if (!Utilities.EqualValues(reader.GetValue(6), gossipOption.OptionText)) { row.AddValue("option_text", gossipOption.OptionText); } row.AddWhere("menu_id", gossip.Key.Item1); row.AddWhere("id", gossipOption.Index); row.Comment = StoreGetters.GetName( Utilities.ObjectTypeToStore(gossip.Value.Item1.ObjectType), (int)gossip.Value.Item1.ObjectEntry, false); row.Table = "gossip_menu_option"; if (row.ValueCount != 0) { rowsUpd.Add(row); } } } else // insert { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("menu_id", gossip.Key.Item1); row.AddValue("id", gossipOption.Index); row.AddValue("option_icon", gossipOption.OptionIcon); row.AddValue("option_text", gossipOption.OptionText); row.AddValue("box_coded", gossipOption.Box); row.AddValue("box_money", gossipOption.RequiredMoney); row.AddValue("box_text", gossipOption.BoxText); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.Item1.ObjectType), (int)gossip.Value.Item1.ObjectEntry, false); rowsIns.Add(row); } } } } result += new QueryBuilder.SQLInsert("gossip_menu_option", rowsIns, 2).Build() + new QueryBuilder.SQLUpdate(rowsUpd).Build(); } else { var rows = new List <QueryBuilder.SQLInsertRow>(); foreach (var gossip in Storage.Gossips) { if (gossip.Value.Item1.GossipOptions != null) { foreach (var gossipOption in gossip.Value.Item1.GossipOptions) { var row = new QueryBuilder.SQLInsertRow(); row.AddValue("menu_id", gossip.Key.Item1); row.AddValue("id", gossipOption.Index); row.AddValue("option_icon", gossipOption.OptionIcon); row.AddValue("option_text", gossipOption.OptionText); row.AddValue("box_coded", gossipOption.Box); row.AddValue("box_money", gossipOption.RequiredMoney); row.AddValue("box_text", gossipOption.BoxText); row.Comment = StoreGetters.GetName(Utilities.ObjectTypeToStore(gossip.Value.Item1.ObjectType), (int)gossip.Value.Item1.ObjectEntry, false); rows.Add(row); } } } result += new QueryBuilder.SQLInsert("gossip_menu_option", rows, 2).Build(); } } return(result); }
public ListadoHotel(string criterio, SQLConnector conec) { InitializeComponent(); criterioABM = criterio; conexion = conec; }
public override void doRuleQuickFix(SQLConnector eaConnector, SQLRepository repository, int i, String errorMessage) { }
public override void refreshSQLObject() { this.EaConnector = Repository.GetConnectorByID(EaConnector.ConnectorID); }
public static void InitializeTests(TestContext tc) { sc = new SQLConnector(); }
private static void Main(string[] args) { SetUpConsole(); var files = args.ToList(); if (files.Count == 0) { PrintUsage(); return; } // config options are handled in Misc.Settings Utilities.RemoveConfigOptions(ref files); if (!Utilities.GetFiles(ref files)) { EndPrompt(); return; } Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; if (Settings.UseDBC) { var startTime = DateTime.Now; DBC.DBC.Load(); var span = DateTime.Now.Subtract(startTime); Trace.WriteLine($"DBC loaded in { span.ToFormattedString() }."); } // Disable DB when we don't need its data (dumping to a binary file) if (!Settings.DumpFormatWithSQL()) { SQLConnector.Enabled = false; SSHTunnel.Enabled = false; } else { Filters.Initialize(); } SQLConnector.ReadDB(); var count = 0; foreach (var file in files) { SessionHandler.ZStreams.Clear(); if (Settings.ClientBuild != Enums.ClientVersionBuild.Zero) { ClientVersion.SetVersion(Settings.ClientBuild); } ClientLocale.SetLocale(Settings.ClientLocale.ToString()); try { var sf = new SniffFile(file, Settings.DumpFormat, Tuple.Create(++count, files.Count)); sf.ProcessFile(); } catch (IOException ex) { Console.WriteLine($"Can't process {file}. Skipping. Message: {ex.Message}"); } } if (!string.IsNullOrWhiteSpace(Settings.SQLFileName) && Settings.DumpFormatWithSQL()) { Builder.DumpSQL("Dumping global sql", Settings.SQLFileName, SniffFile.GetHeader("multi")); } SQLConnector.Disconnect(); SSHTunnel.Disconnect(); if (Settings.LogErrors) { Logger.WriteErrors(); } Trace.Listeners.Remove("ConsoleMirror"); EndPrompt(); }
public ABMCliente(SQLConnector conexion) { InitializeComponent(); coneccion = conexion; }
private static void Main(string[] args) { SetUpConsole(); var files = args.ToList(); if (files.Count == 0) { PrintUsage(); return; } // config options are handled in Misc.Settings Utilities.RemoveConfigOptions(ref files); if (!Utilities.GetFiles(ref files)) { EndPrompt(); return; } Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; if (Settings.FilterPacketNumLow < 0) { throw new ConstraintException("FilterPacketNumLow must be positive"); } if (Settings.FilterPacketNumHigh < 0) { throw new ConstraintException("FilterPacketNumHigh must be positive"); } if (Settings.FilterPacketNumLow > 0 && Settings.FilterPacketNumHigh > 0 && Settings.FilterPacketNumLow > Settings.FilterPacketNumHigh) { throw new ConstraintException("FilterPacketNumLow must be less or equal than FilterPacketNumHigh"); } // Disable DB when we don't need its data (dumping to a binary file) if (Settings.DumpFormat == DumpFormatType.None || Settings.DumpFormat == DumpFormatType.Pkt || Settings.DumpFormat == DumpFormatType.PktSplit || Settings.DumpFormat == DumpFormatType.SniffDataOnly) { SQLConnector.Enabled = false; SSHTunnel.Enabled = false; } else { Filters.Initialize(); } SQLConnector.ReadDB(); var count = 0; foreach (var file in files) { SessionHandler.z_streams.Clear(); ClientVersion.SetVersion(Settings.ClientBuild); new SniffFile(file, Settings.DumpFormat, Tuple.Create(++count, files.Count)).ProcessFile(); } if (!String.IsNullOrWhiteSpace(Settings.SQLFileName)) { Builder.DumpSQL("Dumping global sql", Settings.SQLFileName, "# multiple files\n"); } SQLConnector.Disconnect(); SSHTunnel.Disconnect(); Logger.WriteErrors(); EndPrompt(); }
protected void Page_Load(object sender, EventArgs e) { SQLConnector Connector = new SQLConnector(); List <MovieDTO> ListMovies = new List <MovieDTO>(); ListMovies = Connector.GetAll("Movie").Cast <MovieDTO>().ToList(); if (ListMovies.Count > 0) { foreach (MovieDTO movie in ListMovies) { //Wrapper div HtmlGenericControl tempWrapperDiv = new HtmlGenericControl("DIV"); tempWrapperDiv.Attributes["class"] = "row"; BodyDiv.Controls.Add(tempWrapperDiv); //Adding div for movie HtmlGenericControl tempMovieDiv = new HtmlGenericControl("DIV"); tempMovieDiv.Attributes["class"] = "col-md-12"; string tempStringDivId = "div-mov-" + movie.Id; tempMovieDiv.Attributes["Id"] = tempStringDivId; tempWrapperDiv.Controls.Add(tempMovieDiv); //Adding div for poster HtmlGenericControl tempPosterDiv = new HtmlGenericControl("DIV"); tempPosterDiv.Attributes["class"] = "col-md-4 class"; string tempStringPosterDivId = "div-poster-" + movie.Id; tempPosterDiv.Attributes["Id"] = tempStringPosterDivId; tempMovieDiv.Controls.Add(tempPosterDiv); //Adding poster img to poster div HtmlGenericControl tempMoviePosterImg = new HtmlGenericControl("IMG"); tempMoviePosterImg.Attributes["src"] = "/content/images/" + movie.PosterFileName; tempMoviePosterImg.Attributes["height"] = "450px"; tempMoviePosterImg.Attributes["width"] = "300px"; string tempStringPosterImgId = "img-poster-" + movie.Id; tempMoviePosterImg.Attributes["Id"] = tempStringPosterImgId; tempPosterDiv.Controls.Add(tempMoviePosterImg); //Adding div for movie details HtmlGenericControl tempDetailDiv = new HtmlGenericControl("DIV"); tempDetailDiv.Attributes["class"] = "col-md-8"; string tempStringDetailDivId = "div-detail-" + movie.Id; tempDetailDiv.Attributes["Id"] = tempStringDetailDivId; tempMovieDiv.Controls.Add(tempDetailDiv); //Adding label for movie in movie detail div HtmlGenericControl tempH1Title = new HtmlGenericControl("H1"); tempH1Title.InnerHtml = movie.Title; tempDetailDiv.Controls.Add(tempH1Title); //Adding description for movie in movie detail div HtmlGenericControl tempDescription = new HtmlGenericControl("P"); tempDescription.InnerText = movie.Description; tempDetailDiv.Controls.Add(tempDescription); //Adding link to screenings for movie HtmlGenericControl tempLink = new HtmlGenericControl("A"); tempLink.Attributes["href"] = "/showscreenings.aspx?Id=" + movie.Id; tempLink.InnerHtml = "Visninger."; tempDetailDiv.Controls.Add(tempLink); HtmlGenericControl tempLineBreak = new HtmlGenericControl("BR"); BodyDiv.Controls.Add(tempLineBreak); } } //string strTemp = ""; //foreach (PropertyInfo pi in Context.User.Identity.GetType().GetProperties()) //{ // strTemp += pi.Name + ": " + pi.PropertyType + ": " + pi.GetValue(Context.User.Identity) + "<br/>"; //} //testLabel.Text = strTemp; }
public Principal() { InitializeComponent(); coneccion = new SQLConnector(); }