protected void InsertButton_Click(object sender, EventArgs e)
        {
            using (FinanceManagerDataContext db = new FinanceManagerDataContext())
            {
                //set current receipt number
                Parameter prm = db.Parameters.FirstOrDefault();

                //increase receipt number by one
                prm.ReceiptNumber++;
                Contribution _contribution = new Contribution()
                {
                    InvestmentId = Convert.ToInt32(Request.QueryString["InvId"]),
                    ContributionAmount = Convert.ToDecimal(ContributionAmountTextBox.Text.Trim()),
                    ContributionAmountInWords = Utils.ConvertMoneyToText(ContributionAmountTextBox.Text.Trim()),
                    ContributionBy = ContributionByTextBox.Text,
                    Description = "SUSU Contribution",
                    ReceiptNumber = prm.ReceiptNumber.Value.ToString().PadLeft(6, '0'),
                    RecievedBy = Session["CurrentUser_session"].ToString(),
                    PaymentMethodId = PaymentMethodWebUserControl1.PaymentTypeID,
                    ChequeNumber = PaymentMethodWebUserControl1.ChequeNumber,
                     CreatedDate = DateWebUserControl1.DtSelectedDate
                };

                db.Contributions.InsertOnSubmit(_contribution);
                db.SubmitChanges();

                //audit
                Utils.logAction("Insert", _contribution);

                Response.Redirect("SUSUContributionReceipt_Group.aspx?cid=" + _contribution.ContributionId.ToString() + "&gid=" + _contribution.Investment.GroupId);
            }
        }
        protected void InsertButton_Click(object sender, EventArgs e)
        {
            //if (DropDownList1.SelectedIndex == 1 && chequeNumberTextBox.Text.Trim().Length == 0)
            //{
            //    lblChequeError.Visible = true;
            //    return;
            //}
            //else
            //{
            //    lblChequeError.Visible = false;
            //}

            using (FinanceManagerDataContext db = new FinanceManagerDataContext())
            {
                //set current receipt number
                Parameter prm = db.Parameters.FirstOrDefault();

                //increase receipt number by one
                prm.ReceiptNumber++;
                Contribution _contribution = new Contribution()
                {
                    InvestmentId = Convert.ToInt32(Request.QueryString["InvId"]),
                    ContributionAmount = Convert.ToDecimal(ContributionAmountTextBox.Text.Trim()),
                    ContributionAmountInWords = Utils.ConvertMoneyToText(ContributionAmountTextBox.Text.Trim()),
                    ContributionBy = ContributionByTextBox.Text,
                    Description = "Investment deposit",
                    ReceiptNumber = prm.ReceiptNumber.Value.ToString().PadLeft(6, '0'),
                    RecievedBy = Session["CurrentUser_session"].ToString(), IsDeleted = false,
                    CreatedDate = DateWebUserControl1.DtSelectedDate,
                    CreatedBy = HttpContext.Current.User.Identity.Name,
                   PaymentMethodId = PaymentMethodWebUserControl1.PaymentTypeID,
                   ChequeNumber = PaymentMethodWebUserControl1.ChequeNumber
                };

                //if (DropDownList1.SelectedIndex == 0)
                //{
                //    _contribution.ChequeNumber = chequeNumberTextBox.Text;
                //}

                db.Contributions.InsertOnSubmit(_contribution);
                db.SubmitChanges();

                //audit
                Utils.logAction("Insert", _contribution);

                Response.Redirect("ContributionReceipt_Group.aspx?cid=" + _contribution.ContributionId.ToString() + "&gid=" + _contribution.Investment.GroupId);
            }
        }
        protected void InsertButton_Click(object sender, EventArgs e)
        {
            Utils.IsAuthorized("Deposit", "Create");

            using (FinanceManagerDataContext db = new FinanceManagerDataContext())
            {
                //set current receipt number
                Parameter prm = db.Parameters.FirstOrDefault();

                //increase receipt number by one
                prm.ReceiptNumber++;
                Contribution _contribution = new Contribution()
                {
                    InvestmentId = Convert.ToInt32(Request.QueryString["InvId"]),
                    ContributionAmount = Convert.ToDecimal(ContributionAmountTextBox.Text.Trim()),
                    ContributionAmountInWords = Utils.ConvertMoneyToText(ContributionAmountTextBox.Text.Trim()),
                    ContributionBy = ContributionByTextBox.Text,
                    Description = "Investment deposit",
                    ReceiptNumber = prm.ReceiptNumber.Value.ToString().PadLeft(6, '0'),
                    RecievedBy = Session["CurrentUser_session"].ToString(),
                    PaymentMethodId = PaymentMethodWebUserControl1.PaymentTypeID,
                    ChequeNumber = PaymentMethodWebUserControl1.ChequeNumber,
                    CreatedDate = DateWebUserControl1.DtSelectedDate,
                    IsDeleted = false,
                    MobileBankerID = Utils.GetMobileBanker(Convert.ToInt32( Request.QueryString["mid"])),
                    CreatedBy = HttpContext.Current.User.Identity.Name
                };

                db.Contributions.InsertOnSubmit(_contribution);
                db.SubmitChanges();

                //audit
                Utils.logAction("Insert", _contribution);

                Response.Redirect("ContributionReceipt.aspx?cid=" + _contribution.ContributionId.ToString() + "&mid=" + _contribution.Investment.MemberID);
            }
        }
 partial void DeleteContribution(Contribution instance);
 partial void UpdateContribution(Contribution instance);
 partial void InsertContribution(Contribution instance);
		private void detach_Contributions(Contribution entity)
		{
			this.SendPropertyChanging();
			entity.Investment = null;
		}