Пример #1
0
 private void ADName_KeyDown(object sender, KeyEventArgs e)
 {
     if (AdName.IsDropDownOpen == false && AdName.Text.Length > 0)
     {
         AdName.IsDropDownOpen = true;
     }
     try
     {
         if (AdName.Text.Length == 0)
         {
             AdName.Items.Clear();
             return;
         }
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("medics").WhereLike("Name", AdName.Text);
         MySqlReader r = new MySqlReader(cmd);
         while (r.Read() && AdName.Items.Count <= 10)
         {
             AdName.Items.Add(r.ReadString("Name"));
         }
     }
     catch (Exception ex)
     {
         Core.SaveException(ex);
     }
 }
Пример #2
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);
     }
 }
Пример #3
0
 public static bool LoadEntity(Client.GameClient client)
 {
     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("characters").Where("UID", client.Account.EntityID))
         using (var reader = new MySqlReader(cmd))
         {
             if (reader.Read())
             {
                 try
                 {
                     client.Entity               = new Entity();
                     client.Entity.Owner         = client;
                     client.Entity.UID           = reader.ReadUInt32("UID");
                     client.Entity.Experience    = reader.ReadUInt32("Experience");
                     client.Entity.Clan          = reader.ReadString("Clan");
                     client.Entity.Name          = reader.ReadString("Name");
                     client.Entity.Deserion      = reader.ReadUInt32("Deserion");
                     client.Entity.GeneradeKills = reader.ReadUInt32("GeneradeKills");
                     client.Entity.GP            = reader.ReadUInt32("GP");
                     client.Entity.ZP            = reader.ReadUInt32("ZP");
                     client.Entity.MP            = reader.ReadUInt32("MP");
                     client.Entity.VIP           = reader.ReadBoolean("VIP");
                     client.Entity.HeadshotKills = reader.ReadUInt32("HeadshotKills");
                     client.Entity.KnifeKills    = reader.ReadUInt32("KnifeKills");
                     client.Entity.TeamKills     = reader.ReadUInt32("TeamKills");
                     client.Entity.Settings      = reader.ReadBlob("Settings");
                     client.Entity.Battles       = new System.Collections.Generic.List <Battle>();
                     byte[] Battles = reader.ReadBlob("Battles");
                     if (Battles.Length > 0)
                     {
                         using (var stream = new System.IO.MemoryStream(Battles))
                             using (var rdr = new System.IO.BinaryReader(stream))
                             {
                                 int count = rdr.ReadInt32();
                                 for (int i = 0; i < count; i++)
                                 {
                                     Battle battle = new Battle
                                     {
                                         GameMode = (Enums.GameMode)rdr.ReadByte(),
                                         Won      = rdr.ReadBoolean(),
                                         Kills    = rdr.ReadUInt16(),
                                         Deaths   = rdr.ReadUInt16()
                                     };
                                     client.Entity.Battles.Add(battle);
                                 }
                             }
                     }
                     return(true);
                 }
                 catch (Exception e)
                 {
                     Console.WriteLine(e);
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
 }
Пример #4
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);
        }
Пример #5
0
 private void BillsNoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (BillsNoList.SelectedIndex != -1)
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Where("ID", BillsNoList.SelectedItem.ToString());
         MySqlReader  r   = new MySqlReader(cmd);
         while (r.Read())
         {
             decimal TP = 0;
             BillContent.Clear();
             string AllBills = r.ReadString("Medics");
             BillContent.Text += "رقم الفاتورة : " + r.ReadString("ID") + "\r\n";
             BillContent.Text += "الموظف : " + r.ReadString("Cashier") + "\r\n";
             BillContent.Text += "المشترى : " + r.ReadString("ClientName") + "\r\n";
             BillContent.Text += "وقت البيع : " + r.ReadString("BillDate") + "\r\n";
             BillContent.Text += "----الادويه---------------------------------\r\n";
             string[] bills = AllBills.Split('#');
             foreach (string[] BillInfo in bills.TakeWhile(bill => bill.Length >= 2).Select(bill => bill.Split('~')))
             {
                 BillContent.Text += "الاسم : " + Convert.ToString(BillInfo[1]) + "  \t";
                 BillContent.Text += "الكمية : " + Convert.ToString(BillInfo[0]) + " \t";
                 BillContent.Text += "السعر : " + Convert.ToDecimal(BillInfo[2]) + "\r\n";
                 TP += Convert.ToDecimal(BillInfo[2]);
             }
             BillContent.Text += "--------------------------------------------\r\n";
             BillContent.Text += "الاجمالى = " + TP;
             BillContent.Text += "\r\n--------------------------------------------\r\n";
         }
         r.Close();
     }
 }
Пример #6
0
 private void SearchButton_Click(object sender, RoutedEventArgs e)
 {
     if (ByName.IsChecked == true)
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Where("ClientName", SearchBox.Text);
         MySqlReader  r   = new MySqlReader(cmd);
         BillsNoList.Items.Clear();
         while (r.Read())
         {
             BillsNoList.Items.Add(r.ReadString("ID"));
         }
         r.Close();
     }
     else
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Where("ID", SearchBox.Text);
         MySqlReader  r   = new MySqlReader(cmd);
         if (r.Read())
         {
             BillsNoList.Items.Clear();
             BillsNoList.Items.Add(r.ReadString("ID"));
         }
         r.Close();
     }
 }
Пример #7
0
 private void SearchBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (!SearchBox.Items.IsEmpty)
     {
         SearchBox.Items.Clear();
     }
     if (SearchBox.IsDropDownOpen == false)
     {
         SearchBox.IsDropDownOpen = true;
     }
     try
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("medics").WhereLike("Name", SearchBox.Text);
         MySqlReader r = new MySqlReader(cmd);
         while (r.Read() && SearchBox.Items.Count <= 10 && SearchBox.Text.Length > 0)
         {
             SearchBox.Items.Add(r.ReadString("Name"));
         }
     }
     catch (Exception ex)
     {
         Kernel.Core.SaveException(ex);
     }
 }
Пример #8
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 + " -");
            }
        }
Пример #9
0
        private void SellMedic()
        {
            uint tottal = 0;

            try
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("medics").Where("Name", PName.Text).Execute();
                MySqlReader r = new MySqlReader(cmd);
                if (r.Read())
                {
                    tottal = r.ReadUInt32("Count");
                }
                if (tottal > 0)
                {
                    tottal = --tottal;
                    PTottal.Clear();
                    PTottal.Text = tottal.ToString();
                    MySqlCommand CMD = new MySqlCommand(MySqlCommandType.UPDATE);
                    CMD.Update("medics")
                    .Set("Count", tottal);
                    CMD.Where("Name", PName.Text).Execute();
                    MessageBox.Show("تم بيع واحد");
                    SaveSold();
                }
                else
                {
                    MessageBox.Show("الدواء غير متوفر");
                }
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.ToString());
            }
        }
Пример #10
0
 private void comboBox2_TextChanged(object sender, EventArgs e)
 {
     if (SearchT.DroppedDown == false)
     {
         SearchT.DroppedDown = true;
         try
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT)
             {
                 Command = "select * from medics WHERE Name LIKE '%" + SearchT.Text + "%'"
             };
             MySqlReader r = new MySqlReader(cmd);
             while (r.Read())
             {
                 SearchT.Items.Add(r.ReadString("Name"));
             }
         }
         catch (Exception ef)
         {
             Program.SaveException(ef);
         }
     }
     else if (SearchT.Text == "" && SearchT.DroppedDown == true)
     {
         this.Focus();
     }
 }
