示例#1
0
        public bool InsertPayment(PaymentVO 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.Columns.Add();
                dt.Columns.Add();


                dt.Rows.Add(new Object[] { p.OwnerID1, p.PaymentValue1, p.PaymentYear1, p.PaymentMonth1, p.PaymentBank1, p.AccountNo1, p.PaymentSubDate1, p.VoucherNo1, p.Type1 });

                return(pd.InsertPayment(dt));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
        public void LumpSumProcessMethod()
        {
            try
            {
                DataTable dt = pb.LumpsumView(LumpSumGrid);


                int progress = 0;
                int length   = dt.Rows.Count;

                //pb.CalVoucherNo();



                MessageBox.Show("Start Process");
                //PaymentVO pv = new PaymentVO(dt.Rows[n][0].ToString(),Convert.ToDouble(dt.Rows[n][2].ToString()),0,Convert.ToInt32(DateTime.Now.Month), Convert.ToInt32(DateTime.Now.Year.ToString()),Convert.ToInt32(dt.Rows[n][3].ToString()),dt.Rows[n][4].ToString(),DateTime.Now,Convert.ToInt32(VoucherNo.ToString()),3);
                MySqlConnection conn = new MySqlConnection(@DBStr.connectionString);
                // MessageBox.Show("Conneted");
                int VoucherNo;
                VoucherNo = pb.CalVoucherNo();
                for (int n = 0; n < length; n++)
                {
                    PaymentVO pp = new PaymentVO(dt.Rows[n][0].ToString(), Convert.ToDouble(dt.Rows[n][2].ToString()), false, Convert.ToInt32(DateTime.Now.Month), Convert.ToInt32(DateTime.Now.Year.ToString()), Convert.ToInt32(dt.Rows[n][3].ToString()), dt.Rows[n][4].ToString(), DateTime.Now, VoucherNo, 3);


                    if (pb.InsertPayment(pp) && pb.InvalidateMember(dt.Rows[n][0].ToString()))
                    {
                        progress = Convert.ToInt32((n + 1) * 100 / length);
                        progressBar1.Increment(progress);
                    }
                }

                if (progress == 100)
                {
                    MessageBox.Show("Sucessfull");
                }
                progressBar1.Value = 0;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#3
0
        private void Insert_Click(object sender, EventArgs e)
        {
            if (tPeriod.Value.Year > DateTime.Now.Year || (tPeriod.Value.Month > DateTime.Now.Month && tPeriod.Value.Year == DateTime.Now.Year))
            {
                MessageBox.Show("Do not Enter Future Periods");
                return;
            }
            int voucherNo = pb.CalVoucherNo();

            tReceiptNo.Text = voucherNo.ToString();
            PaymentVO pv = new PaymentVO(tOwnerID.SelectedValue.ToString(), Convert.ToDouble(tAmount.Text), false, Convert.ToInt32(tPeriod.Value.Month.ToString()), Convert.ToInt32(tPeriod.Value.Year.ToString()), Convert.ToInt32(tBank.SelectedValue.ToString()), AccountNo.Text.ToString(), tSubDate.Value, voucherNo, Convert.ToInt32(Type.SelectedValue.ToString()));

            if (pb.InsertPayment(pv))
            {
                MessageBox.Show("Insert Successful");
                //tContributionID.Clear();
                tAmount.Clear();
                tReceiptNo.Text = pb.CalVoucherNo().ToString();
            }
            else
            {
                MessageBox.Show("Record Failed");
            }
        }
示例#4
0
        private void PensionPro_Click(object sender, EventArgs e)
        {
            //Validations check the date
            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 (Period.Value.Year != DateTime.Today.Year && Period.Value.Month != DateTime.Today.Month)
            {
                MessageBox.Show("Only the current period is allowed");
                Period.Value = DateTime.Today;
                return;
            }


            try
            {
                DataTable dt = new DataTable();



                dt = pb.PenData(Period.Value, PensionerView);
                int progress = 0;
                int length   = dt.Rows.Count;



                VoucherNo = pb.CalVoucherNo();

                MessageBox.Show("Start Process");
                MySqlConnection conn = new MySqlConnection(@DBStr.connectionString);
                // MessageBox.Show("Conneted");

                for (int n = 0; n < length; n++)
                {
                    //MySqlCommand sql;

                    //    MessageBox.Show(dt.Rows[n][7].ToString());
                    PaymentVO pv = new PaymentVO(dt.Rows[n][0].ToString(), Convert.ToDouble(dt.Rows[n][7].ToString()), false, Convert.ToInt32(Period.Value.Month.ToString()), Convert.ToInt32(Period.Value.Year.ToString()), Convert.ToInt32(dt.Rows[n][4].ToString()), dt.Rows[n][5].ToString(), DateTime.Now, VoucherNo, 2);
                    if (pb.InsertPayment(pv))
                    {
                        /*sql = new MySqlCommand("insert into PensionPayment(OwnerID,PaymentValue,PaymentMonth,PaymentYear,PaymentBank,AccountNo,PaymentSubDate,VoucherNo,Type,Approval) values('" + dt.Rows[n][0].ToString() + "','" + dt.Rows[n][7].ToString() + "','" + Period.Value.Month.ToString() + "','" + Period.Value.Year.ToString() + "','" + dt.Rows[n][4].ToString() + "','" + dt.Rows[n][5].ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + VoucherNo.ToString() + "','2',0)", conn);
                         * //insert to the database
                         *
                         *
                         * MySqlDataReader reader;
                         * reader = sql.ExecuteReader();
                         * // MessageBox.Show("Sql" + n.ToString());
                         * while (reader.Read())
                         * {
                         * }
                         */
                        progress = Convert.ToInt32((n + 1) * 100 / length);
                        progressBar1.Increment(progress);
                    }
                    //MessageBox.Show(n.ToString());
                }
                if (progress == 100)
                {
                    MessageBox.Show("Sucessfull");
                }
                progressBar1.Value = 0;
            }

            catch (Exception ex)
            {
                MessageBox.Show("Duplicate Entries");
            }
        }