Exemplo n.º 1
0
        private void ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("medics").Where("Id", ItemsList.SelectedItem.ToString()).And("Name", SearchBox.Text).Execute();
            MySqlReader r = new MySqlReader(cmd);

            Clear();
            if (r.Read())
            {
                ItemId               = r.ReadInt64("Id");
                MName.Text           = r.ReadString("Name");
                MSS.Text             = r.ReadString("ScientificName");
                MSUP.Text            = r.ReadString("Supplier");
                Ptype                = r.ReadByte("Type");
                MExist.Text          = r.ReadDecimal("Total").ToString();
                MPrice.Text          = r.ReadDecimal("SPrice").ToString();
                MEX.Text             = r.ReadString("ExpirationDate");
                MNotes.Text          = r.ReadString("Notes");
                SearchBox.Foreground = Brushes.Green;
                if (Convert.ToDecimal(MExist.Text) < 1)
                {
                    MExist.Foreground = Brushes.Red;
                    Console.WriteLine("You have no - " + MName.Text + " - I believe that you should get new ones");
                }
                if (Convert.ToDateTime(MEX.Text) <= DateTime.Now.Date)
                {
                    MEX.Background = Brushes.Red;
                    MEX.Foreground = Brushes.OrangeRed;
                    Console.WriteLine("Exy exy - " + MName.Text + " - I believe that you should get rid of that");
                }
                MTypeFromToNo();
                Console.WriteLine("Searched for - " + MName.Text + " -");
            }
        }
Exemplo n.º 2
0
        public static Patient LoadPatient(uint PatientId)
        {
            Patient patient = null;

            using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("patient").Where("PatientId", PatientId))
                using (var reader = new MySqlReader(cmd))
                {
                    if (reader.Read())
                    {
                        patient = new Patient(reader.ReadInt32("PatientId"),
                                              reader.ReadInt32("Age"),
                                              (Gender)reader.ReadByte("Gender"),
                                              reader.ReadString("PatientName"),
                                              reader.ReadString("PhoneNumber"),
                                              reader.ReadString("Address"));
                    }
                }
            if (patient != null)
            {
                using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("history").Where("PatientId", PatientId))
                    using (var reader = new MySqlReader(cmd))
                    {
                        while (reader.Read())
                        {
                            patient.insertNewHistory($"[{DateTime.FromBinary(reader.ReadInt64("Date"))}] ==> {reader.ReadString("History")}");
                        }
                    }
            }
            return(patient);
        }
Exemplo n.º 3
0
 private void SearchB_Click(object sender, EventArgs e)
 {
     clear();
     try
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("medics").Where("Name", SearchT.Text).Execute();
         MySqlReader r = new MySqlReader(cmd);
         if (r.Read())
         {
             PName.Text   = r.ReadString("Name");
             PSubS.Text   = r.ReadString("Substance");
             Ptype        = r.ReadByte("Type");
             PTottal.Text = r.ReadUInt32("Count").ToString();
             PCost.Text   = r.ReadString("Price");
             PEXP.Text    = r.ReadString("Expiry");
             Pnote.Text   = r.ReadString("Note");
             ptype();
             FP.ForeColor = Color.Green;
             FP.Text      = "وجد الدواء";
             FP.Visible   = true;
         }
         else
         {
             FP.ForeColor = Color.Red;
             FP.Text      = "لم يعثر على شئ";
             FP.Visible   = true;
         }
     }
     catch (Exception ef)
     {
         Program.SaveException(ef);
     }
 }
