Exemplo n.º 1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            DialogResult g;

            g = MessageBox.Show(DataGridView1.CurrentRow.Cells[0].Value + " nolu Barkod Kodu silinecek. Emin misiniz?", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
            if (g == DialogResult.Yes)
            {
                OleDbCommand cmd = new OleDbCommand("DELETE FROM BARKOD WHERE BarkodNo=" + Convert.ToInt32(DataGridView1.CurrentRow.Cells[0].Value), bag);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Barkod veritabanından silindi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DataGridView1.Rows.Clear();
                TextBox3.Clear();
                TextBox4.Clear();
                cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag);
                OleDbDataReader oku = cmd.ExecuteReader();
                while (oku.Read())
                {
                    DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString());
                }
                oku.Close();
            }
            else
            {
                return;
            }
        }
Exemplo n.º 2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            baglanti();
            if (TextBox3.Text == "" || TextBox4.Text == "")
            {
                MessageBox.Show("Barkod Numarası ve Tanım alanlarını doldurunuz.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            OleDbCommand cmd = new OleDbCommand("INSERT INTO BARKOD(BarkodNo,Tanim,StokKodu) Values('" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox1.Text + "')", bag);

            cmd.ExecuteNonQuery();
            MessageBox.Show("Veritabanına Kaydedildi.", "İŞLEM TAMAM", MessageBoxButtons.OK, MessageBoxIcon.Information);
            DataGridView1.Rows.Clear();
            TextBox3.Clear();
            TextBox4.Clear();
            cmd = new OleDbCommand("SELECT * FROM BARKOD ORDER BY BarkodNo ASC", bag);
            OleDbDataReader oku = cmd.ExecuteReader();

            while (oku.Read())
            {
                DataGridView1.Rows.Add(oku[0].ToString(), oku[1].ToString());
            }

            oku.Close();
        }
Exemplo n.º 3
0
        private void Button2_Click(object sender, EventArgs e)
        {
            if (c.cnn.State == ConnectionState.Open)
            {
                c.cnn.Close();
            }
            c.cnn.Open();

            if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "")
            {
                MessageBox.Show("Fill the form properly", "Reset", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                sqlcom             = c.cnn.CreateCommand();
                sqlcom.CommandText = "select * from adlogin where AdmName='" + TextBox1.Text + "' and APassword='******'";
                sqldr = sqlcom.ExecuteReader();
                if (sqldr.Read())
                {
                    if (c.cnn.State == ConnectionState.Open)
                    {
                        c.cnn.Close();
                    }
                    c.cnn.Open();
                    sqlcom             = c.cnn.CreateCommand();
                    sqlcom.CommandText = "update adlogin set APassword='******' where AdmName='" + TextBox1.Text + "'";
                    sqldr = sqlcom.ExecuteReader();

                    TextBox1.Clear();
                    TextBox2.Clear();
                    TextBox3.Clear();
                }
            }
        }
Exemplo n.º 4
0
 private void temizle()
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
 }
Exemplo n.º 5
0
 private void button9_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     textBox5.Clear();
 }
Exemplo n.º 6
0
 private void DeliteRecord_Click(object sender, RoutedEventArgs e)
 {
     AllRecords.RemoveAt(ListView1.SelectedIndex);
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     MessageBox.Show("Complite!");
 }
Exemplo n.º 7
0
 private void ResetRecord()
 {
     DateTimePicker1.Value = DateTime.Now;
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     btnadd.Text = "Add";
     DateTimePicker1.Focus();
 }
Exemplo n.º 8
0
 private void limpiar()
 {
     TextBox1.Clear();
     TextBox4.Clear();
     textBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox3.Clear();
 }
Exemplo n.º 9
0
 private void Button3_Click(object sender, EventArgs e)
 {
     TextBox2.Clear();
     ComboBox1.Text = "";
     TextBox4.Clear();
     TextBox1.Clear();
     TextBox3.Clear();
     TextBox5.Clear();
     textBox6.Clear();
     TextBox2.Focus();
 }
