Exemplo n.º 1
0
        public void insertcompany(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "INSERT INTO company (companyname,companyaddress,companycontactno) VALUES('" + p.Companyname + "','" + p.Companyaddress + "','" + p.Companycontactno + "')";
                cmd.CommandType = CommandType.Text;



                cmd.ExecuteNonQuery();
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 2
0
        public void insertproduct(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "INSERT INTO product(productname, productquantity, productprice, producttotal) VALUES('" + p.Productname + "','" + p.Productquantity + "','" + p.Productprice + "','" + p.Producttotal + "')";
                cmd.CommandType = CommandType.Text;


                cmd.ExecuteNonQuery();
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 3
0
        public void insertuser(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "INSERT INTO user (username,password,contactno) VALUES('" + p.Name + "','" + p.Address + "','" + p.Contactno + "')";
                cmd.CommandType = CommandType.Text;


                cmd.ExecuteNonQuery();
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 4
0
        public void insertowncompany(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "UPDATE owncompany SET owncompanyname='" + p.Owncompany + "' , owncompanyaddress='" + p.Owncompaddress + "', owncompanyno='" + p.Owncompcontactno + "'  WHERE owncompanyID = 1";
                cmd.CommandType = CommandType.Text;



                cmd.ExecuteNonQuery();
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 5
0
        public void insertvoice(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "INSERT INTO invoice(invoiceno,invoicedatetime,billprice,companyname) VALUES('" + p.Billnumber + "','" + p.Invoicedatetime + "','" + p.Billprice + "','" + p.Companynameforinvoice + "')";
                cmd.CommandType = CommandType.Text;


                cmd.ExecuteNonQuery();
            }

            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 6
0
 private void btnCompanySubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Iscomp())
         {
             datavalues pc = new datavalues();
             pc.Companyname      = txtCompantName.Text;
             pc.Companyaddress   = txtCompanyAddress.Text;
             pc.Companycontactno = txtComanyContact.Text;
             b.insertcompany(pc);
             MessageBox.Show("Company has been added successfully", "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 7
0
 private void btnowncompsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Isowncomp())
         {
             datavalues pc = new datavalues();
             pc.Owncompany       = txtowncomp.Text;
             pc.Owncompaddress   = txtownadd.Text;
             pc.Owncompcontactno = txtowncntct.Text;
             b.insertowncompany(pc);
             MessageBox.Show("Your company information has been replaced successfully", "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 8
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Isuser())
         {
             datavalues pc = new datavalues();
             pc.Name      = txtUserName.Text;
             pc.Address   = txtPassword.Text;
             pc.Contactno = txtContact.Text;
             b.insertuser(pc);
             MessageBox.Show("User has been added successfully", "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 9
0
 private void btnProductSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Isproduct())
         {
             datavalues pc = new datavalues();
             pc.Productname     = txtProductName.Text;
             pc.Productquantity = Convert.ToInt16(txtQuantity.Text);
             pc.Productprice    = Convert.ToInt16(txtPrize.Text);
             int calculation = (Convert.ToInt16(txtQuantity.Text) * Convert.ToInt16(txtPrize.Text));
             pc.Producttotal = calculation;
             b.insertproduct(pc);
             MessageBox.Show("Product has been addded successfully", "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 10
0
        public datavalues invoicehistorydetail(datavalues p)
        {
            try
            {
                conn.Open();
                cmd.CommandText = "SELECT invoiceno,invoicedatetime,billprice,companyname FROM invoice;";
                cmd.CommandType = CommandType.Text;

                cmd.Connection = conn;
                SQLiteDataReader sdr = null;
                using (sdr = cmd.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        p.Billnumber            = sdr[0].ToString();
                        p.Invoivedatetime       = sdr[1].ToString();
                        p.Billprice             = Convert.ToDecimal(sdr[2]);
                        p.Companynameforinvoice = sdr[3].ToString();
                    }
                }
                return(p);
                //cmd.Dispose();
            }


            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 11
0
        private void btnprinterorder_Click(object sender, EventArgs e)
        {
            if (dataGridView1.DataSource != null)
            {
                PrinterSettings ps        = new PrinterSettings();
                var             recordDoc = new PrintDocument();
                recordDoc.PrinterSettings = ps;
                IEnumerable <PaperSize> paperSizes = ps.PaperSizes.Cast <PaperSize>();
                PaperSize sizeA4 = paperSizes.First <PaperSize>(size => size.Kind == PaperKind.A4);    // setting paper size to A4 size
                recordDoc.DefaultPageSettings.PaperSize = sizeA4;
                recordDoc = printDocument1;
                printPreviewDialog1.Document = recordDoc;
                //recordDoc.DefaultPageSettings.Landscape = true;
                //printDocument1.Print();
                recordDoc.Print();

                datavalues pc = new datavalues();
                pc.Billnumber            = lblbillno.Text;
                pc.Invoicedatetime       = DateTime.Now;
                pc.Billprice             = Convert.ToDecimal(txttotalamount.Text);
                pc.Companynameforinvoice = cmbcompanyname.SelectedValue.ToString();;
                b.insertvoice(pc);
                //database
            }

            else
            {
                MessageBox.Show("List is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //    }

            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }