Example #1
0
        private void frmInvoiceList_Load(object sender, EventArgs e)
        {
            BL_frmInvoiceList M = new BL_frmInvoiceList();

            this.Datagridview1.DataSource = M.SelectAllReverse();
            UpdateDataGrid();
        }
Example #2
0
        private void btnLast100Invoice_Click(object sender, EventArgs e)
        {
            BL_frmInvoiceList M = new BL_frmInvoiceList();

            this.Datagridview1.DataSource = M.SelectLast100();
            UpdateDataGrid();
        }
Example #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (rbFDate.Checked == true)
            {
                if (txtFDate1.Text == "" || txtFDate2.Text == "")
                {
                    MessageBox.Show("لطفا محدوده تاریخ را وارد کنید", "خطا", MessageBoxButtons.OK);
                    return;
                }

                bool validfdate1 = G.ValidateParsianDate(txtFDate1.Text.ToString());
                bool validfdate2 = G.ValidateParsianDate(txtFDate2.Text.ToString());

                if (validfdate1 == false || validfdate2 == false)
                {
                    txtFDate1.BackColor = Color.Red;
                    txtFDate1.ForeColor = Color.White;
                    txtFDate2.BackColor = Color.Red;
                    txtFDate2.ForeColor = Color.White;
                    MessageBox.Show("تاریخ را بطور صحیح وارد کنید", "خطا", MessageBoxButtons.OK);
                    return;
                }
                else
                {
                    txtFDate1.BackColor = Color.White;
                    txtFDate1.ForeColor = Color.Black;
                    txtFDate2.BackColor = Color.White;
                    txtFDate2.ForeColor = Color.Black;
                }

                BL_frmInvoiceList A = new BL_frmInvoiceList();
                A.FD1 = txtFDate1.Text.ToString();
                A.FD2 = txtFDate2.Text.ToString();
                this.Datagridview1.DataSource = A.SelectByDate();
                UpdateDataGrid();
            }
            if (rbInvoiceNumber.Checked == true)
            {
                if (txtInvoiceNumber1.Text == "" || txtInvoiceNumber2.Text == "" || txtInvoiceNumber1.Text.Length != 6 || txtInvoiceNumber2.Text.Length != 6)
                {
                    MessageBox.Show("لطفا محدود شماره فاکتورها را به درستی وارد کنید", "خطا", MessageBoxButtons.OK);
                    return;
                }
                BL_frmInvoiceList B = new BL_frmInvoiceList();
                B.IN1 = txtInvoiceNumber1.Text.ToString();
                B.IN2 = txtInvoiceNumber2.Text.ToString();
                this.Datagridview1.DataSource = B.SelectByInvoiceNumber();
                UpdateDataGrid();
            }
        }
Example #4
0
        private void btnDeleteInvoice_Click(object sender, EventArgs e)
        {
            if (this.Datagridview1.Rows.Count != 0)
            {
                BL_frmInvoiceList M = new BL_frmInvoiceList();
                M.InvoiceNumber = this.Datagridview1[1, Datagridview1.CurrentRow.Index].Value.ToString();

                if (MessageBox.Show("آیا از حذف فاکتور اطمینان دارید؟", "هشدار", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    M.DeleteInvoice();
                    frmInvoiceList_Load(null, null);
                }
            }
            else
            {
                MessageBox.Show("هیچ رکوردی برای حذف وجود ندارد.", "پیام", MessageBoxButtons.OK);
            }
        }