示例#1
0
        public void Insert()
        {
            if (Period.Value.Year > DateTime.Now.Year || (Period.Value.Month > DateTime.Now.Month && Period.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }
            if (String.IsNullOrEmpty(Amount.Text) || (Convert.ToInt32(Amount.Text)) == 0)
            {
                MessageBox.Show("Enter  Value");
                return;
            }
            if (String.IsNullOrEmpty(ReNo.Text))
            {
                MessageBox.Show("Enter Receipt Number");
                return;
            }

            if (dateTimePicker1.Value > DateTime.Now)
            {
                MessageBox.Show("Do not enter future dates");
                return;
            }

            ChequeVO ch = new ChequeVO(Convert.ToInt32(Uni.SelectedValue.ToString()), ReNo.Text, Convert.ToDouble(Amount.Text), Convert.ToInt32(Period.Value.Year.ToString()), Convert.ToInt32(Period.Value.Month.ToString()), Convert.ToInt32(Status.SelectedValue.ToString()), Period.Value);

            if (cc.InsertCheque(ch))
            {
                MessageBox.Show("Insert Successful");
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
示例#2
0
        public bool InsertCheque(ChequeVO p)
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();
                dt.Columns.Add();



                dt.Rows.Add(new Object[] { p.CHEQREC_INSTITUTE, p.CHEQREC_REFNO, p.CHEQREC_AMOUNT, p.CHEQREC_YEAR, p.CHEQREC_PERIODNO, p.CHEQREC_STATUS, p.CHEQREC_DATE });

                return(cd.InsertCheque(dt));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }