protected void btnGuardar_Click(object sender, EventArgs e)
        {
            Architects.Dominio.RetornaMensaje retornaMensaje = new Architects.Dominio.RetornaMensaje();
            try
            {
                string strD_FecPago = txtFechaPago.Text;
                int intN_IdTipoPago = Convert.ToInt32(ddlTipoPagoos.SelectedValue);
                int intN_IdCuota = lblN_IdCuota.Text == string.Empty ? 0 : Convert.ToInt32(lblN_IdCuota.Text);
                double decN_Importe = Convert.ToDouble(txtImportePago.Text);
                PagosServiceClient proxiCuota = new PagosServiceClient();
                if (Request.QueryString.Get("pm") != null)
                    retornaMensaje = proxiCuota.PagarCuota(intN_IdCuota,strD_FecPago,txtNumeroOperacion.Text, intN_IdTipoPago);

                if (retornaMensaje.Exito)
                {
                    lblMensaje.ForeColor = System.Drawing.Color.Blue;
                    lblN_IdCuota.Text = Request.QueryString.Get("pm") == null ? retornaMensaje.CodigoRetorno.ToString() : lblN_IdCuota.Text;
                    btnGuardar.Visible = false;
                }
                else
                    lblMensaje.ForeColor = System.Drawing.Color.Red;
                lblMensaje.Text = retornaMensaje.Mensage;
            }
            catch (Exception ex)
            {
                lblMensaje.Text = ex.Message;
            }
        }
 public void ListarCuotaTest()
 {
     PagosServiceClient proxy = new PagosServiceClient();
     try
     {
         string pPeriodo = "201401";
         IList<Cuota> lstCuotas = proxy.ListarCuota(pPeriodo).ToList();
         Assert.AreNotEqual(0, lstCuotas.Count);
     }
     catch (FaultException<RetornaMensajeT> exception)
     {
         Console.WriteLine("Error : {0}", exception.Detail.Mensage);
     }
 }
 //[TestMethod]
 public void BuscarCuotaTest()
 {
     PagosServiceClient proxy = new PagosServiceClient();
     try
     {
         int pIdCuota = 80;
         Cuota cuota = proxy.BuscarCuota(pIdCuota);
         Assert.AreEqual(pIdCuota, cuota.N_IdCuota);
     }
     catch (FaultException<RetornaMensajeT> exception)
     {
         Console.WriteLine("Error : {0}", exception.Detail.Mensage);
     }
 }
        //[TestMethod]
        public void EliminarCuotaTest()
        {
            PagosServiceClient proxy = new PagosServiceClient();
            RetornaMensaje retornaMensaje = null;
            try
            {
                int pIdCuota = 6;
                retornaMensaje = proxy.EliminarCuota(pIdCuota);
                Assert.AreNotEqual(-1, retornaMensaje.CodigoRetorno);

                Cuota cuotaEliminada = new Cuota();
                cuotaEliminada = proxy.BuscarCuota(pIdCuota);
                Assert.AreNotEqual(pIdCuota, cuotaEliminada.N_IdCuota);
            }
            catch (FaultException<RetornaMensajeT> exception)
            {
                Console.WriteLine("Error : {0}", exception.Detail.Mensage);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                if (!Page.IsPostBack)
                {
                    Page.Title = "Pago de Cuota";
                    PagosServiceClient proxiPago = new PagosServiceClient();
                    IList<TipoPago> lstTipoPago =  proxiPago.ListarTipoPago();
                    ddlTipoPagoos.DataSource = lstTipoPago;
                    ddlTipoPagoos.DataTextField = "C_Descripcion";
                    ddlTipoPagoos.DataValueField = "N_IdTipoPago";
                    ddlTipoPagoos.DataBind();

                    String querystringID = string.Empty;

                    if (Request.QueryString.Get("pm") != null)
                    {
                        querystringID = Request.QueryString.Get("pm");
                        PagosServiceClient proxiCuota = new PagosServiceClient();
                        Cuota cuota = proxiCuota.BuscarCuota(Convert.ToInt32(querystringID));
                        if (cuota != null)
                        {
                            txtResidenteVivienda.Text = "N° Dpto : " + cuota.objVivienda.C_NumDpto
                                                        + "/n - N° Edificio : " + cuota.objVivienda.C_NumEdificio
                                                        + "/n - [ Residente : " + cuota.objVivienda.objResidente.C_Apellidos + " ] ";
                            txtPeriodo.Text = cuota.C_Periodo;
                            txtFechaVcto.Text=cuota.D_FecVncto.Value.ToShortDateString().ToString();
                            lblN_IdCuota.Text = cuota.N_IdCuota.ToString();
                            txtImportePago.Text= cuota.N_Importe.Value.ToString("N2");
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text=ex.Message;
            }
        }
        public void ActualizarCuotaTest()
        {
            PagosServiceClient proxy = new PagosServiceClient();
            RetornaMensaje retornaMensaje = null;
            Cuota cuotaRegistrada = new Cuota();

            int pIdCuota = 24;
            string pPeriodo = "201401";
            int pIdVivienda = 2;
            double pImporte = 150;
            string pFecVncto = DateTime.Now.ToShortDateString();
            try
            {
                retornaMensaje = proxy.ActualizarCuota(pIdCuota, pPeriodo, pIdVivienda, pImporte, pFecVncto);

                Assert.AreNotEqual(1, retornaMensaje.CodigoRetorno);
            }
            catch (FaultException<RetornaMensajeT> exception)
            {
                Console.WriteLine("Error : {0}", exception.Detail.Mensage);
            }
        }
        protected void gvCuotas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "Editar":
                    Response.Redirect("frmCuotaCrear.aspx?pm=" + e.CommandArgument);
                    break;

                case "Eliminar":
                    try
                    {
                        PagosService.PagosServiceClient proxiPagos = new PagosServiceClient();
                        Architects.Dominio.RetornaMensaje retorna = proxiPagos.EliminarCuota(Convert.ToInt32(e.CommandArgument));
                        if (retorna.Exito)
                            lblMensajes.Text = retorna.Mensage;
                        CargarGrilla();
                    }
                    catch (Exception ex)
                    {
                        lblMensajes.Text = ex.Message;
                    }
                    break;
            }
        }
        public void TipoPagoListarTest()
        {
            PagosServiceClient proxy = new PagosServiceClient();
            IList<TipoPago> tipoPagoListar;
            tipoPagoListar = proxy.ListarTipoPago();

            Assert.AreNotEqual(tipoPagoListar.Count, 0);
        }
        public void RegistrarCuotaTest()
        {
            PagosServiceClient proxy = new PagosServiceClient();
            RetornaMensaje retornaMensaje = null;
            Cuota cuotaRegistrada = new Cuota();

            string C_Periodo = "201402";
            int N_IdVivienda = 3;
            decimal N_Importe = 120;
            string D_FecVncto = DateTime.Now.ToShortDateString();
            try
            {
                retornaMensaje = proxy.RegistrarCuota(C_Periodo, N_IdVivienda, Convert.ToDouble(N_Importe), D_FecVncto);

                Assert.AreNotEqual(0, retornaMensaje.CodigoRetorno);
            }
            catch (FaultException<RetornaMensajeT> exception)
            {
                Console.WriteLine("Error : {0}", exception.Detail.Mensage);
            }
        }