Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (radioButton2.Checked == true)
     {
         if (securitycode.Text == "xcq19a733b")
         {
             baglanti.Baslat();
             //baglanti.komut = new OleDbCommand("DELETE FROM depobilgi ", baglanti.connection);
             //baglanti.komut.ExecuteNonQuery();
             //baglanti.komut = new OleDbCommand("DELETE FROM depo ", baglanti.connection);
             //baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 1'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 2'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 3'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 4'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 5'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 6'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 7'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + blank + "' ,urun_sinifi='" + blank + "' ,mahsul_yili='" + blank + "' ,kapasite='" + zero + "' ,depo_bos='" + zero + "' ,depo_dolu='" + zero + "' WHERE depo_id='Silo 8'", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("DELETE FROM depogiriscikis ", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.komut = new OleDbCommand("DELETE FROM urunlistesi ", baglanti.connection);
             baglanti.komut.ExecuteNonQuery();
             baglanti.Kapat();
         }
         else
         {
             MessageBox.Show("Sifre hatali!");
         }
     }
     else
     {
         baglanti.Baslat();
         string free = "";
         string zero = "0";
         baglanti.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + free + "',urun_sinifi='" + free + "',mahsul_yili='" + free + "',kapasite='" + zero + "',depo_bos='" + zero + "',depo_dolu='" + zero + "' WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
         baglanti.komut.ExecuteNonQuery();
         //baglanti.komut = new OleDbCommand("DELETE FROM depo ", baglanti.connection);
         //baglanti.komut.ExecuteNonQuery();
         baglanti.komut = new OleDbCommand("DELETE FROM depogiriscikis WHERE islem_depo='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
         baglanti.komut.ExecuteNonQuery();
         baglanti.komut = new OleDbCommand("DELETE FROM depoasim WHERE islem_depo='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
         baglanti.komut.ExecuteNonQuery();
         //baglanti.komut = new OleDbCommand("DELETE FROM aktarma WHERE islem_depo='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
         //baglanti.komut.ExecuteNonQuery();
         baglanti.Kapat();
     }
 }
Ejemplo n.º 2
0
 private void Kayıt_Göster()
 {
     /*
      * baglanti.Open();
      * SqlDataAdapter adtr = new SqlDataAdapter("select * from urunlistesi", baglanti);
      * adtr.Fill(daset, "urunlistesi");
      * dataGridView1.DataSource = daset.Tables["urunlistesi"];
      * baglanti.Close();
      */
     baglanti.Baslat();
     baglanti.adaptor = new OleDbDataAdapter("SELECT * FROM urunlistesi", baglanti.connection);
     baglanti.adaptor.Fill(daset, "urunlistesi");
     dataGridView1.DataSource = daset.Tables["urunlistesi"];
     baglanti.Kapat();
 }
Ejemplo n.º 3
0
        private void excel_Load(object sender, EventArgs e)
        {
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi", baglanti.connection);
            OleDbDataReader myDataReader = baglanti.komut.ExecuteReader();

            while (myDataReader.Read())
            {
                comboBox1.Items.Add(myDataReader["depo_id"].ToString());
            }
            baglanti.Kapat();
            comboBox2.Items.Add("giris");
            comboBox2.Items.Add("cikis");
            comboBox2.Items.Add("tumu");
            comboBox2.Items.Add("Depo Aşımı");
        }
Ejemplo n.º 4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("INSERT INTO urunlistesi (urun_grubu,urun_sinifi,m_yil,isin) VALUES (@item1,@item2,@item3,@item4)", baglanti.connection);
            baglanti.komut.Parameters.AddWithValue("@item1", comboBox1.SelectedItem.ToString());
            baglanti.komut.Parameters.AddWithValue("@item2", comboBox2.SelectedItem.ToString());
            baglanti.komut.Parameters.AddWithValue("@item3", comboBox3.SelectedItem.ToString());
            baglanti.komut.Parameters.AddWithValue("@item4", txtikod.Text.ToString());
            baglanti.komut.ExecuteNonQuery();
            baglanti.Kapat();
            MessageBox.Show("Ürün Eklendi");

            /*foreach (Control item in this.Controls)
             * {
             *  if (item is TextBox)
             *  {
             *      item.Text = "";
             *  }
             * }*/

            /*SqlConnection baglanti = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\vaio2\Desktop\takip3\takip3\stok_takip.mdf;Integrated Security=True");
             * baglanti.Open();
             * SqlCommand komut = baglanti.CreateCommand();
             * komut.CommandText = "insert urunlistesi(urungrubu,urunsinifi,mahsul_yili,isinkod) VALUES (@urungrubu,@urunsinifi,@mahsul_yili,@isinkod) ";
             * komut.Parameters.AddWithValue("@isinkod", txtikod.Text.ToString());
             * komut.Parameters.AddWithValue("@urungrubu", comboBox1.Text.ToString());
             * komut.Parameters.AddWithValue("@urunsinifi", comboBox2.Text.ToString());
             * komut.Parameters.AddWithValue("@mahsul_yili", comboBox3.Text.ToString());
             * komut.ExecuteNonQuery();
             * baglanti.Close();
             * MessageBox.Show("Ürün Eklendi");
             * foreach (Control item in this.Controls)
             * {
             *  if (item is TextBox)
             *  {
             *      item.Text = "";
             *  }
             * }
             */
        }
Ejemplo n.º 5
0
        private void depogiris_Load(object sender, EventArgs e)
        {
            daset.Clear();
            dataGridView1.ReadOnly = true;
            button2.Enabled        = false;
            baglanti.Baslat();
            baglanti.adaptor = new OleDbDataAdapter("SELECT * FROM depogiriscikis WHERE islem_tipi='giris' ORDER BY islem_no DESC", baglanti.connection);
            baglanti.adaptor.Fill(daset, "depogiriscikis");
            dataGridView1.DataSource = daset.Tables["depogiriscikis"];
            //dataGridView1.Columns["islem_no"].SortMode = DataGridViewColumnSortMode.Automatic();
            baglanti.Kapat();
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi", baglanti.connection);
            OleDbDataReader myDataReader3 = baglanti.komut.ExecuteReader();

            //SqlDataReader myDataReader3 = komut3.ExecuteReader();
            comboBox1.Items.Clear();
            while (myDataReader3.Read())
            {
                comboBox1.Items.Add(myDataReader3["depo_id"].ToString());;
            }

            /*
             * baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi ", baglanti.connection);
             *
             * OleDbDataReader myDataReader4 = baglanti.komut.ExecuteReader();
             * //SqlDataReader myDataReader3 = komut3.ExecuteReader();
             *
             * while (myDataReader4.Read())
             * {
             *  comboBox2.Items.Add(myDataReader4["urun_sinifi"].ToString()); ;
             *
             * }
             * baglanti.komut = new OleDbCommand("SELECT * FROM depogiriscikis ", baglanti.connection);
             * OleDbDataReader myDataReader5 = baglanti.komut.ExecuteReader();
             * //SqlDataReader myDataReader3 = komut3.ExecuteReader();
             *
             * while (myDataReader5.Read())
             * {
             *  comboBox3.Items.Add(myDataReader5["urun_grubu"].ToString()); ;
             *
             * }
             */
            baglanti.Kapat();
        }
Ejemplo n.º 6
0
        //SqlConnection baglanti = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
        private void Depotanimla_Load(object sender, EventArgs e)
        {
            /*DataSet daset = new DataSet();
             * baglanti.Open();
             * SqlCommand komut = baglanti.CreateCommand();
             * komut.CommandText = "select * from depo";
             *
             * SqlDataReader myDataReader = komut.ExecuteReader();
             *
             * while (myDataReader.Read())
             * {
             *  cmbdepotanimla.Items.Add(myDataReader["depo"].ToString());
             *
             * }
             * {
             *
             *  SqlConnection baglanti1 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
             *  DataSet daset1 = new DataSet();
             *  baglanti1.Open();
             *  SqlCommand komut1 = baglanti1.CreateCommand();
             *  komut1.CommandText = "select * from urunugrubu";
             *
             *  SqlDataReader myDataReader1 = komut1.ExecuteReader();
             *
             *  while (myDataReader1.Read())
             *  {
             *      cmbudepotanimla.Items.Add(myDataReader1["urunugrubu"].ToString());
             *
             *
             *  }
             *  {
             *      SqlConnection baglanti2 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
             *      DataSet daset2 = new DataSet();
             *      baglanti2.Open();
             *      SqlCommand komut2 = baglanti2.CreateCommand();
             *      komut2.CommandText = "select * from urunsinifi";
             *
             *      SqlDataReader myDataReader2 = komut2.ExecuteReader();
             *
             *      while (myDataReader2.Read())
             *      {
             *          cmburunsinifi.Items.Add(myDataReader2["urunsinifi"].ToString());
             *
             *      }
             *      {
             *
             *          SqlConnection baglanti3 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
             *          DataSet daset3 = new DataSet();
             *          baglanti3.Open();
             *          SqlCommand komut3 = baglanti3.CreateCommand();
             *          komut3.CommandText = "select * from mahsulyil";
             *
             *          SqlDataReader myDataReader3 = komut3.ExecuteReader();
             *
             *          while (myDataReader3.Read())
             *          {
             *              cmbmyili.Items.Add(myDataReader3["mahsul_yil"].ToString());
             *
             *
             *          }
             *      }
             *  }
             * } baglanti.Close();
             */

            DataSet daset = new DataSet();

            //baglanti.Open();
            baglanti.Baslat();
            //SqlCommand komut = baglanti.CreateCommand();
            baglanti.komut = new OleDbCommand("SELECT * FROM depo", baglanti.connection);
            //komut.CommandText = "select * from depo";

            OleDbDataReader myDataReader = baglanti.komut.ExecuteReader();

            while (myDataReader.Read())
            {
                cmbdepotanimla.Items.Add(myDataReader["depo_no"].ToString());
            }
            {
                //SqlConnection baglanti1 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
                DataSet daset1 = new DataSet();
                //baglanti1.Open();
                baglanti.komut = new OleDbCommand("SELECT * FROM urungrubu", baglanti.connection);
                //SqlCommand komut1 = baglanti1.CreateCommand();
                //komut1.CommandText = "select * from urunugrubu";

                OleDbDataReader myDataReader1 = baglanti.komut.ExecuteReader();

                while (myDataReader1.Read())
                {
                    cmbudepotanimla.Items.Add(myDataReader1["urun_grubu"]);
                }
                {
                    //SqlConnection baglanti2 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
                    DataSet daset2 = new DataSet();
                    //baglanti2.Open();
                    //SqlCommand komut2 = baglanti2.CreateCommand();
                    //komut2.CommandText = "select * from urunsinifi";
                    baglanti.komut = new OleDbCommand("SELECT * FROM urunsinifi", baglanti.connection);
                    OleDbDataReader myDataReader2 = baglanti.komut.ExecuteReader();

                    while (myDataReader2.Read())
                    {
                        cmburunsinifi.Items.Add(myDataReader2["urun_sinifi"].ToString());
                    }
                    {
                        //SqlConnection baglanti3 = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
                        DataSet daset3 = new DataSet();
                        //baglanti3.Open();
                        //SqlCommand komut3 = baglanti3.CreateCommand();
                        //komut3.CommandText = "select * from mahsulyil";
                        baglanti.komut = new OleDbCommand("SELECT * FROM mahsulyil ", baglanti.connection);
                        OleDbDataReader myDataReader3 = baglanti.komut.ExecuteReader();
                        //SqlDataReader myDataReader3 = komut3.ExecuteReader();

                        while (myDataReader3.Read())
                        {
                            cmbmyili.Items.Add(myDataReader3["mahsul_yil"].ToString());;
                        }
                    }
                }
            }
            baglanti.Kapat();
        }
