예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ado_project db = new ado_project();

            try
            {
                string name             = textBox3.Text;
                string code             = textBox1.Text;
                string description      = textBox2.Text;
                Int64  unit_value       = Int64.Parse(maskedTextBox1.Text);
                Int64  current_quntaty  = Int64.Parse(maskedTextBox2.Text);
                Int64  ideal_quntaty    = Int64.Parse(maskedTextBox3.Text);
                Int64  warnning_quntaty = Int64.Parse(maskedTextBox4.Text);
                db.insert_items(code, name, description, unit_value, current_quntaty, ideal_quntaty, warnning_quntaty);
                MessageBox.Show("Done");
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }

            textBox3.Text       = "";
            textBox1.Text       = "";
            textBox2.Text       = "";
            maskedTextBox1.Text = "";
            maskedTextBox2.Text = "";
            maskedTextBox3.Text = "";
            maskedTextBox4.Text = "";

            Form1 f = new Form1();

            f.Refresh();
        }
예제 #2
0
        private void Open_Customer_Load(object sender, EventArgs e)
        {
            con.Open();
            dataGridView1.Rows.Clear();
            Dt             = new DataTable();
            com            = new SqlCommand("select company_name,contact_person,phone_puplic,sales_person,custmer_group,blance from customer");
            com.Connection = con;
            adapt          = new SqlDataAdapter(com);
            adapt.Fill(Dt);

            // dataGridView1.DataSource = Dt;

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                dataGridView1.Rows.Add(Dt.Rows[i][0], Dt.Rows[i][1], Dt.Rows[i][2], Dt.Rows[i][3], Dt.Rows[i][4], Dt.Rows[i][5]);
            }
            con.Close();


            ado_project f = new ado_project();

            dt = f.combo_opencust();

            dr    = dt.NewRow();
            dr[0] = "All";
            dt.Rows.Add(dr);

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[0].ToString();

            Open_Customer op = new Open_Customer();

            op.Refresh();
        }
예제 #3
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            try
            {
                ado_project dd = new ado_project();
                int         i  = dataGridView1.CurrentRow.Index;

                string cmp_name = dataGridView1.Rows[i].Cells[0].Value.ToString();
                dd.delete_customer(cmp_name);
                dataGridView1.Refresh();
            }
            catch (Exception)
            { MessageBox.Show("you can't Delete all companies"); }
            #region MyRegion
            //for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
            //{
            //    cmp_name = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
            //}
            //if (dataGridView1.SelectedRows[0].Selected)
            //{

            //}
            //else
            //{ MessageBox.Show("Please Select Company to Delete"); }
            #endregion
        }
예제 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string      code        = textBox1.Text;
         string      name        = textBox3.Text;
         string      describtion = textBox2.Text;
         double      price       = double.Parse(maskedTextBox1.Text.ToString());
         Int64       quantaty    = Int64.Parse(maskedTextBox2.Text.ToString());
         Int64       ideal       = Int64.Parse(maskedTextBox3.Text.ToString());
         Int64       warnning    = Int64.Parse(maskedTextBox4.Text.ToString());
         ado_project d           = new ado_project();
         d.update_item(valuee, code, name, describtion, price, quantaty, ideal, warnning);
         MessageBox.Show("Done");
         textBox1.Text       = "";
         textBox2.Text       = "";
         textBox3.Text       = "";
         maskedTextBox1.Text = "";
         maskedTextBox2.Text = "";
         maskedTextBox3.Text = "";
         maskedTextBox4.Text = "";
     }
     catch (Exception)
     { MessageBox.Show("Try Again"); }
     //update_item up = new update_item();
     //up.Refresh();
 }
예제 #5
0
        private void start_Load(object sender, EventArgs e)
        {
            ado_project TDB = new ado_project();
            DataTable   dt  = TDB.return_company_name();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[0].ToString();
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            ado_project dd     = new ado_project();
            string      groupp = textBox1.Text;

            dd.insertgroup(groupp);
            MessageBox.Show("done");
        }
