public async Task <IActionResult> Putoferta(int id, oferta oferta)
        {
            if (id != oferta.OfertaId)
            {
                return(BadRequest());
            }

            _context.Entry(oferta).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ofertaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        private string reemplazarVariablesOferta(string texto, oferta oferta)
        {
            if (!string.IsNullOrEmpty(texto))
            {
                if (texto.Contains("%SEDE%"))
                {
                    texto = texto.Replace("%SEDE%", oferta.sede1.nombre);
                }
                if (texto.Contains("%TIPO_CURSO%"))
                {
                    texto = texto.Replace("%TIPO_CURSO%", oferta.curso1.tipocurso1.descripcion);
                }
                if (texto.Contains("%CURSO%"))
                {
                    texto = texto.Replace("%CURSO%", oferta.curso1.descripcion);
                }
                if (texto.Contains("%DIA_HORARIO%"))
                {
                    texto = texto.Replace("%DIA_HORARIO%", oferta.horario);
                }
                if (texto.Contains("%AULA%"))
                {
                    texto = texto.Replace("%AULA%", oferta.cantidadCuotas.ToString());
                }
                if (texto.Contains("%FECHA_INICIO%"))
                {
                    texto = texto.Replace("%FECHA_INICIO%", oferta.fechaDesde.ToString());
                }
            }

            return(texto);
        }
        public async Task <ActionResult <oferta> > Postoferta(oferta oferta)
        {
            _context.ofertas.Add(oferta);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getoferta", new { id = oferta.OfertaId }, oferta));
        }
示例#4
0
        public Wypożyczanie_Window()
        {
            InitializeComponent();
            Oferta = Oferta.OdczytajXML("zapis.xml") as oferta;

            lista = new ObservableCollection <samochody>(Oferta.Oferta);
            listbox_oferta_window.ItemsSource = lista;
        }
示例#5
0
 public void init()
 {
     //Se instancia objeto de tipo oferta
     oferta1 = ocmd.Get(1);
     oferta2 = ocmd.Get(2);
     oferta3 = ocmd.Get(3);
     oferta4 = ocmd.Get(4);
 }
示例#6
0
 public void init()
 {
     //Se instancia objeto de tipo oferta
     oferta1 = new oferta(55000, "Oxford", 20, "Bicicleta pequeña");
     oferta2 = new oferta(100000, "GT", 26, "Bicicleta grande");
     oferta3 = new oferta(130000, "Giant", 27, "Bicicleta grande");
     oferta4 = new oferta(220000, "Trek", 24, "Bicicleta mediana");
 }
示例#7
0
        public HttpResponseMessage insertaOferta(oferta value)
        {
            var endpoint = "http://coposoftware.org:8090/itemcotizacion/update";
            var client   = new HttpClient();
            var response = client.PutAsJsonAsync(endpoint, value).Result;

            client.Dispose();
            return(response);
        }
        public Rezerwacja_Window()
        {
            MoveBottomRightEdgeOfWindow();
            InitializeComponent();
            InitializeComponent();
            Oferta = Oferta.OdczytajXML("zapis.xml") as oferta;

            lista = new ObservableCollection <samochody>(Oferta.Oferta);
            listbox_oferta_window.ItemsSource = lista;
        }
示例#9
0
 public static string descripcionHorario(oferta x)
 {
     return(string.Format("{0} {1} a {2}",
                          ((x.lunes) ? "LU " : "")
                          + ((x.martes) ? "MA " : "")
                          + ((x.miercoles) ? "MI " : "")
                          + ((x.jueves) ? "JU " : "")
                          + ((x.viernes) ? "VI " : "")
                          + ((x.sabado) ? "SA " : ""),
                          x.horaDesde != null ? x.horaDesde.Value.ToString(@"hh\:mm") : "",
                          x.horaHasta != null ? x.horaHasta.Value.ToString(@"hh\:mm") : ""));
 }
        public oferta Update(oferta oferta)
        {
            oferta updateoferta = repo.FindSingleOrDefault(a => a.Id == oferta.Id);

            updateoferta.Aro         = oferta.Aro;
            updateoferta.Descripcion = oferta.Descripcion;
            updateoferta.Marca       = oferta.Marca;
            updateoferta.Precio      = oferta.Precio;

            repo.Update(updateoferta);

            return(updateoferta);
        }
示例#11
0
        public HttpResponseMessage createOferta(oferta value)
        {
            creaOferta oferta = new creaOferta {
                id_item_cotizacion = value.id_item_cotizacion, id_proveedor = value.id_proveedor, oferta_fecha = value.oferta_fecha
            };
            var endpoint = "http://coposoftware.org:8091/oferta/create";
            var client   = new HttpClient();
            var response = client.PostAsJsonAsync(endpoint, oferta).Result;

            var respuesta = insertaOferta(value);

            client.Dispose();
            return(respuesta);
        }
示例#12
0
        private void btnOfertaAdaugare_Click(object sender, EventArgs e)
        {
            var currentEdit = GetEditOfertaItem();

            using (LabDataContext lb = new LabDataContext())
            {
                var newOferta = new oferta()
                {
                    IdFurnizor   = currentEdit.Furnizor,
                    DataExpirare = currentEdit.DataExpirare
                };
                lb.oferta.Add(newOferta);
                lb.SaveChanges();
                UpdateOfertaGrid("Adauga");
            }
        }
示例#13
0
 public static string descripcionCompleja(oferta x)
 {
     return(string.Format("({0} - {1}) {2} - {3} - {4} [{5} {6} a {7}]", (x.periodolectivo1 != null) ? x.periodolectivo1.anio.ToString() : "",
                          (x.periodolectivo1 != null) ? x.periodolectivo1.periodo.ToString() : "",
                          (x.curso1 != null && x.curso1.tipocurso1 != null) ? x.curso1.tipocurso1.descripcion : "",
                          (x.curso1 != null) ? x.curso1.descripcion : "",
                          (x.sede1 != null) ? x.sede1.nombre : "",
                          ((x.lunes) ? "LU " : "")
                          + ((x.martes) ? "MA " : "")
                          + ((x.miercoles) ? "MI " : "")
                          + ((x.jueves) ? "JU " : "")
                          + ((x.viernes) ? "VI " : "")
                          + ((x.sabado) ? "SA " : ""),
                          (x.horaDesde != null && x.horaDesde.HasValue) ? x.horaDesde.Value.ToString(@"hh\:mm") : "",
                          (x.horaHasta != null && x.horaHasta.HasValue) ? x.horaHasta.Value.ToString(@"hh\:mm") : ""));
 }
示例#14
0
 public OfertaEmpleoViewModel(oferta entity)
 {
     this.id            = entity.Id;
     this.title         = entity.title;
     this.detail        = entity.detail;
     this.price         = entity.price;
     this.date          = entity.date;
     this.customer_id   = entity.customer_id;
     this.category_Id   = entity.category_Id;
     this.resources     = entity.resources;
     this.opcion_empleo = entity.opcion_empleo;
     this.compania      = entity.compania;
     this.tiempo        = entity.tiempo;
     this.experiencia   = entity.experiencia;
     this.pago          = entity.pago;
     this.salario       = entity.salario;
     this.tipo          = entity.tipo;
 }
示例#15
0
        public ActionResult Enviar(MailModel mail, HttpPostedFileBase adjunto1, HttpPostedFileBase adjunto2, HttpPostedFileBase adjunto3, HttpPostedFileBase adjunto4)
        {
            int Ok    = 0;
            int Error = 0;

            if (adjunto1 != null)
            {
                //mail.ImageMimeType = adjunto.ContentType;
                mail.adjunto = new byte[adjunto1.ContentLength];
                adjunto1.InputStream.Read(mail.adjunto, 0, adjunto1.ContentLength);
            }

            List <MailModel> mails = new List <MailModel>();

            if (!string.IsNullOrEmpty(mail.modo) && mail.modo == "Oferta")
            {
                //var ofertas = (List<oferta>)Session["ofertasParaEnviarEmail"];
                var codigos = mail.codigos != null?mail.codigos.Split('|') : null;


                if (codigos != null && codigos.Count() > 0)
                {
                    oferta ofertaAdministrador = null;

                    foreach (var cod in codigos)
                    {
                        int codigo = 0;
                        if (int.TryParse(cod, out codigo))
                        {
                            var oferta = db.oferta.Find(codigo);
                            ofertaAdministrador = oferta;
                            foreach (var cur in oferta.cursa)
                            {
                                var email = new MailModel();

                                email.asunto        = reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.asunto, cur.AspNetUsers), oferta);
                                email.editor        = reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.editor, cur.AspNetUsers), oferta);
                                email.destinatarios = cur.AspNetUsers.Email;

                                if (!mails.Where(x => x.destinatarios == email.destinatarios).Any() ||
                                    (mails.Where(x => x.destinatarios == email.destinatarios).Any() &&
                                     (!mails.Where(x => x.asunto == email.asunto).Any() || !mails.Where(x => x.editor == email.editor).Any())))   //evita enviar el mismo mail a una persona 2 veces (si es que no se usaron variables)
                                {
                                    mails.Add(email);
                                }
                            }
                        }
                    }

                    if (ofertaAdministrador != null)
                    {
                        var userAdministrador  = db.AspNetUsers.Find(ApplicationUser.GetId());
                        var emailAdministrador = new MailModel();
                        emailAdministrador.asunto        = reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.asunto, userAdministrador), ofertaAdministrador);
                        emailAdministrador.editor        = reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.editor, userAdministrador), ofertaAdministrador);
                        emailAdministrador.destinatarios = userAdministrador.Email;
                    }
                }
            }
            else if (!string.IsNullOrEmpty(mail.modo) && mail.modo == "Deuda")
            {
                //var ofertas = (List<oferta>)Session["ofertasParaEnviarEmail"];
                //var codigos = mail.codigos.Split('|');
                var cuotas = CuotaData.consultarCuotas(mail.codigos);

                //asdas
                foreach (var cuota in cuotas)
                {
                    var oferta  = db.oferta.Find(cuota.NroComision);
                    var usuario = db.AspNetUsers.Where(x => x.NroDocumento == cuota.Dni).First();

                    if (oferta != null && usuario != null)
                    {
                        var email = new MailModel();

                        email.asunto        = reemplazarVariablesCuota(reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.asunto, usuario), oferta), cuota);
                        email.editor        = reemplazarVariablesCuota(reemplazarVariablesOferta(reemplazarVariablesUsuario(mail.editor, usuario), oferta), cuota);
                        email.destinatarios = usuario.Email;

                        if (!mails.Where(x => x.destinatarios == email.destinatarios).Any() ||
                            (mails.Where(x => x.destinatarios == email.destinatarios).Any() &&
                             (!mails.Where(x => x.asunto == email.asunto).Any() || !mails.Where(x => x.editor == email.editor).Any())))   //evita enviar el mismo mail a una persona 2 veces (si es que no se usaron variables)
                        {
                            mails.Add(email);
                        }
                    }
                }
            }
            else if (!string.IsNullOrEmpty(mail.modo) && mail.modo == "Usuario")
            {
                var nrosDoc = Session["usuariosParaEnviarEmail"].ToString();
                var codigos = nrosDoc.Split('|');



                foreach (var cod in codigos)
                {
                    int codigo = 0;
                    if (int.TryParse(cod, out codigo))
                    {
                        var usuario = db.AspNetUsers.Where(x => x.NroDocumento == codigo).First();


                        var email = new MailModel();

                        email.asunto        = reemplazarVariablesUsuario(mail.asunto, usuario);
                        email.editor        = reemplazarVariablesUsuario(mail.editor, usuario);
                        email.destinatarios = usuario.Email;

                        if (!mails.Where(x => x.destinatarios == email.destinatarios).Any() ||
                            (mails.Where(x => x.destinatarios == email.destinatarios).Any() &&
                             (!mails.Where(x => x.asunto == email.asunto).Any() || !mails.Where(x => x.editor == email.editor).Any())))   //evita enviar el mismo mail a una persona 2 veces (si es que no se usaron variables)
                        {
                            mails.Add(email);
                        }
                    }
                }



                foreach (var email in mails)
                {
                    string resultado = cnrl.Logica.App.EnviarMailComunicacion(
                        email.destinatarios,
                        email.asunto,
                        email.editor,
                        false,
                        User.Identity.Name,
                        adjunto1,
                        adjunto2,
                        adjunto3,
                        adjunto4);

                    if (resultado == "Ok")
                    {
                        Ok++;
                    }
                    else
                    {
                        Error++;
                    }
                }

                ViewBag.Enviados = Ok;
                ViewBag.Errores  = Error;
                ViewBag.Error    = (Error > 0) ? true : false;
                ViewBag.Mensaje  = "";

                return(View("Enviados"));
            }
            else
            {
                ViewBag.Enviados = 0;
                ViewBag.Errores  = 0;
                ViewBag.Error    = true;
                ViewBag.Mensaje  = "No habia datos en sesión";
                return(View("Enviados"));
            }


            foreach (var email in mails)
            {
                string resultado = cnrl.Logica.App.EnviarMailComunicacion(
                    email.destinatarios,
                    email.asunto,
                    email.editor,
                    false,
                    User.Identity.Name,
                    adjunto1,
                    adjunto2,
                    adjunto3,
                    adjunto4);

                if (resultado == "Ok")
                {
                    Ok++;
                }
                else
                {
                    Error++;
                }
            }

            ViewBag.Enviados = Ok;
            ViewBag.Errores  = Error;
            ViewBag.Error    = (Error > 0) ? true : false;
            ViewBag.Mensaje  = "";

            return(Json(new { ok = (Ok > 0) ? true : false }));

            //            return View("Enviados");
            //return GridViewExtension.ExportToXls(CrearGridViewSettingsExportar(letra), personas, true);
        }
 public oferta Save(oferta oferta)
 {
     repo.Save(oferta);
     return(oferta);
 }
示例#17
0
 public IActionResult creaOferta(oferta oferta)
 {
     Console.WriteLine("Success");
     return(Ok(1));
 }