Ejemplo n.º 7
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //anaekran ae = (anaekran)Application.OpenForms["anaekran"];
            //ae.depolbl1.Text = "merhaba";
            //SqlConnection baglanti = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\vaio2\Desktop\takip3\takip3\stok_takip.mdf;Integrated Security=True");
            //int id = 1;

            /*if (cmbdepotanimla.SelectedIndex == 0)
             * {
             *  id = 1;
             * }
             * else if (cmbdepotanimla.SelectedIndex == 1)
             * {
             *  id = 2;
             * }*/
            //Double kontrol = Double.Parse(d.Text);
            if (SiloBosMu())
            {
                if (cmbudepotanimla.SelectedIndex != -1 && cmburunsinifi.SelectedIndex != -1 && cmbmyili.SelectedIndex != -1)
                {
                    if (SayiMi(d.Text) && d.Text != String.Empty && Double.Parse(d.Text) > 0)
                    {
                        Baglanti baglantiup = new Baglanti();
                        baglantiup.Baslat();
                        //SqlCommand komut = baglanti.CreateCommand();
                        //
                        //komut.CommandText = "UPDATE depobilgi set(urun_grubu=@item1,urun_sinifi=@item2,mahsul_yili=@item3,kapasite=@item4) VALUES ('@item1','@item2','@item3','@item4') WHERE Id='" + cmbdepotanimla.SelectedIndex + 1 + "'";
                        //OleDbCommand komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu=@item1,urun_sinifi=@item2,mahsul_yili=@item3,kapasite=@item4 WHERE depo_id=@item5", baglanti.connection);
                        //komut.CommandText = "UPDATE depobilgi SET urun_grubu=@item1,urun_sinifi=@item2,mahsul_yili=@item3,kapasite=@item4 WHERE Id=@item5";

                        /*komut.Parameters.AddWithValue("@item1", cmbudepotanimla.SelectedItem.ToString());
                         * komut.Parameters.AddWithValue("@item2", cmburunsinifi.SelectedItem.ToString());
                         * komut.Parameters.AddWithValue("@item3", cmbmyili.SelectedItem.ToString());
                         * komut.Parameters.AddWithValue("@item4", d.Text.ToString());
                         * komut.Parameters.AddWithValue("@item5", cmbdepotanimla.SelectedIndex +1);
                         */
                        int deneme = 0;
                        baglantiup.komut = new OleDbCommand("UPDATE depobilgi SET urun_grubu='" + cmbudepotanimla.SelectedItem.ToString() + "',urun_sinifi='" + cmburunsinifi.SelectedItem.ToString() + "',mahsul_yili='" + cmbmyili.SelectedItem.ToString() + "',kapasite='" + d.Text.ToString() + "',depo_bos='" + d.Text.ToString() + "',depo_dolu='" + deneme.ToString() + "' WHERE depo_id='" + cmbdepotanimla.SelectedItem.ToString() + "'", baglantiup.connection);
                        baglantiup.komut.ExecuteNonQuery();
                        //komut.Dispose();
                        baglantiup.Kapat();
                        MessageBox.Show("Depo Eklendi");

                        anaekran ae          = (anaekran)Application.OpenForms["anaekran"];
                        int      update_silo = cmbdepotanimla.SelectedIndex + 1;
                        switch (update_silo)
                        {
                        case 1:
                            ae.silo1urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo1urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo1mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo1kapasite.Text   = d.Text.ToString();
                            break;

                        case 2:
                            ae.silo2urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo2urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo2mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo2kapasite.Text   = d.Text.ToString();
                            break;

                        case 3:
                            ae.silo3urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo3urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo3mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo3kapasite.Text   = d.Text.ToString();
                            break;

                        case 4:
                            ae.silo4urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo4urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo4mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo4kapasite.Text   = d.Text.ToString();
                            break;

                        case 5:
                            ae.silo5urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo5urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo5mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo5kapasite.Text   = d.Text.ToString();
                            break;

                        case 6:
                            ae.silo6urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo6urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo6mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo6kapasite.Text   = d.Text.ToString();
                            break;

                        case 7:
                            ae.silo7urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo7urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo7mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo7kapasite.Text   = d.Text.ToString();
                            break;

                        case 8:
                            ae.silo8urungrubu.Text  = cmbudepotanimla.SelectedItem.ToString();
                            ae.silo8urunsinifi.Text = cmburunsinifi.SelectedItem.ToString();
                            ae.silo8mahsulyili.Text = cmbmyili.SelectedItem.ToString();
                            ae.silo8kapasite.Text   = d.Text.ToString();
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Depo kapasitesi 0 değerinden küçük olamaz!");
                    }
                }
                else
                {
                    MessageBox.Show("Lütfen Ürün Grubu/Ürün Sınıfı/Mahsul Yılı seçimlerini yapınız...");
                }
            }
            else
            {
                MessageBox.Show("Lütfen silonun boş olduğundan emin olunuz.");
            }
        }