예제 #7
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            ado_project dd = new ado_project();
            int         i  = dataGridView1.CurrentRow.Index;

            string item = dataGridView1.Rows[i].Cells[1].Value.ToString();

            dd.delete_items(item);
            MessageBox.Show("The Item Deleted");
            dataGridView1.Refresh();
        }
예제 #8
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string      item = (dataGridView1.SelectedRows[0].Cells[1].Value.ToString());
            Int64       id   = 0;
            ado_project n    = new ado_project();

            n.select_id_itemname(item, ref id);
            open_item op = new open_item(id);

            op.ShowDialog();
        }
예제 #9
0
        private void payments_Load(object sender, EventArgs e)
        {
            dataGridView1.Columns[5].Visible = true;
            ado_project TDB = new ado_project();
            DataTable   dt  = TDB.return_company_name();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[0].ToString();
            payments p = new payments();

            p.Refresh();
        }
예제 #10
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ado_project d       = new ado_project();
            string      person  = "";
            string      address = "";
            Int64       ph      = 0;
            string      name    = comboBox1.Text;

            d.select_data(name, ref person, ref address, ref ph);
            textBox2.Text       = person;
            textBox1.Text       = address;
            maskedTextBox1.Text = ph.ToString();
        }
예제 #11
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string      company_name = (dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
            int         id           = 0;
            ado_project n            = new ado_project();

            n.select_id_Companyname(company_name, ref id);


            more_information frm = new more_information(id);

            frm.ShowDialog();
        }
예제 #12
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     try
     {
         string      company_name = (dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
         int         id           = 0;
         ado_project n            = new ado_project();
         n.select_id_Companyname(company_name, ref id);
         update_customer uc = new update_customer(id);
         uc.ShowDialog();
     }
     catch (Exception)
     { MessageBox.Show("Please Choose One Company"); }
 }
예제 #13
0
        private void invoice_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'projectDataSet5.items' table. You can move, or remove it, as needed.
            this.itemsTableAdapter2.Fill(this.projectDataSet5.items);
            // TODO: This line of code loads data into the 'projectDataSet1.items' table. You can move, or remove it, as needed.
            this.itemsTableAdapter1.Fill(this.projectDataSet1.items);
            // TODO: This line of code loads data into the 'projectDataSet.items' table. You can move, or remove it, as needed.
            this.itemsTableAdapter.Fill(this.projectDataSet.items);

            ado_project TDB = new ado_project();
            DataTable   dt  = TDB.return_company_name();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[0].ToString();
        }
예제 #14
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int c;

            try
            {
                count = 0;
                ado_project ado      = new ado_project();
                string      descripe = "";
                Int64       num      = 0;
                double      value    = 0;

                for (int i = 0; i < dataGridView1.RowCount - 1; i++)
                {
                    c = int.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
                    Int64 n = Int64.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    ado.select_invoice_info(c, ref descripe, ref num, ref value);
                    dataGridView1.Rows[i].Cells[2].Value = descripe;
                    dataGridView1.Rows[i].Cells[3].Value = value;


                    if (num >= n)
                    {
                        double calculate = n * value;
                        dataGridView1.Rows[i].Cells[4].Value = calculate;
                        count += Int64.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());
                    }


                    else
                    {
                        DialogResult dialogResult = MessageBox.Show("The Amount Not Enough Clik Ok To Remove It ,click No To Edit", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (dialogResult == DialogResult.Yes)
                        {
                            dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index);
                        }
                    }
                }
                label9.Text = count.ToString();
            }

            catch
            {
                c = 0;
            }
        }
예제 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            ado_project dd = new ado_project();

            try
            {
                Int64  idd                  = value;
                string comp_name            = textBox1.Text;
                string contact_person       = textBox2.Text;
                string address              = textBox3.Text;
                Int64  phone_prim           = Int64.Parse(maskedTextBox1.Text);
                Int64  phone_alt            = Int64.Parse(maskedTextBox2.Text);
                string email                = textBox4.Text;
                Int64  card_numm            = Int64.Parse(maskedTextBox3.Text);
                Int64  cardverification_num = Int64.Parse(maskedTextBox4.Text);
                string cardtype             = comboBox1.Text.ToString();
                Int64  expiration_month     = Int64.Parse(comboBox2.Text.ToString());
                Int64  expiration_year      = Int64.Parse(comboBox3.Text.ToString());
                string card_holder          = textBox5.Text;

                string shipping_address = textBox6.Text;
                string sales_person     = textBox7.Text;
                string customer_note    = textBox8.Text;
                string customer_group   = comboBox6.Text.ToString();
                dd.update_customer(idd, comp_name, contact_person, address, phone_prim, phone_alt, email, card_numm, cardverification_num, cardtype, expiration_month, expiration_year, card_holder, shipping_address, sales_person, customer_note, customer_group);
                MessageBox.Show("done");
                textBox1.Text       = "";
                textBox2.Text       = "";
                textBox3.Text       = "";
                maskedTextBox1.Text = "";
                maskedTextBox2.Text = "";
                textBox4.Text       = "";
                maskedTextBox3.Text = "";
                maskedTextBox4.Text = "";
                comboBox1.Text      = "";
                comboBox2.Text      = "";
                comboBox3.Text      = "";
                textBox5.Text       = "";
                textBox6.Text       = "";
                textBox7.Text       = "";
                textBox8.Text       = "";
                comboBox6.Text      = "";
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }
        }
예제 #16
0
        private void Open_Invoice_List_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'projectDataSet8.invoice_1' table. You can move, or remove it, as needed.
            this.invoice_1TableAdapter1.Fill(this.projectDataSet8.invoice_1);
            // TODO: This line of code loads data into the 'projectDataSet7.invoice_1' table. You can move, or remove it, as needed.
            //this.invoice_1TableAdapter.Fill(this.projectDataSet7.invoice_1);

            ado_project TDB = new ado_project();
            DataTable   dt  = TDB.return_company_name();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[0].ToString();
            radioButton1.Checked    = true;
            Open_Invoice_List op = new Open_Invoice_List();

            op.Refresh();
        }
예제 #17
0
        private void update_customer_Load(object sender, EventArgs e)
        {
            ado_project f  = new ado_project();
            DataTable   dt = f.combo_opencust();

            comboBox6.DataSource    = dt;
            comboBox6.DisplayMember = dt.Columns[0].ToString();


            con.Open();
            SqlCommand    com = new SqlCommand("select company_name,contact_person,address,phone_primary,phone_puplic,e_mail,card_num,card_verification_num,card_type,expiration_month,expiration_year,cardholder_name,shipping_address,sales_person,customer_notes,custmer_group,blance from customer where customer_id='" + value + "'", con);
            SqlDataReader dr  = com.ExecuteReader();

            if (dr.Read())
            {
                textBox1.Text       = dr[0].ToString();
                textBox2.Text       = dr[1].ToString();
                textBox3.Text       = dr[2].ToString();
                maskedTextBox1.Text = dr[3].ToString();
                maskedTextBox2.Text = dr[4].ToString();
                textBox4.Text       = dr[5].ToString();
                maskedTextBox3.Text = dr[6].ToString();
                maskedTextBox4.Text = dr[7].ToString();
                comboBox1.Text      = dr[8].ToString();
                comboBox2.Text      = dr[9].ToString();
                comboBox3.Text      = dr[10].ToString();
                textBox5.Text       = dr[11].ToString();

                textBox6.Text       = dr[12].ToString();
                textBox7.Text       = dr[13].ToString();
                textBox8.Text       = dr[14].ToString();
                comboBox6.Text      = dr[15].ToString();
                maskedTextBox5.Text = dr[16].ToString();
            }
            dr.Close();
            con.Close();
        }