Exemplo n.º 10
0
 public void ClearTextBoxes()
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBoxID.Clear();
 }
 private void Button2_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     MessageBox.Show("Se ha eliminado el reporte.",
                     "Importante",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Exclamation,
                     MessageBoxDefaultButton.Button1);
 }
        /*private void Button_Click_3(object sender, RoutedEventArgs e)
         * {
         *  try
         *  {
         *      Text1.Clear();
         *  }
         *  catch
         *  {
         *  }
         * }*/

        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            try
            {
                TextBox1.Clear();
                TextBox2.Clear();
                TextBox3.Clear();
                TextBox4.Clear();
            }
            catch
            {
            }
        }
Exemplo n.º 13
0
 private void ChangeRecord_Click(object sender, RoutedEventArgs e)
 {
     if (Check())
     {
         AllRecords.RemoveAt(ListView1.SelectedIndex);
         AllRecords.Add(new Record(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text));
         TextBox1.Clear();
         TextBox2.Clear();
         TextBox3.Clear();
         TextBox4.Clear();
         MessageBox.Show("Complite!");
     }
 }
Exemplo n.º 14
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            TextBox3.Clear();
            ListOfPrimes.Clear();
            Range.Clear();
            switch (ComboBox.SelectedIndex)
            {
            case 0:
                try
                {
                    numA = Convert.ToInt64(TextBox1.Text);
                }
                catch
                {
                    InfoBox.Text = "ERROR: Conversion Error";
                    return;
                }
                TextBox3.Text = Convert.ToString(isPrime(numA));
                break;

            case 1:
                try
                {
                    numA = Convert.ToInt64(TextBox1.Text);
                    numB = Convert.ToInt64(TextBox2.Text);
                }
                catch
                {
                    InfoBox.Text = "ERROR: Conversion Error";
                    return;
                }
                string tempString = string.Join(", ", findPrimes(numA, numB));
                TextBox3.Text = tempString;
                break;

            case 2:
                try
                {
                    numA = Convert.ToInt64(TextBox1.Text);
                    numB = Convert.ToInt64(TextBox2.Text);
                }
                catch
                {
                    InfoBox.Text = "ERROR: Conversion Error";
                    return;
                };
                TextBox3.Text = amountOfPrimes(numA, numB);
                break;
            }
        }
Exemplo n.º 15
0
 private void Button3_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBox9.Clear();
     ComboBox1.Items.Clear();
     RadioButton1.Checked = false;
     RadioButton2.Checked = false;
 }
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string      xmlfilepath = @"D:\programs\Visual Studio 2017\XML Märkmed\MärkmeteHarjutus\MärkmeteHarjutus\bin\Debug\Märkmed.xml";
            XmlDocument doc         = new XmlDocument();

            doc.Load(xmlfilepath);

            XmlNode node1 = doc.SelectSingleNode("/Märkmik/Märge/Pealkiri");

            if (node1 != null)
            {
                XmlNode parent1 = node1.ParentNode;
                parent1.RemoveChild(node1);
                string newXML = doc.OuterXml;
                TextBox3.Clear();
                doc.Save("Märkmed.xml");
            }
        }
Exemplo n.º 17
0
        private void button5_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(@"Data Source=(localdb)\v11.0;Initial Catalog=hekim1;Integrated Security=SSPI");

            con.Open();
            SqlCommand cmd = new SqlCommand("UPDATE bilgiler1 SET tedavi=@tedavi,adi=@adi,soyadi=@soyadi,ilet=@ilet,dipnot=@dipnot", con);

            cmd.Parameters.AddWithValue("tedavi", ComboBox1.Text);
            cmd.Parameters.AddWithValue("adi", TextBox1.Text);
            cmd.Parameters.AddWithValue("soyadi", TextBox2.Text);
            cmd.Parameters.AddWithValue("ilet", TextBox3.Text);
            cmd.Parameters.AddWithValue("dipnot", TextBox4.Text);
            cmd.Parameters.AddWithValue("tc", textBox5.Text);
            cmd.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Kayıt Düzeltilmiştir");
            TextBox1.Clear();
            TextBox2.Clear();
            TextBox3.Clear();
            TextBox4.Clear();
        }
