Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {//string sql = "update  clientdetails set  name ='" + comboBox1.Text + "',addr ='" + textBox3.Text + "',phno ='" + textBox4.Text + "',email ='" + textBox5.Text + "',tob ='" + textBox6.Text + "',camt ='" + textBox7.Text + "',date ='" +dateTimePicker1.Text + "',period ='" + textBox8.Text + "' where slno ='" + textBox1.Text + "'";
            int    k = 0;
            string sql;

            if (textBox2.Text.Length > 0 && textBox3.Text.Length > 0 && comboBox2.Text.Length > 0 && comboBox3.Text.Length > 0 && textBox7.Text.Length > 0)
            {
                if (radioButton2.Checked == true)
                {
                    if (textBox1.Text.Length == 0 && textBox8.Text.Length == 0 && textBox9.Text.Length == 0)
                    {
                        k = 1;
                    }

                    sql   = "update  addindetails set  date ='" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "',name ='" + textBox3.Text + "',inacc ='" + comboBox2.Text + "',inhd ='" + comboBox3.Text + "',des ='" + textBox6.Text + "',amnt ='" + textBox7.Text + "',bnkname ='" + textBox8.Text + "',chqno ='" + textBox9.Text + "',chqdt ='" + textBox1.Text + "',mthd ='CHECK' where id ='" + row.Cells[0].Value.ToString() + "'";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), textBox3.Text, textBox7.Text, "CHECK", textBox9.Text, textBox1.Text, textBox8.Text, };
                }
                else if (radioButton3.Checked == true)
                {
                    if (textBox4.Text.Length == 0)
                    {
                        k = 1;
                    }
                    sql   = "update  addindetails set  date ='" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "',name ='" + textBox3.Text + "',inacc ='" + comboBox2.Text + "',inhd ='" + comboBox3.Text + "',des ='" + textBox6.Text + "',amnt ='" + textBox7.Text + "',bnkname ='" + textBox4.Text + "',mthd ='BANK TRANSFER' where id ='" + row.Cells[0].Value.ToString() + "'";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), textBox3.Text, textBox7.Text, "BANK", textBox4.Text };
                }
                else
                {
                    sql   = "update  addindetails set  date ='" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "',name ='" + textBox3.Text + "',inacc ='" + comboBox2.Text + "',inhd ='" + comboBox3.Text + "',des ='" + textBox6.Text + "',amnt ='" + textBox7.Text + "',mthd ='CASH' where id ='" + row.Cells[0].Value.ToString() + "'";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), textBox3.Text, textBox7.Text, "CASH" };
                }
                if (k == 0)
                {
                    using (SQLiteConnection cnn = new SQLiteConnection(dbConnection))
                    {
                        SQLiteCommand sqlCmd = new SQLiteCommand(sql, cnn);
                        cnn.Open();
                        int a = sqlCmd.ExecuteNonQuery();
                        if (q == 1)
                        {
                            MessageBox.Show("SAVED SUCCEFULLY");
                        }
                        else
                        {
                            Form15 form15 = new Form15(print);
                            form15.ShowDialog();
                        }

                        q = 1;
                    }
                }
                else
                {
                    MessageBox.Show("Completely Fill data");
                }
            }
            else
            {
                MessageBox.Show("Completely Fill data");
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            int k = 0;

            if (textBox2.Text.Length > 0 && comboBox1.Text.Length > 0 && comboBox2.Text.Length > 0 && comboBox3.Text.Length > 0 && textBox7.Text.Length > 0)
            {
                if (radioButton2.Checked == true)
                {
                    if (textBox1.Text.Length == 0 && textBox8.Text.Length == 0 && textBox9.Text.Length == 0)
                    {
                        k = 1;
                    }
                    sql   = "insert into addindetails (date,name,inacc,inhd,des,amnt,bnkname,chqno,chqdt,mthd) values ('" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + comboBox3.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox1.Text + "','CHECK');";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), comboBox1.Text, textBox7.Text, "CHECK", textBox9.Text, textBox1.Text, textBox8.Text };
                }
                else if (radioButton3.Checked == true)
                {
                    if (textBox8.Text.Length == 0)
                    {
                        k = 1;
                    }
                    sql   = "insert into addindetails (date,name,inacc,inhd,des,amnt,bnkname,mthd) values ('" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + comboBox3.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','BANK TRANSFER');";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), comboBox1.Text, textBox7.Text, "BANK", textBox8.Text };
                }
                else
                {
                    sql   = "insert into addindetails (date,name,inacc,inhd,des,amnt,mthd) values ('" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + comboBox3.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','CASH');";
                    print = new string[] { dateTimePicker1.Value.ToString("dd-MM-yyyy"), comboBox1.Text, textBox7.Text, "CASH" };
                }
                if (k == 0)
                {
                    using (SQLiteConnection cnn = new SQLiteConnection(dbConnection))
                    {
                        SQLiteCommand sqlCmd = new SQLiteCommand(sql, cnn);
                        cnn.Open();
                        int a = sqlCmd.ExecuteNonQuery();

                        textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox1.Text = "";
                        textBox2.Text = "";

                        combo_load();
                        imainhd_load();
                        comboBox2_SelectedIndexChanged(null, null);
                        //comboBox2.ResetText();
                        if (q == 1)
                        {
                            MessageBox.Show("SAVED SUCCEFULLY");
                        }
                        else
                        {
                            Form15 form15 = new Form15(print);
                            form15.ShowDialog();
                        }
                        q = 1;
                    }
                }
                else
                {
                    MessageBox.Show("Completely Fill data");
                }
            }
            else
            {
                MessageBox.Show("Completely Fill data");
            }
        }