コード例 #1
0
        public List <CotizacionBE> ObtenerCotizacion(string numeroCotizacion, DateTime fechaEmision, string estado, string nombrePersonal, string dni)
        {
            List <CotizacionBE> resultado = new List <CotizacionBE>();
            Database            objDB     = Util.CrearBaseDatos();

            using (DbCommand objCMD = objDB.GetStoredProcCommand("PA_LISTAR_COTIZACIONES"))
            {
                try
                {
                    objDB.AddInParameter(objCMD, "@NumeroCotizacion", DbType.String, numeroCotizacion);
                    objDB.AddInParameter(objCMD, "@FechaEmision", DbType.DateTime, fechaEmision);
                    objDB.AddInParameter(objCMD, "@Estado", DbType.String, estado);
                    objDB.AddInParameter(objCMD, "@NombrePersonal", DbType.String, nombrePersonal);
                    objDB.AddInParameter(objCMD, "@DNI", DbType.String, dni);
                    using (IDataReader oDataReader = objDB.ExecuteReader(objCMD))
                    {
                        while (oDataReader.Read())
                        {
                            CotizacionBE cotizacion = new CotizacionBE();
                            cotizacion.NumeroCotizacion  = (string)oDataReader["NumeroCotizacion"];
                            cotizacion.FechaEmision      = (DateTime)oDataReader["FechaEmision"];
                            cotizacion.FechaOfertaValida = (DateTime)oDataReader["FechaOfertaValida"];
                            cotizacion.Estado            = (string)oDataReader["Estado"];
                            cotizacion.Observacion       = (string)oDataReader["Observacion"];
                            cotizacion.ValorVenta        = (double)oDataReader["ValorVenta"];
                            cotizacion.IGV              = (double)oDataReader["IGV"];
                            cotizacion.PrecioTotal      = (double)oDataReader["PrecioTotal"];
                            cotizacion.NombrePersonal   = (string)oDataReader["NombrePersonal"];
                            cotizacion.ApellidoPersonal = (string)oDataReader["ApellidoPersonal"];
                            cotizacion.DNI              = (string)oDataReader["DNI"];

                            resultado.Add(cotizacion);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }


            return(resultado);
        }
コード例 #2
0
ファイル: COtizacionADO.cs プロジェクト: dominique120/SIMSE
        public int CotizacionConDetallesNew(CotizacionBE cotBE)
        {
            try {
                con.ConnectionString = conection.GetCon();

                cmd.Connection  = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "DOCUMENTO.CotizacionNew";
                cmd.Parameters.Clear();

                cmd.Parameters.Add(new SqlParameter("@id_proyecto", cotBE.Id_proyecto));
                cmd.Parameters.Add(new SqlParameter("@id_encargado", cotBE.Id_encargado));
                cmd.Parameters.Add(new SqlParameter("@id_aprobado_por", cotBE.Id_aprobado_por));
                cmd.Parameters.Add(new SqlParameter("@enviar_a", cotBE.Enviar_a));
                cmd.Parameters.Add(new SqlParameter("@fecha_aprobacion", cotBE.Fecha_aprobacion));

                cmd.Parameters.Add(new SqlParameter("@fecha_creacion", cotBE.Fecha_creacion));
                cmd.Parameters.Add(new SqlParameter("@fecha_envio", cotBE.Fecha_envio));

                cmd.Parameters.Add(new SqlParameter("@notas", cotBE.Notas));
                cmd.Parameters.Add(new SqlParameter("@path_archivo", cotBE.Path_archivo));

                cmd.Parameters.Add(new SqlParameter("@rnid", SqlDbType.Int));

                cmd.Parameters["@rnid"].Direction = ParameterDirection.Output;
                cmd.Parameters.Add(new SqlParameter("@detalles", SqlDbType.Structured));
                cmd.Parameters["@detalles"].Value = cotBE.DetalleDeCotizacion;


                con.Open();
                cmd.ExecuteNonQuery();
                return(Convert.ToInt32(cmd.Parameters["@rnid"].Value.ToString()));
            } catch (Exception) {
                return(-1);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }
コード例 #3
0
ファイル: Cotizacion.aspx.cs プロジェクト: dominique120/SIMSE
        protected void btnGrabarCotizacion_Click(object sender, EventArgs e)
        {
            try {
                detalles = (DataTable)Session["Detalles"];

                // Validamos las fechas...
                if (dtpAprobacion.Text == "")
                {
                    throw new Exception("Debe ingresar fecha de aprobacion.");
                }

                if (dtpCreacion.Text == "")
                {
                    throw new Exception("Debe ingresar fecha de creacion.");
                }


                // Si existen  registros de detalles se registra la orden
                if (detalles.Rows.Count > 0)
                {
                    CotizacionBE cotBE = new CotizacionBE();
                    CotizacionBL cotBL = new CotizacionBL();

                    //Asignamos valores de cabecera ( El nro lo genera el SP)
                    cotBE.Id_aprobado_por = Convert.ToInt32(cboAprobadoPor.SelectedValue);
                    cotBE.Id_proyecto     = Convert.ToInt32(cboProyecto.SelectedValue);
                    cotBE.Id_encargado    = Convert.ToInt32(cboEncargado.SelectedValue);
                    cotBE.Enviar_a        = Convert.ToInt32(cboEnviar.SelectedValue);

                    cotBE.Fecha_aprobacion = Convert.ToDateTime(dtpAprobacion.Text);
                    cotBE.Fecha_creacion   = Convert.ToDateTime(dtpCreacion.Text);
                    cotBE.Fecha_envio      = Convert.ToDateTime(dtpEnvio.Text);

                    cotBE.Path_archivo = txtPath.Text;
                    cotBE.Notas        = txtNotas.Text;

                    // Asignamos los detalles a la propiedad respectiva
                    cotBE.DetalleDeCotizacion = detalles;

                    // Se evalua el exito del metodo
                    int rnid = cotBL.CotizacionConDetallesNew(cotBE);
                    if (rnid == -1)
                    {
                        throw new Exception("Error , no se registró la orden. Contacte con IT.");
                    }
                    else
                    {
                        lblMensaje.Text = "Se registró la orden Nro: " + rnid.ToString() + " exitosamente.";
                        mpeMensaje.Show();
                        // Reinicio los controles y  la tabla por si se desea registrar una nueva orden de compra
                        dtpAprobacion.Text           = "";
                        dtpCreacion.Text             = "";
                        dtpEnvio.Text                = "";
                        txtNotas.Text                = "";
                        txtPath.Text                 = "";
                        cboAprobadoPor.SelectedIndex = 0;
                        cboProyecto.SelectedIndex    = 0;
                        cboEncargado.SelectedIndex   = 0;
                        cboEnviar.SelectedIndex      = 0;
                        CrearTabla();
                    }
                }
                //Si no hay detalles, no se puede registrar la  orden
                else
                {
                    throw new Exception("No puede registrar una orden sin detalles.");
                }
            } catch (Exception ex) {
                lblMensaje.Text = ex.Message;
                mpeMensaje.Show();
            }
        }
コード例 #4
0
ファイル: CotizacionBL.cs プロジェクト: dominique120/SIMSE
 public int CotizacionConDetallesNew(CotizacionBE cotBE)
 {
     return(cotADO.CotizacionConDetallesNew(cotBE));
 }