Exemplo n.º 18
0
 private void Button2_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
     TextBox4.Clear();
     TextBox5.Clear();
     TextBox6.Clear();
     TextBox7.Clear();
     TextBox8.Clear();
     TextBox9.Clear();
     TextBox10.Clear();
     ComboBox1.Text       = "Selecione...";
     ComboBox2.Text       = "Selecione...";
     CheckBox1.Checked    = false;
     CheckBox2.Checked    = false;
     CheckBox3.Checked    = false;
     RadioButton1.Checked = false;
     RadioButton2.Checked = false;
     TextBox1.Focus();
 }
Exemplo n.º 19
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (textBox5.Text.Trim() == "")
            {
                MessageBox.Show("TC KİMLİK NUMARASI BOŞ OLAMAZ");
                textBox5.Focus();
                return;
            }
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show("AD BOŞ OLAMAZ");
                textBox5.Focus();
                return;
            }

            if (true)
            {
            }


            bilgiler uye = new bilgiler();

            uye.ad     = TextBox1.Text;
            uye.soyad  = TextBox2.Text;
            uye.ilet   = TextBox3.Text;
            uye.dipnot = TextBox4.Text;
            uye.tc     = Convert.ToInt32(textBox5.Text);
            uye.tedavi = ComboBox1.Text;
            uye.tarih  = dateTimePicker1.Value.Date;
            uye.saat   = comboBox2.Text;
            uye.kutu   = checkBox1.Checked;
            uye.kutu1  = checkBox2.Checked;
            uye.kutu2  = checkBox3.Checked;
            uye.kutu3  = checkBox4.Checked;
            uye.kutu4  = checkBox5.Checked;
            uye.kutu5  = checkBox6.Checked;
            uye.kutu6  = checkBox7.Checked;
            uye.kutu7  = checkBox8.Checked;
            uye.kutu8  = checkBox9.Checked;
            uye.kutu9  = checkBox10.Checked;
            uye.kutu10 = checkBox11.Checked;
            uye.kutu11 = checkBox12.Checked;
            uye.kutu12 = checkBox13.Checked;
            uye.kutu13 = checkBox14.Checked;
            uye.kutu14 = checkBox15.Checked;
            uye.kutu15 = checkBox16.Checked;
            uye.kutu16 = checkBox17.Checked;
            uye.kutu17 = checkBox18.Checked;
            uye.kutu18 = checkBox19.Checked;
            uye.kutu19 = checkBox20.Checked;
            uye.kutu20 = checkBox21.Checked;
            uye.kutu21 = checkBox22.Checked;
            uye.kutu22 = checkBox23.Checked;
            uye.kutu23 = checkBox24.Checked;
            uye.kutu24 = checkBox25.Checked;
            uye.kutu25 = checkBox26.Checked;
            uye.kutu26 = checkBox27.Checked;
            uye.kutu27 = checkBox28.Checked;
            uye.kutu28 = checkBox29.Checked;
            uye.kutu29 = checkBox30.Checked;
            uye.kutu30 = checkBox31.Checked;
            uye.kutu31 = checkBox32.Checked;



            db.bilgilers.InsertOnSubmit(uye);
            db.SubmitChanges();
            MessageBox.Show("RANDEVU KAYIT EDİLDİ");


            TextBox1.Clear();
            TextBox2.Clear();
            TextBox3.Clear();
            TextBox4.Clear();
            textBox5.Clear();
            comboBox4.Items.Clear();
        }
Exemplo n.º 20
0
        private void Button1_Click(object sender, EventArgs e)
        {
            success = 0;

            var sqlQuery = "";
            int check    = 0;
            int f        = 0;

            //CHECK_NULL(check);



            if (TextBox1.Text == "")
            {
                MessageBox.Show("CANT KEEP Invoice Number AS NULL");
                check = 2;
                this.Close();
                IssueItem data = new IssueItem(user);

                data.Show();
                TextBox1.Focus();
            }
            else if (TextBox2.Text == "")
            {
                MessageBox.Show("CANT KEEP Class AS NULL");
                check = 2;
                this.Close();
                IssueItem data = new IssueItem(user);

                data.Show();
                TextBox2.Focus();
            }
            else if (TextBox3.Text == "")
            {
                MessageBox.Show("CANT KEEP Student Name AS NULL");
                this.Close();
                IssueItem data = new IssueItem(user);
                check = 2;
                data.Show();
                TextBox3.Focus();
            }



            for (int i = 0; i < DataGridView3.Rows.Count; i++)
            {
                if (Convert.ToInt32(TextBox1.Text) == Convert.ToInt32(DataGridView3.Rows[i].Cells[0].Value))
                {
                    check = 1;
                    break;
                }
            }

            SqlConnection con2 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\StockManagement.mdf;Integrated Security=True");

            SqlDataAdapter sda2  = new SqlDataAdapter("SELECT Invoice FROM [dbo].[Invoice] WHERE Invoice = '" + TextBox1.Text + "'", con2);
            DataTable      data2 = new DataTable();

            sda2.Fill(data2);
            DataGridView5.DataSource = data2;

            if (DataGridView5.Rows.Count > 0)
            {
                if (TextBox1.Text == DataGridView5.Rows[0].Cells[0].Value.ToString())
                {
                    success = 1;
                }
            }
            if (success == 0)
            {
                if (check == 0)
                {
                    for (int j = 0; j < DataGridView1.Rows.Count; j++)
                    {
                        int test = 0;
                        if (DataGridView1.Rows[j].Cells[4].Value.ToString() == "")
                        {
                            test = 1;
                        }
                        if (test == 0)
                        {
                            if (Convert.ToInt32(DataGridView1.Rows[j].Cells[4].Value) == 0)
                            {
                                int          n            = Convert.ToInt32(DataGridView1.Rows[j].Cells[0].Value);
                                DialogResult dialogResult = MessageBox.Show(String.Format("Quantity Entered at {0} is '0'. Do You Wish To Continue Ignoring that Stock ?", n), "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                if (dialogResult == DialogResult.No)
                                {
                                    f = 1;
                                }
                                else if (dialogResult == DialogResult.Yes)
                                {
                                    f = 0;
                                }
                            }
                        }
                    }
                    for (int i = 0; i < DataGridView1.Rows.Count; i++)
                    {
                        try
                        {
                            if (Convert.ToInt64(DataGridView2.Rows[i].Cells[0].Value) < Convert.ToInt64(DataGridView1.Rows[i].Cells[4].Value))
                            {
                                int k, a;
                                k = Convert.ToInt32(DataGridView1.Rows[i].Cells[0].Value);
                                a = Convert.ToInt32(DataGridView2.Rows[i].Cells[0].Value);

                                if (a == 0)
                                {
                                    MessageBox.Show("Stock Error!!", "Error 422", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    LoadItem();
                                    //    this.Close();
                                    f = 1;
                                    break;
                                }
                                else
                                {
                                    MessageBox.Show(String.Format("Your Book Code {0} does not contain prescribed Stock.", k), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);

                                    DialogResult dialogResult = MessageBox.Show(String.Format("The stock of {0} contains {1} data. Do You Wish To Continue with that Stock ?", k, a), "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                    if (dialogResult == DialogResult.Yes)
                                    {
                                        //SqlConnection con2 = new SqlConnection("Data Source=.;Initial Catalog=STOCK;Integrated Security=True");

                                        DataGridView1.Rows[i].Cells[4].Value = a;
                                        sqlQuery = @"INSERT INTO [dbo].[Orders]
                                        ([InvNo]
                                        ,[InvDate]
                                        ,[IssueDate]
                                        ,[StudentName]
                                        ,[Class]
                                        ,[Code]
                                        ,[Quantity]
                                        ,[DoneBy]
                                        ,[Subject]
                                        ,[Description])

                                           VALUES ('" + TextBox1.Text + "','" + DateTimePicker1.Text + "','" + DateTimePicker2.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "','" + DataGridView1.Rows[i].Cells[0].Value + "','" + DataGridView1.Rows[i].Cells[4].Value + "','" + TextBox4.Text + "','" + DataGridView1.Rows[i].Cells[2].Value + "','" + DataGridView1.Rows[i].Cells[3].Value + "' )";

                                        SqlCommand cmd1 = new SqlCommand(sqlQuery, con2);

                                        con2.Open();
                                        cmd1.ExecuteNonQuery();
                                        cmd1.Dispose();

                                        SqlDataAdapter sda8  = new SqlDataAdapter("SELECT NUM FROM [dbo].[ItemWiseRep] WHERE [Code] = '" + DataGridView1.Rows[i].Cells[0].Value + "'", con2);
                                        DataTable      data8 = new DataTable();
                                        sda8.Fill(data8);
                                        DataGridView4.DataSource = data8;

                                        int l = DataGridView4.Rows.Count;
                                        //int DIFF = 0;//Convert.ToInt32(DataGridView4.Rows[l - 1].Cells[0].Value) - Convert.ToInt32(DataGridView1.Rows[i].Cells[4].Value);


                                        SqlCommand cmd3 = new SqlCommand(@"INSERT INTO[dbo].[ItemWiseRep]
                                                                 ([Code]
                                                                 ,[Item]
                                                                 ,[DateOfSale]
                                                                 ,[SaleQty]
                                                                 ,[Balance Stock]
                                                                 ,[InvNo]
                                                                 ,[StudentName]
                                                                 ,[DateSort]
                                                                 ,[NUM])

                           
                                            VALUES('" + DataGridView1.Rows[i].Cells[0].Value + "', '" + DataGridView1.Rows[i].Cells[2].Value + "', '" + DateTimePicker2.Text + "', '" + DataGridView1.Rows[i].Cells[4].Value + "', '" + 0 + "','" + TextBox1.Text + "','" + TextBox3.Text + "', '" + DateTimePicker2.Text + "','" + (l + 1) + "')", con2);

                                        cmd3.ExecuteNonQuery();

                                        con2.Close();
                                        TABLE = 1;
                                    }

                                    else if (dialogResult == DialogResult.No)
                                    {
                                        f = 1;
                                        return;
                                        // break;
                                        //  IssueItem_Load(sender, e);//do something else
                                    }
                                }
                            }
                            else if (Convert.ToInt32(DataGridView1.Rows[i].Cells[4].Value) == 0)
                            {
                                f = 0;
                                // MessageBox.Show("HELLO 0");
                            }
                            else if (Convert.ToInt32(DataGridView2.Rows[i].Cells[0].Value) > Convert.ToInt32(DataGridView1.Rows[i].Cells[4].Value))
                            {
                                if (f == 0)
                                {
                                    //  MessageBox.Show("ENTERED");
                                    sqlQuery = @"INSERT INTO [dbo].[Orders]
                                    ([InvNo]
                                    ,[InvDate]
                                    ,[IssueDate]
                                    ,[StudentName]
                                    ,[Class]
                                    ,[Code]
                                    ,[Quantity]
                                    ,[DoneBy]
                                    ,[Subject]
                                    ,[Description])
                                

                                    VALUES ('" + TextBox1.Text + "','" + DateTimePicker1.Text + "','" + DateTimePicker2.Text + "','" + TextBox3.Text + "','" + TextBox2.Text + "','" + DataGridView1.Rows[i].Cells[0].Value + "','" + DataGridView1.Rows[i].Cells[4].Value + "','" + TextBox4.Text + "','" + DataGridView1.Rows[i].Cells[2].Value + "','" + DataGridView1.Rows[i].Cells[3].Value + "' )";

                                    SqlCommand cmd1 = new SqlCommand(sqlQuery, con2);

                                    con2.Open();
                                    cmd1.ExecuteNonQuery();
                                    //cmd1.Dispose();

                                    SqlDataAdapter sda8  = new SqlDataAdapter("SELECT NUM FROM [dbo].[ItemWiseRep] WHERE [Code] = '" + DataGridView1.Rows[i].Cells[0].Value + "'", con2);
                                    DataTable      data8 = new DataTable();
                                    sda8.Fill(data8);
                                    DataGridView4.DataSource = data8;
                                    // MessageBox.Show("ENTERED");
                                    int l = DataGridView4.Rows.Count;
                                    //   int DIFF = 0;//Convert.ToInt32(DataGridView4.Rows[l - 1].Cells[0].Value) - Convert.ToInt32(DataGridView1.Rows[i].Cells[4].Value);
                                    //  MessageBox.Show("ENTERED");
                                    SqlCommand cmd3 = new SqlCommand(@"INSERT INTO[dbo].[ItemWiseRep]
                                                                 ([Code]
                                                                 ,[Item]
                                                                 ,[DateOfSale]
                                                                 ,[SaleQty]
                                                                 ,[Balance Stock]
                                                                 ,[InvNo]
                                                                 ,[StudentName]
                                                                 ,[DateSort]
                                                                 ,[NUM])

                           
                                    VALUES('" + DataGridView1.Rows[i].Cells[0].Value + "', '" + DataGridView1.Rows[i].Cells[2].Value + "', '" + DateTimePicker2.Text + "', '" + DataGridView1.Rows[i].Cells[4].Value + "', '" + 0 + "','" + TextBox1.Text + "','" + TextBox3.Text + "', '" + DateTimePicker2.Text + "','" + (l + 1) + "')", con2);
                                    // MessageBox.Show("ENTERED!!!");
                                    cmd3.ExecuteNonQuery();
                                    //  MessageBox.Show("ENTERED");
                                    con2.Close();
                                    TABLE = 1;
                                    // MessageBox.Show(String.Format(" T = {0}", TABLE));
                                }
                            }
                        }

                        catch (Exception)
                        {
                            if (f == 0)
                            {
                                Thread.Sleep(1);
                            }
                        }
                    }

                    if (f == 0 && TABLE == 1)
                    {
                        SqlConnection con3 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\StockManagement.mdf;Integrated Security=True");

                        for (int i = 0; i < DataGridView1.Rows.Count; i++)
                        {
                            SqlCommand cmd3 = new SqlCommand(@"UPDATE [dbo].[StockAdd]
                                                  SET [Stock] = [Stock] - '" + DataGridView1.Rows[i].Cells[4].Value + "' WHERE Code = '" + DataGridView1.Rows[i].Cells[0].Value + "'", con3);
                            con3.Open();
                            cmd3.ExecuteNonQuery();
                            cmd3.Dispose();
                            con3.Close();
                        }



                        MessageBox.Show("UPDATED", "MESSAGE", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        SqlCommand cmd4 = new SqlCommand(@"INSERT INTO [dbo].[Invoice]
                                ([Invoice]
                                ,[Name])

                                   VALUES ('" + TextBox1.Text + "','" + TextBox3.Text + "' )", con3);

                        LoadItem();

                        //                        this.Close();



                        con3.Open();
                        cmd4.ExecuteNonQuery();
                        cmd4.Dispose();
                        con3.Close();
                        //MessageBox.Show("CHECK = 0");


                        TextBox1.Clear();
                        TextBox2.Text = "0";
                        TextBox3.Clear();
                        TextBox5.Clear();
                        ComboBox2.Text = "";
                        TextBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("DATA NOT ADDED!!", "NULL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (check == 2)
                {
                    MessageBox.Show("DATA NOT ADDED!!!", "NULL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Invoice Number ALREADY EXISTS!!", "Error 302", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (success == 1)
            {
                MessageBox.Show("Invoice Number ALREADY EXISTS!!", "Error 302", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 21
0
 private void Button1_Click(object sender, EventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
 }
Exemplo n.º 22
0
 private void limpiar()
 {
     TextBox3.Clear();
 }
Exemplo n.º 23
0
 private void TextBox2_KeyPress(object sender, KeyPressEventArgs e)
 {
     TextBox1.Clear();
     TextBox3.Clear();
     Util.CheckEditSymbol(sender, e);
 }
Exemplo n.º 24
0
 private void Clear(object sender, MouseEventArgs e)
 {
     TextBox1.Clear();
     TextBox2.Clear();
     TextBox3.Clear();
 }
Exemplo n.º 25
0
 private void TextBox3_MouseDoubleClick(object sender, RoutedEventArgs e)
 {
     TextBox3.Clear();
 }