Exemplo n.º 4
0
Arquivo: Mains.cs Projeto: iodz37/Iodz
 public static void Save()
 {
     try
     {
         using (var conn = Database.DataHolder.MySqlConnection)
         {
             conn.Open();
             foreach (Client.GameClient client in Kernel.GamePool.Values)
             {
                 client.Account.Save(client);
                 Database.EntityTable.SaveEntity(client, conn);
                 Database.DailyQuestTable.Save(client);
                 Database.SkillTable.SaveProficiencies(client, conn);
                 Database.ActivenessTable.Save(client);
                 Database.ChiTable.Save(client);
                 Database.SkillTable.SaveSpells(client, conn);
                 Database.MailboxTable.Save(client);
                 Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic, client.CP, conn);
                 Database.TeamArenaTable.SaveArenaStatistics(client.TeamArenaStatistic, conn);
             }
         }
         Conquord.Database.JiangHu.SaveJiangHu();
         AuctionBase.Save();
         Database.Flowers.LoadFlowers();
         Database.InnerPowerTable.Save();
         Database.EntityVariableTable.Save(0, Vars);
         using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
         {
             cmd.Select("configuration");
             using (MySqlReader r = new MySqlReader(cmd))
             {
                 if (r.Read())
                 {
                     new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ServerKingdom", Kernel.ServerKingdom).Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Set("GuildID", Game.ConquerStructures.Society.Guild.GuildCounter.Now).Set("UnionID", Union.UnionCounter.Now).Execute();
                     if (r.ReadByte("LastDailySignReset") != DateTime.Now.Month)
                     {
                         MsgSignIn.Reset();
                     }
                 }
             }
         }
         using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration"))
             cmd.Set("LastDailySignReset", DateTime.Now.Month).Execute();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemplo n.º 5
0
        private void UNList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Label1.Visibility = Visibility.Hidden;
            MySqlCommand cmd1 = new MySqlCommand(MySqlCommandType.SELECT);

            cmd1.Select("accounts").Where("Username", UNList.SelectedItem.ToString()).Execute();
            MySqlReader r = new MySqlReader(cmd1);

            if (r.Read())
            {
                try
                {
                    byte state;
                    state = r.ReadByte("State");
                    switch (state)
                    {
                    case 2:
                        RUState.Text = "مدير";
                        break;

                    case 1:
                        RUState.Text = "موظف";
                        break;

                    case 0:
                        RUState.Text = "مجهول";
                        break;
                    }
                    RUState.SelectedItem = RUState.Text;
                    PHN.Text             = r.ReadString("Phone");
                }
                catch (Exception ex)
                {
                    Kernel.Core.SaveException(ex);
                }
            }
        }
Exemplo n.º 6
0
 private void SearchButton_Click(object sender, RoutedEventArgs e)
 {
     Clear();
     try
     {
         if (ByBarCode.IsChecked == true)
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
             cmd.Select("medics").Where("Barcode", SearchBox.Text).Execute();
             MySqlReader r = new MySqlReader(cmd);
             if (r.Read())
             {
                 ItemId               = r.ReadInt64("Id");
                 MName.Text           = r.ReadString("Name");
                 MSS.Text             = r.ReadString("ScientificName");
                 MSUP.Text            = r.ReadString("Supplier");
                 Ptype                = r.ReadByte("Type");
                 MExist.Text          = r.ReadDecimal("Total").ToString();
                 MPrice.Text          = r.ReadDecimal("SPrice").ToString();
                 MEX.Text             = r.ReadString("ExpirationDate");
                 MNotes.Text          = r.ReadString("Notes");
                 SearchBox.Foreground = Brushes.Green;
                 if (Convert.ToDecimal(MExist.Text) < 1)
                 {
                     MExist.Foreground = Brushes.Red;
                     Console.WriteLine("You have no - " + MName.Text + " - " + ItemId + " - I believe that you should get new ones");
                 }
                 if (Convert.ToDateTime(MEX.Text) <= DateTime.Now.Date)
                 {
                     MEX.Background = Brushes.Red;
                     MEX.Foreground = Brushes.OrangeRed;
                     Console.WriteLine("bad deadpool - " + MName.Text + " - " + ItemId + " - you should get rid of that");
                 }
                 Console.WriteLine("Searched for - " + MName.Text + " - " + ItemId + " -");
             }
             else
             {
                 SearchBox.Foreground = Brushes.Red;
                 Console.WriteLine("Searched for - " + SearchBox.Text + " - with no luck");
             }
             r.Close();
             ItemsList.Items.Clear();
             while (r.Read())
             {
                 ItemsList.Items.Add(r.ReadInt64("Id"));
             }
             if (ItemsList.Items.Count < 1)
             {
                 ItemsList.Items.Clear();
                 ItemsList.Items.Add("لا يوجد شئ اخر");
             }
             r.Close();
         }
         else if (ByBarCode.IsChecked == false)
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
             cmd.Select("medics").Where("Name", SearchBox.Text).Execute();
             MySqlReader r = new MySqlReader(cmd);
             if (r.Read())
             {
                 ItemId               = r.ReadInt64("Id");
                 MName.Text           = r.ReadString("Name");
                 MSS.Text             = r.ReadString("ScientificName");
                 MSUP.Text            = r.ReadString("Supplier");
                 Ptype                = r.ReadByte("Type");
                 MExist.Text          = r.ReadDecimal("Total").ToString();
                 MPrice.Text          = r.ReadDecimal("SPrice").ToString();
                 MEX.Text             = r.ReadString("ExpirationDate");
                 MNotes.Text          = r.ReadString("Notes");
                 SearchBox.Foreground = Brushes.Green;
                 if (Convert.ToDecimal(MExist.Text) < 1)
                 {
                     MExist.Foreground = Brushes.Red;
                     Console.WriteLine("You have no - " + MName.Text + " - I believe that you should get new ones");
                 }
                 if (Convert.ToDateTime(MEX.Text) <= DateTime.Now.Date)
                 {
                     MEX.Background = Brushes.Red;
                     MEX.Foreground = Brushes.OrangeRed;
                     Console.WriteLine("Red Alert - " + MName.Text + " - you should get rid of that");
                 }
                 Console.WriteLine("Searched for - " + MName.Text + " -");
             }
             else
             {
                 SearchBox.Foreground = Brushes.Red;
                 Console.WriteLine("Searched for - " + SearchBox.Text + " - with no luck");
             }
             ItemsList.Items.Clear();
             while (r.Read())
             {
                 ItemsList.Items.Add(r.ReadInt64("Id"));
             }
             if (ItemsList.Items.Count < 1)
             {
                 ItemsList.Items.Clear();
                 ItemsList.Items.Add("لا يوجد شئ اخر");
             }
             r.Close();
         }
         MTypeFromToNo();
     }
     catch (Exception ex)
     {
         Core.SaveException(ex);
     }
     SearchBox.Items.Refresh();
 }
