private void btnPaid_Click(object sender, EventArgs e)
        {
            MeterBill mb = new MeterBill();

            BindMeterBillEntity(mb);
            if (meterBillCalculateservices.UpdateMeterBill(mb))
            {
                if (rdoadvancemoney.Checked)
                {
                    AdvanceMoneyCustomer amc = new AdvanceMoneyCustomer();
                    BindAdvanceMoneyCustomerEntity(amc);
                    if (advanceMoneyCustomerServices.SaveAdvanceMoney(amc))
                    {
                    }
                }    //end of Advance Money save
                if (Convert.ToDecimal(txtpunishment.Text) > 0)
                {
                    PunishmentCustomer pc = new PunishmentCustomer();
                    BindPunishmentCustomerEntity(pc);
                    if (punishmentCutomerServices.Save(pc))
                    {
                    }    //end of Punishment Customer function save
                }
                MessageBox.Show("Payment is Complete Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }    //end of meter bill payment paid
        }
 public bool Save(PunishmentCustomer punishmentcustomer)
 {
     try {
         mBMSEntities.PunishmentCustomers.Add(punishmentcustomer);
         mBMSEntities.SaveChanges();
     }catch (Exception ex) {
         return(false);
     }
     return(true);
 }
 private void BindPunishmentCustomerEntity(PunishmentCustomer pc)
 {
     pc.PunishmentCustomerID = Guid.NewGuid().ToString();
     pc.Active           = true;
     pc.CreatedDate      = DateTime.Now;
     pc.CreatedUserID    = UserID;
     pc.MeterBillID      = vm.MeterBillID;
     pc.PunishmentRuleID = punishmentruleID;
     pc.PunishmentAmount = Convert.ToDecimal(txtpunishment.Text);
     pc.ForMonth         = vm.InvoiceDate;
 }