Ejemplo n.º 1
0
        protected void btnFacturar_Click(object sender, EventArgs e)
        {
            float Total;

            if (TxtTotal.Value == string.Empty)
            {
                Response.Write("<script>window.alert('Primero debe totalizar para poder facturar');</script>");
            }



            else
            {
                Total                      = Convert.ToSingle(TxtTotal.Value);
                Obj_Ingreso_DAL            = new Cls_Ingreso_DAL();
                Obj_Ingreso_DAL.sIdPersona = txtCedula.Value;
                Obj_Ingreso_DAL.fCosto     = Convert.ToSingle(TxtTotal.Value.Trim());
                Obj_Ingreso_BLL.Insertar_Ingreso_Factura(ref Obj_Ingreso_DAL);
                foreach (GridViewRow row in GridViewInvitados.Rows)
                {
                    Obj_Ingreso_DAL            = new Cls_Ingreso_DAL();
                    Obj_Ingreso_DAL.sIdPersona = txtCedula.Value;
                    Obj_Ingreso_DAL.fCosto     = Convert.ToSingle(row.Cells[3].Text);
                    Obj_Ingreso_DAL.fTotal     = Convert.ToSingle(row.Cells[3].Text);
                    Obj_Ingreso_BLL.Insertar_Detalle_Factura(ref Obj_Ingreso_DAL);
                }

                foreach (GridViewRow row in ServiciosGridView.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox);
                        if (chkRow.Checked)
                        {
                            Obj_Ingreso_DAL                 = new Cls_Ingreso_DAL();
                            Obj_Ingreso_DAL.sIdPersona      = txtCedula.Value;
                            Obj_Ingreso_DAL.fCosto          = Convert.ToSingle(row.Cells[2].Text);
                            Obj_Ingreso_DAL.bIdTipoServicio = Convert.ToByte(row.Cells[0].Text);
                            Obj_Ingreso_DAL.fTotal          = Convert.ToSingle(row.Cells[2].Text);
                            Obj_Ingreso_BLL.Insertar_Detalle_Factura(ref Obj_Ingreso_DAL);
                        }
                    }
                }


                if (Total == 0)
                {
                    Response.Write("<script>window.alert('Ingreso realizado de forma correcto');</script>");
                }
                else
                {
                    Response.Write("<script>window.alert('Factura ingresada de forma correcta');</script>");
                }
            }
        }
        public void Insertar_Detalle_Factura(string IdPersona, float Costo, byte IdTipoServicio, float Total, ref string sMsj_error)
        {
            Cls_Ingresos_BLL Obj_Ingresos_BLL = new Cls_Ingresos_BLL();

            Obj_Ingresos_BLL.Insertar_Detalle_Factura(IdPersona, Costo, IdTipoServicio, Total, ref sMsj_error);
        }