Пример #11
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            decimal      TP  = 0;
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills")
                               .Where("ID", listBox1.GetItemText(listBox1.SelectedItem));
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                textBox1.Clear();
                string AllBills = r.ReadString("Medic");
                textBox1.Text += "رقم الفاتورة : " + r.ReadString("ID") + "\r\n";
                textBox1.Text += "الموظف : " + r.ReadString("User") + "\r\n";
                textBox1.Text += "المشترى : " + r.ReadString("Name") + "\r\n";
                textBox1.Text += "وقت البيع : " + r.ReadString("BillDate") + "\r\n";
                textBox1.Text += "----الادويه---------------------------------\r\n";
                string[] bills = AllBills.Split('#');
                foreach (string[] BillInfo in bills.TakeWhile(bill => bill.Length >= 2).Select(bill => bill.Split('~')))
                {
                    textBox1.Text += "الاسم : " + Convert.ToString(BillInfo[0]) + "  \t";
                    textBox1.Text += "السعر : " + Convert.ToDecimal(BillInfo[1]) + "\r\n";
                    TP            += Convert.ToDecimal(BillInfo[1]);
                }
                textBox1.Text += "--------------------------------------------\r\n";
                textBox1.Text += "الاجمالى = " + TP;
                textBox1.Text += "\r\n--------------------------------------------\r\n";
            }
            r.Close();
        }
Пример #12
0
 public AccountTable(string username)
 {
     if (username == null)
     {
         return;
     }
     this.Username = username;
     this.Password = "";
     this.IP       = "";
     this.State    = Enums.AccountState.Default;
     this.EntityID = 0;
     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("accounts").Where("Username", username))
         using (var reader = new MySqlReader(cmd))
         {
             if (reader.Read())
             {
                 exists        = true;
                 this.Password = reader.ReadString("Password");
                 this.IP       = reader.ReadString("Ip");
                 this.EntityID = reader.ReadUInt32("EntityID");
                 this.State    = (Enums.AccountState)reader.ReadInt32("State");
                 using (var cmd2 = new MySqlCommand(MySqlCommandType.SELECT).Select("characters").Where("UID", EntityID))
                     using (var reader2 = new MySqlReader(cmd2))
                     {
                         if (reader2.Read())
                         {
                             Name = reader2.ReadString("Name");
                             Rank = (ushort)Entity.RankExperiences.Where(i => i.Value >= reader2.ReadUInt32("Experience")).FirstOrDefault().Key;
                             byte[] Battles = reader2.ReadBlob("Battles");
                             var    battles = new List <Battle>();
                             if (Battles.Length > 0)
                             {
                                 using (var stream = new System.IO.MemoryStream(Battles))
                                     using (var rdr = new System.IO.BinaryReader(stream))
                                     {
                                         int count = rdr.ReadInt32();
                                         for (int i = 0; i < count; i++)
                                         {
                                             Battle battle = new Battle
                                             {
                                                 GameMode = (Enums.GameMode)rdr.ReadByte(),
                                                 Won      = rdr.ReadBoolean(),
                                                 Kills    = rdr.ReadUInt16(),
                                                 Deaths   = rdr.ReadUInt16()
                                             };
                                             battles.Add(battle);
                                         }
                                     }
                             }
                             TotalDeaths = (uint)battles.Sum(i => i.Deaths);
                             TotalKills  = (uint)battles.Sum(i => i.Kills);
                         }
                     }
             }
         }
 }
Пример #13
0
        /// <summary>
        /// Load the users list after make changes to them
        /// </summary>
        void LoadList()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("accounts");
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                UNList.Items.Add(r.ReadString("Username"));
            }
        }
Пример #14
0
 public static bool UsernameExists(string Username)
 {
     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("accounts").Where("Username", Username))
         using (var reader = new MySqlReader(cmd))
         {
             if (reader.Read())
             {
                 return(true);
             }
         }
     return(false);
 }
Пример #15
0
        private void ChangePass_Load(object sender, EventArgs e)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("accounts");
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                UN.Items.Add(r.ReadString("Username"));
            }
        }
Пример #16
0
 public static bool NameExists(string Name)
 {
     using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("characters").Where("Name", Name))
         using (var reader = new MySqlReader(cmd))
         {
             if (reader.Read())
             {
                 return(true);
             }
         }
     return(false);
 }
Пример #17
0
        /// <summary>
        /// Load suppliers
        /// </summary>
        private void LoadSup()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("suppliers");
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                MSUP.Items.Add(r.ReadString("Name"));
            }
        }
Пример #18
0
 private void SellB_Click(object sender, EventArgs e)
 {
     BillsTable.Client = Client.Text;
     BillsTable.MName  = PName.Text;
     BillsTable.MCost  = Convert.ToDecimal(PCost.Text);
     if (PName.Text != "" && Client.Text != "" && NewBill.Checked)
     {
         SellMedic();
         if (SellCom != true)
         {
             return;
         }
         BillsTable.newbill();
         try
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Order("ID");
             MySqlReader  r   = new MySqlReader(cmd);
             if (r.Read())
             {
                 BillNO.Text = r.ReadString("ID");
             }
             r.Close();
             SellCom = false;
         }
         catch (Exception el)
         {
             Program.SaveException(el);
         }
     }
     else if (PName.Text != "" && Client.Text != "" && !NewBill.Checked)
     {
         SellMedic();
         if (SellCom == false)
         {
             return;
         }
         BillsTable.updatebill();
         SellCom = false;
     }
     else if (PName.Text == "" || PCost.Text == "")
     {
         MessageBox.Show("لا يوجد دواء");
     }
     else if (Client.Text == "")
     {
         MessageBox.Show("ادخل اسم المشترى");
     }
     else
     {
         MessageBox.Show("الدواء غير متوفر");
     }
 }
Пример #19
0
        /// <summary>
        /// clear the list then gets suppliers names and ids
        /// </summary>
        void loadList()
        {
            SupList.Items.Clear();
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("suppliers");
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                SupList.Items.Add(r.ReadString("Id") + "-" + r.ReadString("Name"));
            }
        }
Пример #20
0
        public static bool UIDExists(uint UID)
        {
            MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);

            command.Select("characters").Where("UID", UID);
            MySqlReader reader = new MySqlReader(command);

            if (reader.Read())
            {
                return(true);
            }
            return(false);
        }
Пример #21
0
 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);
     }
 }
Пример #22
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            /*
             * 2. Crypto
             */


            string Execute = "SELECT * FROM ID where USERNAME = '******'";

            MySqlConnection MySqlConnection = new MySqlConnection(SQLConnectionString);
            MySqlCommand    MySqlCommand    = new MySqlCommand(Execute, MySqlConnection);

            MySqlCommand.CommandTimeout = 30;
            MySqlDataReader MySqlReader;

            try
            {
                MySqlConnection.Open(); //Open the sql connection
                MySqlReader = MySqlCommand.ExecuteReader();

                if (MySqlReader.HasRows)
                {
                    MySqlReader.Read();

                    const int POS_PASSWD = 2; /*Naja geht halt so warum nicht global ? :=) */

                    if (textBoxPassword.Text == MySqlReader.GetString(POS_PASSWD))
                    {
                        MessageBox.Show("Login Successfull");
                    }
                    else
                    {
                        MessageBox.Show("Username or Password wrong");
                    }
                }
                else
                {
                    MessageBox.Show("Username or Password wrong");
                }
                MySqlConnection.Close(); //Closing the sql connection
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
            }

            textBoxUsername.Text = "";
            textBoxPassword.Text = "";
        }
Пример #23
0
        private void SL1()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);

            cmd.Select("medlog"); //.Where("SellDate", Convert.ToUInt16(DateTime.Now.Day));
            MySqlReader r = new MySqlReader(cmd);

            while (r.Read())
            {
                dd1.Rows.Add(r.ReadString("Name"), r.ReadString("SellDate"), r.ReadString("Cost"));
                ff   = Convert.ToDecimal(r.ReadString("Cost"));
                ff1 += ff;
            }
            r.Close();
        }
Пример #24
0
 private void SearchBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (!SearchBox.Items.IsEmpty)
     {
         SearchBox.Items.Clear();
     }
     if (SearchBox.IsDropDownOpen == false && SearchBox.Text.Length > 0)
     {
         SearchBox.IsDropDownOpen = true;
     }
     try
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart) delegate()
         {
             if (CByName.IsChecked == true)
             {
                 MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                 cmd.Select("medics").WhereLike("Name", SearchBox.Text);
                 MySqlReader r = new MySqlReader(cmd);
                 while (r.Read() && SearchBox.Items.Count <= 10 && SearchBox.Text.Length > 0)
                 {
                     SearchBox.Items.Add(r.ReadString("Name"));
                 }
             }
             else if (CByBar.IsChecked == true)
             {
                 SearchBox.Items.Clear();
             }
             else if (CBySub.IsChecked == true)
             {
                 MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                 cmd.Select("medics").WhereLike("ScientificName", SearchBox.Text);
                 MySqlReader r = new MySqlReader(cmd);
                 while (r.Read() && SearchBox.Items.Count <= 10 && SearchBox.Text.Length > 0)
                 {
                     if (!SearchBox.Items.Contains(r.ReadString("ScientificName")))
                     {
                         SearchBox.Items.Add(r.ReadString("ScientificName"));
                     }
                 }
             }
         });
     }
     catch (Exception ex)
     {
         Kernel.Core.SaveException(ex);
     }
 }
Пример #25
0
 private void SupList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (SupList.SelectedIndex > -1)
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("suppliers").Where("Id", getSupId()).Execute();
         MySqlReader r = new MySqlReader(cmd);
         if (r.Read())
         {
             SupName.Text   = r.ReadString("Name");
             SupMan.Text    = r.ReadString("Salesman");
             SupPhones.Text = r.ReadString("Phones");
             SupNotes.Text  = r.ReadString("Notes");
         }
     }
 }
Пример #26
0
 private void nb()
 {
     try
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Order("ID", true);
         MySqlReader  r   = new MySqlReader(cmd);
         while (r.Read())
         {
             listBox1.Items.Add(r.ReadString("ID") /* + " || " + r.ReadString("Name")*/);
         }
         r.Close();
     }
     catch (Exception ee)
     {
         Program.SaveException(ee);
     }
 }
Пример #27
0
 private void endexp()
 {
     try
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("medics").Where("Expiry", Convert.ToUInt16(DateTime.Now.Month), false);
         MySqlReader r = new MySqlReader(cmd);
         while (r.Read())
         {
             dataGridView1.Rows.Add(r.ReadString("Name"), r.ReadString("Expiry"), r.ReadString("Count"));
         }
         r.Close();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.ToString());
     }
 }
Пример #28
0
 public void end()
 {
     try
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
         cmd.Select("medics").Where("Count", "0");
         MySqlReader r = new MySqlReader(cmd);
         while (r.Read())
         {
             MedLog.Text += r.ReadString("Name") + "\r\n";
             MedLog.Text += "----------------------------------------\r\n";
         }
         r.Close();
     }
     catch (Exception eee)
     {
         MessageBox.Show(eee.ToString());
     }
 }
Пример #29
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
     {
         try
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bills").Order("ID", true);
             MySqlReader r    = new MySqlReader(cmd);
             while (r.Read())
             {
                 BillsNoList.Items.Add(r.ReadString("ID"));
             }
             r.Close();
         }
         catch (Exception ex)
         {
             Kernel.Core.SaveException(ex);
         }
     });
 }
        public static Reservation LoadReservation(uint ReservationId)
        {
            Reservation reservation = null;

            using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("reservation").Where("ReservationId", ReservationId))
                using (var reader = new MySqlReader(cmd))
                {
                    if (reader.Read())
                    {
                        reservation = new Reservation(reader.ReadInt32("PatientId"),
                                                      reader.ReadInt32("ReservationId"),
                                                      reader.ReadString("DoctorId"),
                                                      reader.ReadString("ClinicId"),
                                                      reader.ReadString("AccountantId"),
                                                      DateTime.FromBinary(reader.ReadInt64("ReservationDate"))
                                                      );
                    }
                }
            return(reservation);
        }