Ejemplo n.º 1
0
        public void AddCashRelease(CashReleaseUnit oUnit)
        {
            SqlCommand oCommand = new SqlCommand();

            oCommand.Connection = this.Connection;
            oCommand.CommandText = "INSERT INTO LOAN3 (DocNum, RefNo, TypeOfPayment, SourceOfFund, ChequeNo, Amount, DateCreated, CreatedBy, DateModified, ModifiedBy) VALUES (@DocNum, @RefNo, @TypeOfPayment, @SourceOfFund, @ChequeNo, @Amount, @DateCreated, @CreatedBy, @DateModified, @ModifiedBy)";

            oCommand.Parameters.Add(new SqlParameter("@DocNum", oUnit.DocNum));
            oCommand.Parameters.Add(new SqlParameter("@RefNo", oUnit.ReleaseNo));
            oCommand.Parameters.Add(new SqlParameter("@TypeOfPayment", oUnit.TypeOfPayment));
            oCommand.Parameters.Add(new SqlParameter("@SourceOfFund", oUnit.SourceOfFund));
            oCommand.Parameters.Add(new SqlParameter("@ChequeNo", oUnit.ChequeNo));
            oCommand.Parameters.Add(new SqlParameter("@Amount", oUnit.Amount));
            oCommand.Parameters.Add(new SqlParameter("@DateCreated", oUnit.DateCreated));
            oCommand.Parameters.Add(new SqlParameter("@CreatedBy", oUnit.CreatedBy));
            oCommand.Parameters.Add(new SqlParameter("@DateModified", oUnit.DateModified));
            oCommand.Parameters.Add(new SqlParameter("@ModifiedBy", oUnit.ModifiedBy));

            oCommand.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
        public void UpdateCashRelease(CashReleaseUnit oUnit)
        {
            SqlCommand oCommand = new SqlCommand();

            oCommand.Connection = this.Connection;
            oCommand.CommandText = "UPDATE LOAN3 SET DocNum=@DocNum, TypeOfPayment=@TypeOfPayment, SourceOfFund=@SourceOfFund, ChequeNo=@ChequeNo, Amount=@Amount, DateModified=@DateModified, ModifiedBy=@ModifiedBy WHERE ReleaseNo=@ReleaseNo";

            oCommand.Parameters.Add(new SqlParameter("@DocNum", oUnit.DocNum));
            oCommand.Parameters.Add(new SqlParameter("@RefNo", oUnit.ReleaseNo));
            oCommand.Parameters.Add(new SqlParameter("@TypeOfPayment", oUnit.TypeOfPayment));
            oCommand.Parameters.Add(new SqlParameter("@SourceOfFund", oUnit.SourceOfFund));
            oCommand.Parameters.Add(new SqlParameter("@ChequeNo", oUnit.ChequeNo));
            oCommand.Parameters.Add(new SqlParameter("@Amount", oUnit.Amount));
            oCommand.Parameters.Add(new SqlParameter("@DateModified", oUnit.DateModified));
            oCommand.Parameters.Add(new SqlParameter("@ModifiedBy", oUnit.ModifiedBy));

            oCommand.ExecuteNonQuery();
        }
Ejemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (cboTypeOfPayment.SelectedIndex == -1)
            {
                MessageBox.Show("Please select type of Payment!!!", "Fund", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (cboSourceOfFund.EditValue == null)
            {
                MessageBox.Show("Please select fund!!!", "Fund", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (btnAdd.Text == "Add")
            {
                CashReleaseManager oManager = new CashReleaseManager();
                CashReleaseUnit oUnit = new CashReleaseUnit();

                oManager.ConnectionString = this.ConnectionString;
                oManager.Open();

                oUnit.ReleaseNo = txtReleaseNo.Text;
                oUnit.DocNum = txtLoanNo.Text;
                oUnit.ChequeNo = txtCheckNo.Text;
                oUnit.TypeOfPayment = cboTypeOfPayment.Text;
                oUnit.SourceOfFund = cboSourceOfFund.EditValue == null ? "" : cboSourceOfFund.EditValue.ToString();
                oUnit.Amount = Convert.ToDouble(txtAmount.Text);

                oUnit.CreatedBy = this.ActiveUserID;
                oUnit.DateCreated = (DateTime)dtCreated.EditValue;
                oUnit.ModifiedBy = this.ActiveUserID;
                oUnit.DateModified = (DateTime)dtModified.EditValue;

                oManager.AddCashRelease(oUnit);

                oManager.Close();

                this.Close();
            }
            else if (btnAdd.Text == "Update")
            {
                CashReleaseManager oManager = new CashReleaseManager();
                CashReleaseUnit oUnit = new CashReleaseUnit();

                oManager.ConnectionString = this.ConnectionString;
                oManager.Open();

                oUnit.ReleaseNo = txtReleaseNo.Text;
                oUnit.DocNum = txtLoanNo.Text;
                oUnit.ChequeNo = txtCheckNo.Text;
                oUnit.TypeOfPayment = cboTypeOfPayment.Text;
                oUnit.SourceOfFund = cboSourceOfFund.EditValue.ToString();
                oUnit.Amount = Convert.ToDouble(txtAmount.Text);

                oUnit.CreatedBy = this.ActiveUserID;
                oUnit.DateCreated = (DateTime)dtCreated.EditValue;
                oUnit.ModifiedBy = this.ActiveUserID;
                oUnit.DateModified = (DateTime)dtModified.EditValue;

                oManager.UpdateCashRelease(oUnit);

                oManager.Close();

            }
        }