示例#1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            payments pa = new payments();

            pa.id           = txtid.Text;
            pa.name         = txtname.Text.Trim();
            pa.date         = txtdate.Text;
            pa.paidformonth = txtpaidformonth.Text;
            pa.mablagh      = long.Parse(txtmablagh.Text);
            pa.sharh        = txtsharh.Text;
            pa.Update();

            MessageBox.Show("قبض با موفقیت ویرایش گردید");
            this.Close();
        }
示例#2
0
        private void TextChanged_Action(object sender, EventArgs e)
        {
            if (txtname.Text == "" && !txtmos_date.MaskCompleted && !txttodate.MaskCompleted && !checkBox1.Checked)
            {
                btnfilter.Enabled = false;

                payments  pm = new payments();
                DataTable dt = new DataTable();
                dt = pm.Select();
                grdDataViewer.DataSource = dt;
            }
            else
            {
                btnfilter.Enabled = true;
            }
        }
示例#3
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            frmGhabzPardakht fgd = new frmGhabzPardakht();

            //fgd.cur_date = this.cur_date;
            fgd.ShowDialog();

            if (btnfilter.Enabled == true)
            {
                btnfilter.PerformClick();
            }
            else
            {
                payments  pm = new payments();
                DataTable dt = new DataTable();
                dt = pm.Select();
                grdDataViewer.DataSource = dt;
            }
        }
示例#4
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            payments gh = new payments();

            gh.id           = txtid.Text;
            gh.name         = txtname.Text.Trim();
            gh.date         = txtdate.Text;
            gh.paidformonth = txtpaidformonth.Text;
            gh.mablagh      = long.Parse(txtmablagh.Text);
            gh.sharh        = txtsharh.Text;
            gh.Add();

            MessageBox.Show("قبض با موفقیت ثبت گردید");


            frmPayments_PrintViewer pv = new frmPayments_PrintViewer();

            pv.P = gh.Search("select * from payments where (id=" + txtid.Text.Trim() + ")");
            pv.Show();

            this.Close();
        }
示例#5
0
        public void idsearch_Click()
        {
            teachers  te       = new teachers();
            DataTable dttename = new DataTable();

            dttename              = te.Search("SELECT name FROM teachers order by name");
            txtname.DataSource    = dttename;
            txtname.DisplayMember = "name";
            txtname.ValueMember   = "name";


            payments pa = new payments();

            pa.id = txtid.Text;
            DataTable dt = pa.Selectforedit();

            if (dt.Rows.Count > 0)
            {
                btnUpdate.Enabled = true;
                txtid.Enabled     = false;
                groupBox1.Enabled = true;
                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in groupBox1.Controls)
                {
                    if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CurrencyTextBox))
                    {
                        c.Text = dt.Rows[0][c.Name.Substring(3)].ToString();
                    }
                }
                // End of Clearing & Adding of Controls Binding

                txtdate.Focus();
            }
            else
            {
                MessageBox.Show("شماره قبض در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#6
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            try
            {
                Boolean check = false;

                string SQL = "select * from payments where ";
                check = false;


                if (txtname.Text != "")
                {
                    SQL   = SQL + "name like N'%" + txtname.Text.Trim() + "%'AND ";
                    check = true;
                }

                if (txtmos_date.MaskCompleted)
                {
                    checkBox1.Checked = false;
                    SQL   = SQL + "date>=N'" + txtmos_date.Text.Trim() + "'AND ";
                    check = true;
                }

                if (txttodate.MaskCompleted)
                {
                    checkBox1.Checked = false;
                    SQL   = SQL + "date<=N'" + txttodate.Text.Trim() + "'AND ";
                    check = true;
                }

                if (txtlastdatefrom.MaskCompleted)
                {
                    checkBox1.Checked = false;
                    SQL   = SQL + "paidformonth>=N'" + txtlastdatefrom.Text.Trim() + "'AND ";
                    check = true;
                }

                if (txtlastdateto.MaskCompleted)
                {
                    checkBox1.Checked = false;
                    SQL   = SQL + "paidformonth<=N'" + txtlastdateto.Text.Trim() + "'AND ";
                    check = true;
                }


                if (checkBox1.Checked)
                {
                    SQL   = SQL + "date=N'" + cur_date.Trim() + "'AND ";
                    check = true;
                }

                if (check == true)
                {
                    SQL = SQL.Remove(SQL.Length - 4);
                }

                payments  rm = new payments();
                DataTable dt = new DataTable();
                dt = rm.Search(SQL);
                grdDataViewer.DataSource = dt;
            }
            catch (Exception)
            {
                MessageBox.Show("لطفا اطلاعات را به صورت درست وارد نمایید!!!");
                txtname.Text = "";
            }
        }