예제 #18
0
        private void Customer_Load(object sender, EventArgs e)
        {
            ado_project f  = new ado_project();
            DataTable   dt = f.combo_opencust();

            comboBox6.DataSource    = dt;
            comboBox6.DisplayMember = dt.Columns[0].ToString();
            //if (checkBox1.Checked == true)
            //{
            //    maskedTextBox3.Text = "";
            //    maskedTextBox4.Text = "";
            //    comboBox1.Text = "";
            //    comboBox2.Text = "";
            //    comboBox3.Text = "";
            //    textBox5.Text = "";
            //    maskedTextBox3.Enabled = false;
            //    maskedTextBox4.Enabled = false;
            //    comboBox1.Enabled = false;
            //    comboBox2.Enabled = false;
            //    comboBox3.Enabled = false;
            //    textBox5.Enabled = false;

            //}
        }
예제 #19
0
        private void recordOnlyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string company       = comboBox1.Text;
                string contactperson = textBox2.Text;
                string address       = textBox1.Text;
                Int64  ph            = Int64.Parse(maskedTextBox1.Text);
                string shiptoo       = "";
                try { shiptoo = textBox3.Text; }
                catch { shiptoo = ""; }

                string shipbyy = "";
                try { shipbyy = textBox6.Text; }
                catch { shipbyy = ""; }

                Int64 shipcost = 0;
                try
                { shipcost = Int64.Parse(maskedTextBox2.Text); }
                catch
                { shipcost = 0; }

                string date    = dateTimePicker1.Text;
                Int64  payment = 0;
                try { payment = Int64.Parse(domainUpDown2.Text); }
                catch { payment = 0; }

                string salesperson = "";
                try { salesperson = textBox5.Text; }
                catch { salesperson = ""; }

                string note = "";
                try { note = textBox4.Text; }
                catch { note = ""; }
                double      total    = double.Parse(label9.Text) + shipcost;
                double      ppaid    = 0;
                double      cchange  = double.Parse(label9.Text);
                string      done     = "false";
                string      date_due = "Not Paid";
                int         idd      = 0;
                ado_project d        = new ado_project();
                d.select_id_Companyname(company, ref idd);

                d.insert_invoice(company, contactperson, address, ph, shiptoo, shipbyy, shipcost, date, date_due, payment, salesperson, note, total, ppaid, cchange, done, idd);

                int use_id = 0;
                d.select_id(company, date, ref use_id);
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    Int64  amount_num   = Int64.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    int    item         = int.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
                    string descriiption = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    Int64  unittprice   = Int64.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString());
                    Int64  ssuptotal    = Int64.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());

                    //string itemm = "";
                    //d.select_itemmname(item, ref itemm);
                    d.insert_invoice2(amount_num, item, ssuptotal, use_id);

                    Int64 ref_unmber = 0;
                    d.select_itemname(item, ref ref_unmber);
                    Int64 new_num = ref_unmber - amount_num;
                    d.update_numberitem(item, new_num);
                }
                MessageBox.Show("Recording Done");
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }


            textBox3.Text       = "";
            textBox6.Text       = "";
            maskedTextBox1.Text = "";
            textBox4.Text       = "";
            textBox5.Text       = "";
            domainUpDown2.Text  = "";
            label9.Text         = "00.00";
        }
예제 #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            ado_project dd = new ado_project();

            try
            {
                string comp_name      = textBox1.Text;
                string contact_person = textBox2.Text;
                string address        = textBox3.Text;
                Int64  phone_prim     = Int64.Parse(maskedTextBox1.Text);
                Int64  phone_alt      = Int64.Parse(maskedTextBox2.Text);
                string email          = textBox4.Text;

                Int64  card_numm;
                Int64  cardverification_num;
                string cardtype;
                Int64  expiration_month;
                Int64  expiration_year;
                string card_holder;
                if (checkBox1.Checked == true)
                {
                    card_numm            = 0;
                    cardverification_num = 0;
                    cardtype             = "";
                    expiration_month     = 0;
                    expiration_year      = 0;
                    card_holder          = "";
                }
                else
                {
                    card_numm            = Int64.Parse(maskedTextBox3.Text);
                    cardverification_num = Int64.Parse(maskedTextBox4.Text);
                    cardtype             = comboBox1.Text.ToString();
                    expiration_month     = Int64.Parse(comboBox2.Text.ToString());
                    expiration_year      = Int64.Parse(comboBox3.Text.ToString());
                    card_holder          = textBox5.Text;
                }
                string shipping_address = textBox6.Text;
                string sales_person     = textBox7.Text;
                string customer_note    = textBox8.Text;
                string customer_group   = comboBox6.Text.ToString();
                double balanc           = 0;

                dd.insert_customer(comp_name, contact_person, address, phone_prim, phone_alt, email, card_numm, cardverification_num, cardtype, expiration_month, expiration_year, card_holder, shipping_address, sales_person, customer_note, customer_group, balanc);
                MessageBox.Show("Done");
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }

            textBox1.Text       = "";
            textBox2.Text       = "";
            textBox3.Text       = "";
            maskedTextBox1.Text = "";
            maskedTextBox2.Text = "";
            textBox4.Text       = "";
            maskedTextBox3.Text = "";
            maskedTextBox4.Text = "";
            comboBox1.Text      = "";
            comboBox2.Text      = "";
            comboBox3.Text      = "";
            textBox5.Text       = "";
            textBox6.Text       = "";
            textBox7.Text       = "";
            textBox8.Text       = "";
            comboBox6.Text      = "";

            Customer c = new Customer();

            c.Refresh();
        }
예제 #21
0
        private void recordWithPaymentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string company       = comboBox1.Text;
                string contactperson = textBox2.Text;
                string address       = textBox1.Text;
                Int64  ph            = Int64.Parse(maskedTextBox1.Text);
                string shiptoo       = "";
                try { shiptoo = textBox3.Text; }
                catch { shiptoo = ""; }

                string shipbyy = "";
                try { shipbyy = textBox6.Text; }
                catch { shipbyy = ""; }

                Int64 shipcost = 0;
                try
                { shipcost = Int64.Parse(maskedTextBox2.Text); }
                catch
                { shipcost = 0; }

                string date    = dateTimePicker1.Text;
                Int64  payment = 0;
                try { payment = Int64.Parse(domainUpDown2.Text); }
                catch { payment = 0; }

                string salesperson = "";
                try { salesperson = textBox5.Text; }
                catch { salesperson = ""; }

                string note = "";
                try { note = textBox4.Text; }
                catch { note = ""; }
                double      total  = double.Parse(label9.Text) + shipcost;
                double      paid   = double.Parse(label9.Text);
                double      change = 0;
                string      done   = "true";
                int         idd    = 0;
                ado_project d      = new ado_project();

                d.select_id_Companyname(company, ref idd);
                d.insert_invoice(company, contactperson, address, ph, shiptoo, shipbyy, shipcost, date, date, payment, salesperson, note, total, paid, change, done, idd);

                int use_id = 0;
                d.select_id(company, date, ref use_id);
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    Int64  amount_num   = Int64.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    int    item         = int.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
                    string descriiption = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    Int64  unittprice   = Int64.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString());
                    Int64  ssuptotal    = Int64.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());

                    //string itemm = "";
                    //d.select_itemmname(item,ref itemm);
                    d.insert_invoice2(amount_num, item, ssuptotal, use_id);

                    Int64 ref_unmber = 0;
                    d.select_itemname(item, ref ref_unmber);
                    Int64 new_num = ref_unmber - amount_num;
                    d.update_numberitem(item, new_num);
                }
                DialogResult dialogResult = MessageBox.Show("Recoding With Payment Done ,Do you Want Print Invoice?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    DataTable2TableAdapter          d2 = new DataTable2TableAdapter();
                    invoiceSet1.DataTable2DataTable dd = new invoiceSet1.DataTable2DataTable();
                    d2.Fill(dd, use_id);
                    testt rpt = new testt();
                    rpt.SetDataSource(dd[0].Table);


                    Report_Viewer vd = new Report_Viewer();

                    vd.crystalReportViewer1.ReportSource = rpt;
                    vd.ShowDialog();
                }
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }


            textBox3.Text       = "";
            textBox6.Text       = "";
            maskedTextBox1.Text = "";
            textBox4.Text       = "";
            textBox5.Text       = "";
            domainUpDown2.Text  = "";
            label9.Text         = "00.00";
        }