Example #1
0
        private void ORVibtn_Click(object sender, EventArgs e)
        {
            if (ORvirbtn.Checked == true)
            {
                ORnumtxt.Text    = "";
                ORnumtxt.Enabled = false;

                BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter orview = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter();
                DataTable datatable = orview.ViewAll();

                Official_Receipt_Masterlist rpt = new Official_Receipt_Masterlist();

                OfficialReceipt orpt = new OfficialReceipt();
                orpt.SetDataSource(datatable);

                rpt.AssignORReport(orpt);
                rpt.Show();
            }

            else
            {
                if ((ORnumtxt.Text != "" && ORUptxt.Text == "") || (ORnumtxt.Text == "" && ORUptxt.Text != "") || (ORnumtxt.Text == "" && ORUptxt.Text == ""))
                {
                    MessageBox.Show("Please enter an OR ID", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    int a = Convert.ToInt32(ORnumtxt.Text);
                    int b = Convert.ToInt32(ORUptxt.Text);
                    BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter ornum = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter();
                    DataTable datatable = ornum.orselect(a, b);

                    Official_Receipt_Masterlist rpt = new Official_Receipt_Masterlist();

                    OfficialReceipt orpt = new OfficialReceipt();
                    orpt.SetDataSource(datatable);

                    rpt.AssignORReport(orpt);
                    rpt.Show();
                }
            }
        }
Example #2
0
        private void Okbtn_Click(object sender, EventArgs e)
        {
            if (ORnumtxt.Text == "" || Syspasstxt.Text == "" || Recordtxt.Text == "")
            {
                MessageBox.Show("Please fill up the required fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ORnumtxt.Focus();
            }
            else if (Syspasstxt.Text.Trim() != password)
            {
                MessageBox.Show("Invalid password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Syspasstxt.Text = "";
            }

            else
            {
                String id;
                int    a = 0, id2;



                cmd = new SqlCommand("Select * from [Official Receipt]", conn);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    id  = dr["OR ID"].ToString();
                    id2 = Convert.ToInt32(id);
                    if (a < id2)
                    {
                        a = id2;
                    }
                }
                dr.Close();
                a++;

                BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter addor = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Official_ReceiptTableAdapter();
                addor.AddOfficialReceipt(a, DateTime.Now, ORnumtxt.Text.Trim(), Convert.ToInt32(COFNumLbl.Text), Convert.ToDecimal(VatPerLbl.Text), Convert.ToDecimal(VATAmtLbl.Text), Convert.ToDecimal(OrderAmtLbl.Text), Convert.ToDecimal(ServChLbl.Text), Convert.ToDecimal(TotLbl.Text), Recordtxt.Text.Trim());
                MessageBox.Show("Successfully entered your OR number!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }