コード例 #1
0
        public void GuardarCotizacion()
        {
            int k, y, i;

            MessageBox.Show("Codigo Proveedor = " + prov.CodProveedor + "\nRazon Social = " + prov.RazonSocial);

            c.Proveedor = prov;
            c.FechaInicio = TxtFechaIni;
            c.FechaFin = TxtFechaFin;
            c.FechaRespuesta = TxtFechaResp;
            c.Observacion = TxtObservacion;

            if (c.Proveedor.CodProveedor != null)
            {
                if (indicador == 1)
                {

                    {
                        k = new CotizacionSQL().Agregar(c);

                        List<Cotizacion> list = eMC.Buscar() as List<Cotizacion>;
                        Id = list[list.Count - 1].IdCotizacion;
                        c.CodCotizacion = "COT-" + (1000000 + Id).ToString();

                        if (LstProducto != null)
                        {
                            for (i = 0; i < LstProducto.Count; i++)
                            {
                                LstProducto[i].IdCotizacion = Id;
                                y = csql.InsertarValidado(LstProducto[i]);
                            }
                        }

                        if (k == 0)
                            MessageBox.Show("Ocurrio un error");
                        else
                            MessageBox.Show("Cotizacion Registrada \n\nCodigo = " + c.CodCotizacion + "\nProveedor = " + c.Proveedor.RazonSocial +
                                               " (" + c.Proveedor.CodProveedor + ")" + "\nFecha registro = " + c.FechaRespuesta.ToString());

                    }

                }

                if (indicador == 2)
                {

                        k = new CotizacionSQL().Actualizar(c);

                        if (LstProducto != null)
                        {
                            for (i = 0; i < LstProducto.Count; i++)
                            {
                                LstProducto[i].IdCotizacion = c.IdCotizacion;
                                y = csql.InsertarValidado(LstProducto[i]);
                            }
                        }

                        if (k == 0)
                            MessageBox.Show("Ocurrio un error");
                        else
                            MessageBox.Show("Cotizacion Editada \n\nCodigo = " + c.CodCotizacion + "\nProveedor = " + c.Proveedor.RazonSocial +
                                            " (" + c.Proveedor.CodProveedor + ")" + "\nFecha respuesta = " + c.FechaRespuesta.ToString() + "\nFecha inicio = " + c.FechaInicio.ToString() +
                                            "\nFecha fin = " + c.FechaFin.ToString());

                    }

                    if (model != null)
                        model.ActualizarCotizacion();
                }
        }
コード例 #2
0
        public Cotizacion obtenerCotizacion(int idProv)
        {
            List<Cotizacion> lstCot = new CotizacionSQL().Buscar() as List<Cotizacion>;

            if (lstCot == null)
                return null;
            else
            {
                for (int i = 0; i < lstCot.Count; i++)
                {
                    if (lstCot[i].Proveedor.IdProveedor == idProv)
                        return lstCot[i];
                }

            }

            return null;
        }