Ejemplo n.º 8
0
        public void SiloRenk()
        {
            Baglanti baglanti = new Baglanti();

            //DataSet daset = new DataSet();
            //int kapasite,dolu,bos = 0;
            //kapasite = Int32.Parse(textBox2.Text);

            //silo1
            baglanti.Baslat();
            string depodolu, kapasite = "";
            double depodolusayi, kapasitesayi, islem;

            for (int i = 0; i == 7; i++)
            {
                baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo " + i + 1 + "'", baglanti.connection);
                baglanti.komut.ExecuteNonQuery();
                OleDbDataReader dr = baglanti.komut.ExecuteReader();

                if (dr.Read())
                {
                    depodolu     = dr["kapasite"].ToString();
                    kapasite     = dr["depo_dolu"].ToString();
                    depodolusayi = Double.Parse(depodolu);
                    kapasitesayi = Double.Parse(kapasite);
                    islem        = depodolusayi * (kapasitesayi / 100);
                    islem        = Math.Round(islem, 0);
                    switch (i + 1)
                    {
                    case 1:
                        if (islem < 25)
                        {
                            pictureBox1.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox1.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox1.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox1.ImageLocation = "silo100";
                        }
                        break;

                    case 2:
                        if (islem < 25)
                        {
                            pictureBox2.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox2.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox2.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox2.ImageLocation = "silo100";
                        }
                        break;

                    case 3:
                        if (islem < 25)
                        {
                            pictureBox4.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox4.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox4.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox4.ImageLocation = "silo100";
                        }
                        break;

                    case 4:
                        if (islem < 25)
                        {
                            pictureBox3.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox3.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox3.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox3.ImageLocation = "silo100";
                        }
                        break;

                    case 5:
                        if (islem < 25)
                        {
                            pictureBox5.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox5.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox5.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox5.ImageLocation = "silo100";
                        }
                        break;

                    case 6:
                        if (islem < 25)
                        {
                            pictureBox6.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox6.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox6.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox6.ImageLocation = "silo100";
                        }
                        break;

                    case 7:
                        if (islem < 25)
                        {
                            pictureBox7.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox7.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox7.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox7.ImageLocation = "silo100";
                        }
                        break;

                    case 8:
                        if (islem < 25)
                        {
                            pictureBox8.ImageLocation = "silo25";
                        }
                        if (25 < islem && islem < 50)
                        {
                            pictureBox8.ImageLocation = "silo50";
                        }
                        if (50 < islem && islem < 75)
                        {
                            pictureBox8.ImageLocation = "silo75";
                        }
                        else
                        {
                            pictureBox8.ImageLocation = "silo100";
                        }
                        break;

                    default:
                        pictureBox1.ImageLocation = "silo25";
                        pictureBox2.ImageLocation = "silo25";
                        pictureBox3.ImageLocation = "silo25";
                        pictureBox4.ImageLocation = "silo25";
                        pictureBox5.ImageLocation = "silo25";
                        pictureBox6.ImageLocation = "silo25";
                        pictureBox7.ImageLocation = "silo25";
                        pictureBox8.ImageLocation = "silo25";
                        break;
                    }
                }
            }

            baglanti.Kapat();
        }
Ejemplo n.º 9
0
        public void Anaekran_Load(object sender, EventArgs e)
        {
            //SiloRenk();
            //this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //silo1urungrubu.BackColor = Color.Transparent;
            //silo1urungrubu.BackColor = Color.Transparent;
            Baglanti baglanti = new Baglanti();
            DataSet  daset    = new DataSet();

            //int kapasite,dolu,bos = 0;
            //kapasite = Int32.Parse(textBox2.Text);

            //silo1
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 1'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            OleDbDataReader dr = baglanti.komut.ExecuteReader();

            if (dr.Read())
            {
                silo1urungrubu.Text  = dr["urun_grubu"].ToString();
                silo1urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo1mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo1kapasite.Text   = dr["kapasite"].ToString();
                silo1kapasite.Text   = (decimal.Parse(silo1kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo1bos.Text        = dr["depo_bos"].ToString();
                silo1bos.Text        = (decimal.Parse(silo1bos.Text, NumberStyles.Float).ToString("N0"));
                silo1dolu.Text       = dr["depo_dolu"].ToString();
                silo1dolu.Text       = (decimal.Parse(silo1dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo2
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 2'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo2urungrubu.Text  = dr["urun_grubu"].ToString();
                silo2urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo2mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo2kapasite.Text   = dr["kapasite"].ToString();
                //anaekranda gosterilen sayinin virgullu olmasi icin -> System.Globalization; sınıfı eklenecek
                silo2kapasite.Text = (decimal.Parse(silo2kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo2bos.Text      = dr["depo_bos"].ToString();
                silo2bos.Text      = (decimal.Parse(silo2bos.Text, NumberStyles.Float).ToString("N0"));
                silo2dolu.Text     = dr["depo_dolu"].ToString();
                silo2dolu.Text     = (decimal.Parse(silo2dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo3
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 3'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo3urungrubu.Text  = dr["urun_grubu"].ToString();
                silo3urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo3mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo3kapasite.Text   = dr["kapasite"].ToString();
                silo3kapasite.Text   = (decimal.Parse(silo3kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo3bos.Text        = dr["depo_bos"].ToString();
                silo3bos.Text        = (decimal.Parse(silo3bos.Text, NumberStyles.Float).ToString("N0"));
                silo3dolu.Text       = dr["depo_dolu"].ToString();
                silo3dolu.Text       = (decimal.Parse(silo3dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo4
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 4'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo4urungrubu.Text  = dr["urun_grubu"].ToString();
                silo4urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo4mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo4kapasite.Text   = dr["kapasite"].ToString();
                silo4kapasite.Text   = (decimal.Parse(silo4kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo4bos.Text        = dr["depo_bos"].ToString();
                silo4bos.Text        = (decimal.Parse(silo4bos.Text, NumberStyles.Float).ToString("N0"));
                silo4dolu.Text       = dr["depo_dolu"].ToString();
                silo4dolu.Text       = (decimal.Parse(silo4dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo5
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 5'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo5urungrubu.Text  = dr["urun_grubu"].ToString();
                silo5urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo5mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo5kapasite.Text   = dr["kapasite"].ToString();
                silo5kapasite.Text   = (decimal.Parse(silo5kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo5bos.Text        = dr["depo_bos"].ToString();
                silo5bos.Text        = (decimal.Parse(silo5bos.Text, NumberStyles.Float).ToString("N0"));
                silo5dolu.Text       = dr["depo_dolu"].ToString();
                silo5dolu.Text       = (decimal.Parse(silo5dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo6
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 6'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo6urungrubu.Text  = dr["urun_grubu"].ToString();
                silo6urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo6mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo6kapasite.Text   = dr["kapasite"].ToString();
                silo6kapasite.Text   = (decimal.Parse(silo6kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo6bos.Text        = dr["depo_bos"].ToString();
                silo6bos.Text        = (decimal.Parse(silo6bos.Text, NumberStyles.Float).ToString("N0"));
                silo6dolu.Text       = dr["depo_dolu"].ToString();
                silo6dolu.Text       = (decimal.Parse(silo6dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo7
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 7'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo7urungrubu.Text  = dr["urun_grubu"].ToString();
                silo7urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo7mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo7kapasite.Text   = dr["kapasite"].ToString();
                silo7kapasite.Text   = (decimal.Parse(silo7kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo7bos.Text        = dr["depo_bos"].ToString();
                silo7bos.Text        = (decimal.Parse(silo7bos.Text, NumberStyles.Float).ToString("N0"));
                silo7dolu.Text       = dr["depo_dolu"].ToString();
                silo7dolu.Text       = (decimal.Parse(silo7dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();
            //silo8
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo 8'", baglanti.connection);
            baglanti.komut.ExecuteNonQuery();
            dr = baglanti.komut.ExecuteReader();
            if (dr.Read())
            {
                silo8urungrubu.Text  = dr["urun_grubu"].ToString();
                silo8urunsinifi.Text = dr["urun_sinifi"].ToString();
                silo8mahsulyili.Text = dr["mahsul_yili"].ToString();
                silo8kapasite.Text   = dr["kapasite"].ToString();
                silo8kapasite.Text   = (decimal.Parse(silo8kapasite.Text, NumberStyles.Float).ToString("N0"));
                silo8bos.Text        = dr["depo_bos"].ToString();
                silo8bos.Text        = (decimal.Parse(silo8bos.Text, NumberStyles.Float).ToString("N0"));
                silo8dolu.Text       = dr["depo_dolu"].ToString();
                silo8dolu.Text       = (decimal.Parse(silo8dolu.Text, NumberStyles.Float).ToString("N0"));
            }
            baglanti.Kapat();

            /*SqlConnection baglanti = new SqlConnection(@"Data Source=VAIO26;Initial Catalog=C:\Users\devel\Desktop\takip3-Kopya\takip3-Kopya\takip3\stok_takip.mdf;Integrated Security=True");
             * baglanti.Open();
             * SqlCommand komut = baglanti.CreateCommand();
             * //silo1
             * komut.CommandText = "Select * from depobilgi where Id = 1";
             * komut.ExecuteNonQuery();
             * SqlDataReader dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo1urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo1urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo1mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo1kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo2
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 2";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo2urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo2urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo2mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo2kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo3
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 3";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo3urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo3urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo3mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo3kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo4
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 4";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo4urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo4urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo4mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo4kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo5
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 5";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo5urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo5urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo5mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo5kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo6
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 6";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo6urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo6urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo6mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo6kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo7
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 7";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo7urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo7urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo7mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo7kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             * //silo8
             * baglanti.Open();
             * komut.CommandText = "Select * from depobilgi where Id = 8";
             * komut.ExecuteNonQuery();
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  silo8urungrubu.Text = dr["urun_grubu"].ToString();
             *  silo8urunsinifi.Text = dr["urun_sinifi"].ToString();
             *  silo8mahsulyili.Text = dr["mahsul_yili"].ToString();
             *  silo8kapasite.Text = dr["kapasite"].ToString();
             * }
             * baglanti.Close();
             *
             * //depolbl1.Text = depotanimla.depo;
             */
            //silo renk
            baglanti.Baslat();
            string depodolu = "";
            string kapasite = "";
            //MessageBox.Show("deneme");
            double depodolusayi, kapasitesayi, islem;

            for (int i = 0; i < 8; i++)
            {
                baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi where depo_id='Silo " + (i + 1) + "'", baglanti.connection);
                //baglanti.komut.ExecuteNonQuery();
                OleDbDataReader ddr = baglanti.komut.ExecuteReader();

                if (ddr.Read())
                {
                    kapasite     = ddr["kapasite"].ToString();
                    depodolu     = ddr["depo_dolu"].ToString();
                    depodolusayi = Double.Parse(depodolu);
                    kapasitesayi = Double.Parse(kapasite);
                    islem        = (depodolusayi * 100) / kapasitesayi;
                    islem        = Math.Round(islem, 0);
                    switch (i + 1)
                    {
                    case 1:
                        if (islem < 25)
                        {
                            pictureBox1.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox1.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox1.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox1.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 2:
                        if (islem < 25)
                        {
                            pictureBox2.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox2.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox2.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox2.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 3:
                        if (islem < 25)
                        {
                            pictureBox4.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox4.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox4.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox4.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 4:
                        if (islem < 25)
                        {
                            pictureBox3.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox3.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox3.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox3.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 5:
                        if (islem < 25)
                        {
                            pictureBox5.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox5.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox5.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox5.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 6:
                        if (islem < 25)
                        {
                            pictureBox6.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox6.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox6.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox6.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 7:
                        if (islem < 25)
                        {
                            pictureBox7.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox7.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox7.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox7.Image = Image.FromFile("silo100.png");
                        }
                        break;

                    case 8:
                        if (islem < 25)
                        {
                            pictureBox8.Image = Image.FromFile("silo25.png");
                        }
                        else if (25 < islem && islem < 50)
                        {
                            pictureBox8.Image = Image.FromFile("silo50.png");
                        }
                        else if (50 < islem && islem < 75)
                        {
                            pictureBox8.Image = Image.FromFile("silo75.png");
                        }
                        else
                        {
                            pictureBox8.Image = Image.FromFile("silo100.png");
                        }
                        break;
                    }
                }
            }

            baglanti.Kapat();
        }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            //-------------------------------------------------------
            //aktarma yapilirken eksiye düsme kontrolu

            int aktarma_k = 0;

            aktarma_k = Int32.Parse(textBox3.Text);

            //kapasite kontrolü
            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
            OleDbDataReader myDataReader3k  = baglanti.komut.ExecuteReader();
            string          birinciBos      = "";
            string          birinciDolu     = "";
            string          birinciKapasite = "";
            string          ikinciBos       = "";
            string          ikinciDolu      = "";
            string          ikinciKapasite  = "";

            while (myDataReader3k.Read())
            {
                birinciBos      = (myDataReader3k["depo_bos"].ToString());
                birinciDolu     = (myDataReader3k["depo_dolu"].ToString());
                birinciKapasite = (myDataReader3k["kapasite"].ToString());
            }
            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi WHERE depo_id='" + comboBox2.SelectedItem.ToString() + "'", baglanti.connection);
            OleDbDataReader myDataReader6k = baglanti.komut.ExecuteReader();

            while (myDataReader6k.Read())
            {
                ikinciBos      = (myDataReader6k["depo_bos"].ToString());
                ikinciDolu     = (myDataReader6k["depo_dolu"].ToString());
                ikinciKapasite = (myDataReader6k["depo_dolu"].ToString());
            }
            Double birinciBosDepo      = Double.Parse(birinciBos);
            Double birinciDoluDepo     = Double.Parse(birinciDolu);
            Double birinciKapasiteDepo = Double.Parse(birinciKapasite);
            Double ikinciBosDepo       = Double.Parse(ikinciBos);
            Double ikinciDoluDepo      = Double.Parse(ikinciDolu);
            Double ikinciKapasiteDepo  = Double.Parse(ikinciKapasite);

            //-------------------------------------------------------
            if ((aktarma_k < birinciDoluDepo + 1) && (aktarma_k < ikinciBosDepo + 1))
            {
                if (aktarma_k > 0 && aktarma_k < 100000)
                {
                    baglanti.Baslat();
                    baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi  WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);;
                    OleDbDataReader myDataReader1 = baglanti.komut.ExecuteReader();
                    baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi  WHERE depo_id='" + comboBox2.SelectedItem.ToString() + "'", baglanti.connection);;
                    OleDbDataReader myDataReader2 = baglanti.komut.ExecuteReader();

                    bool control;

                    if (myDataReader1.Read() && myDataReader2.Read())
                    {
                        control = true;
                    }
                    else
                    {
                        control = false;
                    }

                    if (control && myDataReader1["urun_sinifi"].ToString() == myDataReader2["urun_sinifi"].ToString() && myDataReader2["urun_grubu"].ToString() == myDataReader1["urun_grubu"].ToString())
                    {
                        if (textBox3.Text == "0")
                        {
                            MessageBox.Show("Girilen kayit degeri sifir olamaz");
                        }
                        else
                        {
                            Double kapasite = Double.Parse(textBox1.Text);
                            Double ikinci   = Double.Parse(textBox3.Text);
                            Double ucuncu   = Double.Parse(textBox2.Text);
                            Double sonuc    = kapasite - ikinci;
                            Double sonuc2   = ucuncu + ikinci;

                            baglanti.Baslat();
                            baglanti.komut = new OleDbCommand("UPDATE depobilgi SET depo_dolu='" + sonuc.ToString() + "' WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
                            baglanti.komut.ExecuteNonQuery();

                            baglanti.komut = new OleDbCommand("UPDATE depobilgi SET depo_dolu='" + sonuc2.ToString() + "' WHERE depo_id='" + comboBox2.SelectedItem.ToString() + "'", baglanti.connection);
                            baglanti.komut.ExecuteNonQuery();
                            baglanti.Kapat();

                            //depo_bos isleminin tamamlanmasi
                            baglanti.Baslat();
                            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
                            OleDbDataReader myDataReader3 = baglanti.komut.ExecuteReader();
                            //SqlDataReader myDataReader3 = komut3.ExecuteReader();
                            string aa = "";

                            while (myDataReader3.Read())
                            {
                                aa = myDataReader3["depo_bos"].ToString();;
                                //bb = myDataReader3["depo_bos"].ToString(); ;
                            }
                            Double depoBosSonuc = Double.Parse(aa) + Double.Parse(textBox3.Text);
                            baglanti.komut = new OleDbCommand("UPDATE depobilgi SET depo_bos='" + depoBosSonuc.ToString() + "' WHERE depo_id='" + comboBox1.SelectedItem.ToString() + "'", baglanti.connection);
                            baglanti.komut.ExecuteNonQuery();
                            baglanti.Kapat();

                            baglanti.Baslat();
                            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi WHERE depo_id='" + comboBox2.SelectedItem.ToString() + "'", baglanti.connection);
                            OleDbDataReader myDataReader4 = baglanti.komut.ExecuteReader();
                            string          bb            = "";
                            while (myDataReader4.Read())
                            {
                                //aa = myDataReader3["depo_bos"].ToString(); ;
                                bb = myDataReader4["depo_bos"].ToString();;
                            }

                            Double depoBosSonuc2 = Double.Parse(bb) - Double.Parse(textBox3.Text);
                            baglanti.komut = new OleDbCommand("UPDATE depobilgi SET depo_bos='" + depoBosSonuc2.ToString() + "' WHERE depo_id='" + comboBox2.SelectedItem.ToString() + "'", baglanti.connection);
                            baglanti.komut.ExecuteNonQuery();
                            baglanti.Kapat();

                            //aktarma islemini veritabanina kaydedilmesi
                            string date = System.DateTime.Now.ToString();
                            string tip  = "giris";
                            baglanti.Baslat();
                            baglanti.komut = new OleDbCommand("INSERT INTO aktarma (cikan_depo,aktarilan_depo,tarih,miktar) VALUES (@item1,@item2,@item3,@item4)", baglanti.connection);
                            baglanti.komut.Parameters.AddWithValue("@item1", comboBox1.SelectedItem.ToString());
                            baglanti.komut.Parameters.AddWithValue("@item2", comboBox2.SelectedItem.ToString());
                            baglanti.komut.Parameters.AddWithValue("@item3", date);
                            baglanti.komut.Parameters.AddWithValue("@item4", textBox3.Text.ToString());


                            baglanti.komut.ExecuteNonQuery();
                            baglanti.Kapat();
                            MessageBox.Show("Aktarma İslemi Tamamlandi");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Urun grubu veya urun sinifi uyusmuyor!");
                    }

                    baglanti.Kapat();
                }
                else
                {
                    MessageBox.Show("Aktarma miktarı 0-100000 arasında olmalıdır!");
                }
            }
            else
            {
                MessageBox.Show("Aktarma islemi silo kapasitesi disina cikiyor");
            }
        }
Ejemplo n.º 11
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //SqlConnection giris = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\aLP\source\repos\takip3\takip3\stok_takip.mdf;Integrated Security=True");
            //SqlDataAdapter grs = new SqlDataAdapter("select count(*) from kullanicibilgileri where kullaniciadi ='" + textBox1.Text + "' and kullanicisifre='" + textBox2.Text + "'", giris);
            //DataTable dt = new DataTable();
            //grs.Fill(dt);
            //if (dt.Rows[0][0].ToString() == "1")
            //{
            //this.Hide();
            //  Form mm = new anaekran();
            //  mm.Show();
            //  }
            //  else
            // MessageBox.Show("lütfen kullanıcı adı veya şifre giriniz", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);

            /*
             * Form mm = new anaekran();
             * mm.Show();
             */
            /*
             * Baglanti baglanti = new Baglanti();
             * baglanti.Baslat();
             * baglanti.komut.Connection = baglanti.connection;
             * baglanti.adaptor = new System.Data.OleDb.OleDbDataAdapter ("select * from kullanici where kullanici_adi ='" + textBox1.Text + "' and kullanici_sifre='" + textBox2.Text + "'", baglanti.connection);
             * DataTable dt = new DataTable();
             * baglanti.adaptor.Fill(dt);
             * if (dt.Rows[0][0].ToString() == "1")
             * {
             * this.Hide();
             * Form mm = new anaekran();
             * mm.Show();
             * }
             * else
             * MessageBox.Show("lütfen kullanıcı adı veya şifre giriniz", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
             * //Form mm = new anaekran();
             * //mm.Show();
             */

            //*******************connection = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=stoktakipdb.accdb");

            /*connection.Open();
             * komut.Connection = connection;
             * //connection.CreateCommand. = "select * from kullanici where kullanici_adi ='" + textBox1.Text + "' and kullanici_sifre='" + textBox2.Text + "'";
             * komut.CommandText = "select * from kullanici where kullanici_adi ='" + textBox1.Text + "' and kullanici_sifre='" + textBox2.Text + "'";
             * //adaptor = new System.Data.OleDb.OleDbDataAdapter("select * from kullanici where kullanici_adi ='" + textBox1.Text + "' and kullanici_sifre='" + textBox2.Text + "'",connection);
             * //DataTable dt = new DataTable();
             * //adaptor.Fill(dt);
             * dr = komut.ExecuteReader();
             * if (dr.Read())
             * {
             *  Form mm = new anaekran();
             *  mm.Show();
             * }
             * else
             * {
             *  MessageBox.Show("lütfen kullanıcı adı veya şifre giriniz", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
             * }
             * connection.Close();
             */

            baglanti.Baslat();
            baglanti.komut = new OleDbCommand("SELECT COUNT(*) FROM kullanici where kullanici_adi=@item1 and kullanici_sifre=@item2", baglanti.connection);
            baglanti.komut.Parameters.Add("@item1", textBox1.Text);
            baglanti.komut.Parameters.Add("@item2", textBox2.Text);
            int ks;

            ks = int.Parse(baglanti.komut.ExecuteScalar().ToString());
            if (ks == 1)
            {
                this.Hide();
                //this.Close();
                Form mm = new anaekran();
                mm.Show();
            }
            else
            {
                MessageBox.Show("Giriş Başarısız");
            }

            baglanti.Kapat();
        }
Ejemplo n.º 12
0
        private void depocikis_Load(object sender, EventArgs e)
        {
            daset.Clear();
            //comboBox2.Select
            dataGridView1.ReadOnly = true;
            button3.Enabled        = false;
            baglanti.Baslat();
            baglanti.adaptor = new OleDbDataAdapter("SELECT * FROM depogiriscikis WHERE islem_tipi='cikis' ORDER BY islem_no DESC", baglanti.connection);
            baglanti.adaptor.Fill(daset, "depogiriscikis");
            dataGridView1.DataSource = daset.Tables["depogiriscikis"];

            baglanti.komut = new OleDbCommand("SELECT * FROM depobilgi ", baglanti.connection);
            OleDbDataReader myDataReader3 = baglanti.komut.ExecuteReader();

            //SqlDataReader myDataReader3 = komut3.ExecuteReader();
            comboBox1.Items.Clear();
            while (myDataReader3.Read())
            {
                comboBox1.Items.Add(myDataReader3["depo_id"].ToString());;
            }

            baglanti.Kapat();
        }