Esempio n. 1
0
        private void busca_operacion()
        {
            Control_gestion mcontrolgestion = new ControlGestionBC().getcontrolgestionbysolicitud(Convert.ToInt32(id_solicitud));

            if (mcontrolgestion != null)
            {
                this.lbl_operacion.Visible = true;
                this.lbl_numero.Visible    = true;
                this.ib_mas.Enabled        = true;
                this.lbl_operacion.Text    = "Operación de Control y Gestion Numero:";
                this.lbl_numero.Text       = Convert.ToString(mcontrolgestion.Id_solicitud.Id_solicitud);
                this.txt_total.Text        = mcontrolgestion.Total_gestion.ToString();
                this.txt_ncuotas.Text      = mcontrolgestion.Numero_cuotas.ToString();
                this.txt_noperacion.Text   = mcontrolgestion.Numero_operacion.ToString();
                string fecha2 = string.Format("{0:dd/MM/yyyy}", mcontrolgestion.Fecha_gestion);
                if (fecha2 != "01/01/1900")
                {
                    this.txt_fecha_gestion.Text = fecha2;
                }
                else
                {
                    this.txt_fecha_gestion.Text = "";
                }
                this.dl_producto_Cliente.SelectedValue = mcontrolgestion.Id_producto_cliente.Id_producto_cliente.ToString();
                this.dl_sucursal_origen.SelectedValue  = mcontrolgestion.Id_sucursal.Id_sucursal.ToString();
                this.txt_observacion.Text        = mcontrolgestion.Observacion.ToString();
                this.dl_forma_pago.SelectedValue = mcontrolgestion.Id_forma_pago.Id_forma_pago.ToString();
                this.txt_patente.Text            = mcontrolgestion.Patente;
                this.txt_monto_final.Text        = mcontrolgestion.Monto_final.ToString();
                if (mcontrolgestion.Rut_vendedor != null)
                {
                    this.chk_vendedor.Checked  = true;
                    this.Datosvendedor.Visible = true;
                    this.Datosvendedor.Mostrar_Form(mcontrolgestion.Rut_vendedor.Rut);
                }
                //**adquiriente

                if (mcontrolgestion.Rut.Rut != 0)
                {
                    busca_persona(mcontrolgestion.Rut.Rut);
                    this.txt_rut_deudor.Text = mcontrolgestion.Rut.Rut.ToString();
                }
                mcontrolgestion = null;
                carga_link();
                this.ib_correo.Enabled    = true;
                this.ib_direccion.Enabled = true;
                this.ib_telefono.Enabled  = true;
            }
        }
Esempio n. 2
0
        private void add_operacion()
        {
            double      rut_deudor = 0;
            GridViewRow row;
            string      rutvend     = "0";
            Int32       monto_final = 0;
            DateTime    fecha       = Convert.ToDateTime("01/01/1900");

            if (this.Datosvendedor.Guardar_Form())
            {
                if (this.Datosvendedor.InfoPersona != null)
                {
                    rutvend = this.Datosvendedor.InfoPersona.Rut.ToString();
                }
            }

            if (this.txt_rut_deudor.Text == "")
            {
                rut_deudor = 0;
            }
            else
            {
                rut_deudor = Convert.ToDouble(this.txt_rut_deudor.Text);
                string persona = new PersonaBC().add_personaCG(Convert.ToDouble(this.txt_rut_deudor.Text),
                                                               this.txt_dv.Text,
                                                               1,
                                                               "",
                                                               this.txt_nombre_deudor.Text,
                                                               this.txt_paterno.Text,
                                                               this.txt_materno.Text,
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "0",
                                                               "0",
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "",
                                                               "0");
            }



            Int32 add = new OperacionBC().add_operacion(Convert.ToInt32(this.lbl_numero.Text), Convert.ToInt16(id_cliente), "SGI", (string)(Session["usrname"]), 0, "", Convert.ToInt32(this.dl_sucursal_origen.SelectedValue), 0);

            if (this.txt_monto_final.Text != "")
            {
                monto_final = Convert.ToInt32(this.txt_monto_final.Text);
            }
            if (this.txt_fecha_gestion.Text != "")
            {
                fecha = Convert.ToDateTime(this.txt_fecha_gestion.Text);
            }
            string addI_CTG = new ControlGestionBC().add_controlgestion(add,
                                                                        Convert.ToInt32(this.txt_rut_deudor.Text),
                                                                        Convert.ToInt32(this.dl_producto_Cliente.SelectedValue),
                                                                        Convert.ToInt32(FuncionGlobal.NumeroSinFormato(this.txt_total.Text)),
                                                                        fecha,
                                                                        Convert.ToInt32(this.txt_ncuotas.Text),
                                                                        this.txt_noperacion.Text, Convert.ToInt32(this.dl_sucursal_origen.SelectedValue.ToString()),
                                                                        this.txt_observacion.Text,
                                                                        Convert.ToInt32(this.dl_forma_pago.SelectedValue.ToString()),
                                                                        Convert.ToInt32(rutvend), this.txt_patente.Text, monto_final
                                                                        );



            string add_SGI = "";
            string del_SGI = "";

            if (add != 0)
            {
                del_SGI = new DatoContactoBC().del_DatoContacto(add);
                for (int i = 0; i < gr_dato.Rows.Count; i++)
                {
                    row = gr_dato.Rows[i];
                    TextBox txt_referencia = (TextBox)gr_dato.Rows[i].FindControl("txt_referencia");

                    add_SGI = new DatoContactoBC().add_DatoContacto(add,
                                                                    txt_referencia.Text
                                                                    );
                }

                if (add_SGI == "")
                {
                    string add_or = new EstadooperacionBC().add_estado_orden(Convert.ToInt32(add), 1, "SGI", "", (string)(Session["usrname"]));
                }
            }
            this.lbl_operacion.Visible = true;
            this.lbl_numero.Visible    = true;
            this.ib_mas.Enabled        = true;
            this.lbl_operacion.Text    = "Operación de Gestion y Control Numero:";
            this.lbl_numero.Text       = Convert.ToString(add);
            getreferencia(Convert.ToString(add));
            //carga_rpt(add);
        }