Example #1
0
        protected void RegistrarButton_Click(object sender, EventArgs e)
        {
            CxC cxc = new CxC();

            cxc.IdTipoDocumento = Convert.ToInt32(TipoDropDownList.SelectedValue);
            cxc.IdMiembro = Convert.ToInt32(MiembroDropDownList.SelectedValue);
            cxc.Fecha = Convert.ToDateTime(FechaTextBox.Text);
            cxc.IdClub = Convert.ToInt32(ClubDropDownList.SelectedValue);
            cxc.Monto = Convert.ToDouble(MontoTextBox.Text);

            if (TipoMultaDropDownList.Visible == true)
            {
                cxc.IdTipoMulta = Convert.ToInt32(TipoMultaDropDownList.SelectedValue);
                cxc.Insertar();
            }
            else
            {
                cxc.InsertarNull();
            }
        }
        protected void CobrarButton_Click(object sender, EventArgs e)
        {
            Cobros cob = new Cobros();
            CxC cxc = new CxC();

            cob.Total = Convert.ToDouble(TotalTextBox.Text);
            cob.Fecha = Convert.ToDateTime(FechaTextBox.Text);

            if(Session["IdCobro"] == null)
            {
                if(cob.Insertar())
                {
                    if (cob.BuscarIdCob())
                    {
                        IdCobroTextBox.Text = cob.IdCobro.ToString();
                    }

                    DataTable data = Session["data"] as DataTable;

                    foreach (DataRow row in data.Rows)
                    {
                        cob.IdCxC = int.Parse(row["IdCxC"].ToString());
                        cob.Valor = Convert.ToDouble(row["Valor"].ToString());

                        cxc.ActualizarEstado(int.Parse(row["IdCxC"].ToString()));

                        cob.InsertarDet();
                    }
                }
            }
        }