Beispiel #1
0
        private void btnCloseSaleDB_Click(object sender, EventArgs e)
        {
            Visible = false;
            SellList sellList = new SellList();

            sellList.Show();
        }
Beispiel #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //if(delete == true)
            //{
            //    taSaleDetail.DeleteSaleDetailsItem(Convert.ToInt32(bur.Text));
            //    delete = false;
            //}


            int saleDetailsRow = taSaleDetail.FillSaleDetailsBySaleID(dsSaleDetail.SaleDetail, Convert.ToInt32(txtID.Text));

            Boolean wrongInput       = false;
            Boolean isSaleDetailFull = false;
            int     j      = 0;
            int     column = 9;

            string tempID     = "";
            string saleTempID = "";
            string CodeID     = "";
            string ItemName   = "";
            string ItemBrand  = "";
            string ItemSize   = "";
            int    Price      = 0;
            int    Quantity   = 0;
            int    Amount     = 0;



            //loop all controls in flSaleVoucher
            for (int i = 0; i < flSaleVoucherUpdate.Controls.Count; i++)
            {
                isSaleDetailFull = false;
                if (j <= column)
                {
                    if (j == 0)
                    {
                        tempID = flSaleVoucherUpdate.Controls[i].Text;
                    }
                    else if (j == 1)
                    {
                        saleTempID = flSaleVoucherUpdate.Controls[i].Text;
                    }
                    if (j == 2)
                    {
                        CodeID = flSaleVoucherUpdate.Controls[i].Text;
                    }

                    else if (j == 3)
                    {
                        ItemName = flSaleVoucherUpdate.Controls[i].Text;
                    }

                    else if (j == 4)
                    {
                        ItemBrand = flSaleVoucherUpdate.Controls[i].Text;
                    }

                    else if (j == 5)
                    {
                        ItemSize = flSaleVoucherUpdate.Controls[i].Text;
                    }

                    else if (j == 6)
                    {
                        Price = Convert.ToInt32(flSaleVoucherUpdate.Controls[i].Text);
                    }

                    else if (j == 7)
                    {
                        if (!flSaleVoucherUpdate.Controls[i].Text.Equals(""))
                        {
                            try
                            {
                                Quantity = Convert.ToInt32(flSaleVoucherUpdate.Controls[i].Text);
                            }
                            catch
                            {
                                MessageBox.Show("Please, enter the corrected format in the selected field!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                wrongInput = true;
                                flSaleVoucherUpdate.Controls[i].Focus();
                            }
                        }
                    }

                    else if (j == 8)
                    {
                        Amount = Convert.ToInt32(flSaleVoucherUpdate.Controls[i].Text);
                    }
                    else if (j == 9)
                    {
                        //after 7 times loop
                        isSaleDetailFull = true;
                        taSaleDetail.UpdateSaleDetails(CodeID, ItemName, ItemBrand, ItemSize, Price, Quantity, Amount, Convert.ToInt32(tempID));
                    }
                    //MessageBox.Show("J value " + j);
                    j++;
                }
                if (isSaleDetailFull)
                {
                    j = 0;
                }
            }


            if (Convert.ToInt32(txtLeft.Text) < 0)
            {
                if (wrongInput == true)
                {
                    MessageBox.Show("Wrong Input Format!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    taSaleVoucher.UpdateSaleVoucher(txtCustomerName.Text, txtAddress.Text, txtPhoneNumber.Text, dtpDate.Value,
                                                    0, Convert.ToInt32(txtTotal.Text), Convert.ToInt32(txtPaid.Text), Convert.ToInt32(txtLeft.Text), "Paid", Convert.ToInt32(txtID.Text));
                    MessageBox.Show("Sale Voucher Update is successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (wrongInput == true)
                {
                    MessageBox.Show("Wrong Input Format!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    taSaleVoucher.UpdateSaleVoucher(txtCustomerName.Text, txtAddress.Text, txtPhoneNumber.Text, dtpDate.Value,
                                                    0, Convert.ToInt32(txtTotal.Text), Convert.ToInt32(txtPaid.Text), Convert.ToInt32(txtLeft.Text), "Left", Convert.ToInt32(txtID.Text));
                    MessageBox.Show("Sale Voucher Update is successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            //taSaleVoucher.UpdateSaleVoucher(txtCustomerName.Text, txtAddress.Text, txtPhoneNumber.Text, dtpDate.Value, Convert.ToInt32(txtTax.Text), Convert.ToInt32(txtTotal.Text), Convert.ToInt32(txtPaid.Text), Convert.ToInt32(txtLeft.Text), Convert.ToInt32(txtID.Text));
            wrongInput   = false;
            this.Visible = false;
            SellList sellList = new SellList();

            sellList.Show();
        }
Beispiel #3
0
        private void btnSellList_Click(object sender, EventArgs e)
        {
            SellList SL = new SellList();

            SL.Show();
        }