Exemplo n.º 7
0
Arquivo: Mains.cs Projeto: iodz37/Iodz
        public static void LoadServer(bool KnowConfig)
        {
            Time32 Start = Time32.Now;

            RandomSeed    = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2));
            Console.Title = "Conquord Is Loading...";
            Kernel.Random = new FastRandom(RandomSeed);
            if (!KnowConfig)
            {
                ConquordDBName = "test";
                ConquordDBPass = "******";
                ConquordIP     = "149.202.128.35";
            }
            System.Console.ForegroundColor = ConsoleColor.DarkGray;
            IntPtr hWnd = FindWindow(null, Console.Title);

            System.Console.WriteLine(@"      `       ______                                       __   `     `      ");
            System.Console.WriteLine(@"             / ____/___  ____  ____ ___  ______  _________/ /                ");
            System.Console.WriteLine(@"        `   / /   / __ \/ __ \/ __ `/ / / / __ \/ ___/ __  /  `      `    _  ");
            System.Console.WriteLine(@"          _/ /___/ /_/ / / / / /_/ / /_/ / /_/ / /  / /_/ /              | | ");
            System.Console.WriteLine(@"   `       \____/\____/_/ /_/\__, /\__,_/\____/_/   \__,_/        `   ___| | ");
            System.Console.WriteLine(@"         `                     /_/            `               `      (    .' ");
            System.Console.WriteLine(@" __        ...       _____ Michael Nashaat _____        ...       __  )  (   ");
            System.Console.WriteLine();
            System.Console.WriteLine(@"                  Copyright (c) Conquord Project 2015-2016.                  ");
            Console.BackgroundColor        = ConsoleColor.Black;
            System.Console.ForegroundColor = ConsoleColor.DarkGray;
            Database.DataHolder.CreateConnection(ConquordDBName, ConquordDBPass);
            Database.EntityTable.EntityUID = new Counter(0);
            new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Execute();
            using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
            {
                cmd.Select("configuration");
                using (MySqlReader r = new MySqlReader(cmd))
                {
                    if (r.Read())
                    {
                        if (!KnowConfig)
                        {
                            ConquordIP = r.ReadString("ConquordIP");
                            GamePort   = 5816;
                            AuthPort   = r.ReadUInt16("ConquordPort");
                        }
                        Database.EntityTable.EntityUID = new Counter(r.ReadUInt32("EntityID"));
                        if (Database.EntityTable.EntityUID.Now == 0)
                        {
                            Database.EntityTable.EntityUID.Now = 1;
                        }
                        Union.UnionCounter   = new Counter(r.ReadUInt32("UnionID"));
                        Kernel.ServerKingdom = (r.ReadUInt32("ServerKingdom"));
                        if (r.ReadByte("LastDailySignReset") != DateTime.Now.Month)
                        {
                            MsgSignIn.Reset();
                        }
                        Game.ConquerStructures.Society.Guild.GuildCounter = new Conquord.Counter(r.ReadUInt32("GuildID"));
                        Network.GamePackets.ConquerItem.ItemUID           = new Conquord.Counter(r.ReadUInt32("ItemUID"));
                        Constants.ExtraExperienceRate   = r.ReadUInt32("ExperienceRate");
                        Constants.ExtraSpellRate        = r.ReadUInt32("SpellExperienceRate");
                        Constants.ExtraProficiencyRate  = r.ReadUInt32("ProficiencyExperienceRate");
                        Constants.MoneyDropRate         = r.ReadUInt32("MoneyDropRate");
                        Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate");
                        Constants.ItemDropRate          = r.ReadUInt32("ItemDropRate");
                        Constants.ItemDropQualityRates  = r.ReadString("ItemDropQualityString").Split('~');
                        Database.EntityVariableTable.Load(0, out Vars);
                    }
                }
            }
            using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration"))
                cmd.Set("LastDailySignReset", DateTime.Now.Month).Execute();
            Database.JiangHu.LoadStatus();
            Database.JiangHu.LoadJiangHu();
            Console.WriteLine("JiangHu Loaded.");
            Way2Heroes.Load();
            QuestInfo.Load();
            AuctionBase.Load();
            Database.DataHolder.ReadStats();
            Conquord.Soul.SoulProtection.Load();
            Database.PerfectionTable.Load();
            Console.WriteLine("Perfection Loaded.");
            Database.LotteryTable.Load();
            Database.ConquerItemTable.ClearNulledItems();
            Database.ConquerItemInformation.Load();
            Console.WriteLine("Items Loaded.");
            Database.GameUpdetess.LoadRates();
            Database.MonsterInformation.Load();
            Database.IPBan.Load();
            Database.SpellTable.Load();
            Database.ShopFile.Load();
            Database.HonorShop.Load();
            Database.RacePointShop.Load();
            Database.ChampionShop.Load();
            Database.EShopFile.Load();
            Database.EShopV2File.Load();
            Console.WriteLine("Shops Loaded.");
            Database.MapsTable.Load();
            Database.Flowers.LoadFlowers();
            Database.Flowers.SaveFlowers();
            Console.WriteLine("Flowers Systems Loaded.");
            Database.NobilityTable.Load();
            Database.ArenaTable.Load();
            Database.TeamArenaTable.Load();
            Database.GuildTable.Load();
            Database.ChiTable.LoadAllChi();
            Console.WriteLine("Social Systems Loaded.");
            Refinery.LoadItems();
            StorageManager.Load();
            UnionTable.Load();
            Console.WriteLine("Union Loaded.");
            World = new World();
            World.Init();
            Database.Statue.Load();
            Console.WriteLine("Tops And Quests Loaded.");
            Database.PoketTables.LoadTables();
            Database.InnerPowerTable.LoadDBInformation();
            Database.InnerPowerTable.Load();
            Console.WriteLine("InnerPower Loaded.");
            Map.CreateTimerFactories();
            Database.SignInTable.Load();
            Database.DMaps.Load();
            Console.WriteLine("Maps Loaded.");
            Game.Screen.CreateTimerFactories();
            World.CreateTournaments();
            Game.GuildWar.Initiate();
            Game.ClanWar.Initiate();
            Game.Tournaments.SkillTournament.LoadSkillTop8();
            Game.Tournaments.TeamTournament.LoadTeamTop8();
            Clan.LoadClans();
            Game.EliteGuildWar.EliteGwint();
            Console.WriteLine("Guilds and Clans loaded.");
            Booths.Load();
            Console.WriteLine("Booths Loaded.");

            Database.FloorItemTable.Load();
            Database.ReincarnationTable.Load();
            new MsgUserAbilityScore().GetRankingList();
            new MsgEquipRefineRank().UpdateRanking();
            PrestigeRank.LoadRanking();
            Console.WriteLine("Ranks Loaded.");
            BruteForceProtection.CreatePoll();
            Console.WriteLine("Protection System On.");
            {
                Client.GameClient gc = new Client.GameClient(new ClientWrapper());
                gc.Account      = new AccountTable("NONE");
                gc.Socket.Alive = false;
                gc.Entity       = new Entity(EntityFlag.Player, false)
                {
                    Name = "NONE"
                };
                Npcs.GetDialog(new NpcRequest(), gc, true);
            }
            #region OpenSocket
            Network.Cryptography.AuthCryptography.PrepareAuthCryptography();
            AuthServer = new ServerSocket();
            AuthServer.OnClientConnect    += AuthServer_OnClientConnect;
            AuthServer.OnClientReceive    += AuthServer_OnClientReceive;
            AuthServer.OnClientDisconnect += AuthServer_OnClientDisconnect;
            AuthServer.Enable(AuthPort, "0.0.0.0");
            GameServer = new ServerSocket();
            GameServer.OnClientConnect    += GameServer_OnClientConnect;
            GameServer.OnClientReceive    += GameServer_OnClientReceive;
            GameServer.OnClientDisconnect += GameServer_OnClientDisconnect;
            GameServer.Enable(GamePort, "0.0.0.0");
            #endregion
            Console.WriteLine("Server loaded iN : " + (Time32.Now - Start) + " MilliSeconds.");
            ConquordHandler += ConquordConsole_CloseEvent;
            Native.SetConsoleCtrlHandler(ConquordHandler, true);
            GC.Collect();
            WorkConsole();
        }