public void AoCalcularUmaProvisaoComMesDevigenciaIgualAoMesFimVigenciaDeveRetornarUmaProvisao() { _premio = PremioBuilder.Um().Padrao() .Com(CoberturaContratadaBuilder.Uma().Com(HistoricoCoberturaContratadaBuilder.UmHistorico())) .ComDataCompetencia(new DateTime(2017, 01, 01)) .ComFimVigencia(new DateTime(2017, 01, 31)) .Build(); _premio.InformaEvento(EventoEmissaoPremioBuilder.UmEvento().Padrao().Build()); var listaProvisao = _calculadorPPNG.CalcularProvisao(_premio); var qtdCompetencias = 1; Assert.That(qtdCompetencias, Is.EqualTo(listaProvisao.ToList().Count)); }
public virtual IEnumerable <ProvisaoDto> CalcularProvisao(Premio premio) { var dataExecucao = premio.EventoOperacional.DataExecucaoEvento; var competenciaCalculo = dataExecucao.Date.AddDays(1 - dataExecucao.Day); do { yield return(new ProvisaoPremioNaoGanho() { ProvisaoId = (short)TipoProvisaoEnum.PPNG, DataMovimentacao = competenciaCalculo, Valor = CalcularPPNG(competenciaCalculo, premio.InicioVigencia, premio.FimVigencia, premio.ValorPremio), }); competenciaCalculo = competenciaCalculo.AddMonths(1); } while (competenciaCalculo < premio.FimVigencia); }
public static void Main(string[] args) { Premio p = new Premio("Marina", DateTime.Parse("05/04/2021")); Console.WriteLine("PREMIO:"); Console.WriteLine(p.ToString()); ValeCompras v = new ValeCompras(DateTime.Parse("05/04/2021"), Convert.ToDecimal(79.90)); Console.WriteLine("VALE COMPRAS:"); Console.WriteLine(v.ToString()); Produto pd = new Produto("Máquina de barbear - PHILCO", Convert.ToDecimal(79.90)); Console.WriteLine("PRODUTO:"); Console.WriteLine(pd.ToString()); }
bool ILitedbDAL.UpdatePremio(Premio premio) { var db = new LiteDatabase(LitedbConn.ConnString()); var premios = db.GetCollection <Premio>("Premios"); try { premios.Update(premio); IndexLitedb(premios); return(true); } catch { return(false); } }
private void LimparFormulario() { btnBuscarPremio.IsEnabled = true; btnBuscarFilme.IsEnabled = true; txtFilme.IsEnabled = true; txtPremio.IsEnabled = true; txtFilme.Text = " "; txtPremio.Text = " "; lbFilmeEncontrado.Content = ""; lbPremioEncontrado.Content = ""; txtFilme.Focus(); f = new Filme(); p = new Premio(); }
public void DadoUmPremioReparticaoSimplesDeveCalcularPPNG() { CriaEventoEmissaoPremio(TipoRegimeFinanceiroEnum.ReparticaoSimples, TipoProvisaoEnum.PPNG, TipoProvisaoEnum.PIC, TipoProvisaoEnum.POR); _premio = _evento.Premios.First(); _premio.InformaEvento(_evento); _calculadorPPNG.Setup(x => x.CalcularProvisao(It.IsAny <Premio>())) .Returns(new List <ProvisaoDto>() { _movimentoProvisaoDto }); _calculadorProvisao = new CalculadorProvisaoPremio(_calculadorPPNG.Object, _calculadorPMBAC.Object, _provisao.Object); _calculadorProvisao.CriarProvisao(_premio); _calculadorPPNG.Verify(m => m.CalcularProvisao(It.IsAny <Premio>())); }
public async Task <IActionResult> Create([Bind("PeliculaId,CertamenId,TipoPremio,fechaEntrega")] Premio premio) { if (ModelState.IsValid) { int numPremios = _context.Premio.Where(u => u.PeliculaId == premio.PeliculaId).Count(); Console.WriteLine("" + numPremios); if (numPremios >= 3) { string Alerta = "La-pelicula-tiene-mas-de-3-premios"; return(RedirectToAction("", new { Alerta })); } else { var pelicula = _context.Pelicula.SingleOrDefault(i => i.Id == premio.PeliculaId); var director = _context.Director.SingleOrDefault(n => n.Id == pelicula.DirectorId); int totalPremios = 0; string Alert = "El director tiene mas de tres premios por sus peliculas"; foreach (var p in director.Peliculas) { totalPremios += _context.Premio.Where(c => c.PeliculaId == p.Id).Count(); } if (totalPremios >= 3) { return(RedirectToAction("", new { Alert })); } else { _context.Add(premio); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } } } ViewData["CertamenId"] = new SelectList(_context.Certamen, "Id", "Id", premio.CertamenId); ViewData["PeliculaId"] = new SelectList(_context.Pelicula, "Id", "Titulo", premio.PeliculaId); return(View(premio)); }
public Premio ListarPremio(int idPremio) { SqlConnection conexion = new SqlConnection(); SqlCommand comando = new SqlCommand(); SqlDataReader lector; try { Premio premioElegido = new Premio(); conexion.ConnectionString = AccesoDatosManager.cadenaConexion; comando.CommandType = System.Data.CommandType.Text; String Query = String.Format("SELECT * FROM {0} where id ={1}", Tabla, idPremio); comando.CommandText = Query; comando.Connection = conexion; conexion.Open(); lector = comando.ExecuteReader(); while (lector.Read()) { if (idPremio == Convert.ToInt32(lector["Id"])) { idProductoElegido = premioElegido.ID; premioElegido.ID = Convert.ToInt32(lector["Id"]); premioElegido.Descripcion = Convert.ToString(lector["Descripcion"]); premioElegido.Titulo = Convert.ToString(lector["Titulo"]); premioElegido.URLImagen = Convert.ToString(lector["URLImagen"]); } } return(premioElegido); } catch (Exception ex) { throw ex; } finally { conexion.Close(); } }
public ActionResult Create(Premio pr) { var result = default(ActionResult); try { ViewBag.Msg = "Crear Nuevo Premio"; ViewBag.Title = "Crear Premio"; ViewBag.Btn = "Crear"; ViewBag.Method = "Create"; ViewBag.idTipoPremio = _repo.TipoPremioRepository.Transform(x => new SelectListItem() { Text = x.tipo, Value = x.idTipoPremio.ToString() }); if (!_repo.PremioRepository.Exists(x => x.nombre.Trim().ToLower() == pr.nombre.Trim().ToLower())) { if (ModelState.IsValid) { pr.idUser = UserUtil.GetUsuario((Usuario)Session["User"]).idUsuario; _repo.PremioRepository.Add(_repo.PremioRepository.UpperCaseValues(pr)); _repo.Save(); result = RedirectToAction("Index"); } else { result = View("CreateEdit"); } } else { ModelState.AddModelError("error", "El premio ya existe"); result = View("CreateEdit"); } } catch (Exception ex) { Logger.LogException(ex); TempData["err"] = "No se pudo crear los premios"; result = RedirectToAction("Error", "ErrorManagement"); } return(result); }
public static void Main(string[] args) { CultureInfo ci = new CultureInfo("pt-BR"); Thread.CurrentThread.CurrentCulture = ci; ValeCompras valecompras = new ValeCompras(DateTime.Now, 400.00M); Produto produto = new Produto("Cafeteira", 380.00M); Premio premio = new Premio("Vicente", DateTime.Parse("01/10/2020")); premio.SetPremio(produto); Console.WriteLine(premio); premio.SetPremio(valecompras); Console.WriteLine(premio); return; }
public Premio ConsultaPremio(string strCodigo, out string strMensaje) { try { var parametros = new List <SqlParameter> { new SqlParameter("@strCodigo", strCodigo) }; var dt = _dataHelper.EjecutarSp <DataTable>("ma_spConsultaPremioNuevo", parametros); if (dt != null) { if (dt.Rows.Count > 0) { var xdatos = new Premio { StrCodigoPremio = dt.Rows[0]["strCodigoPremio"].ToString(), StrNombrePremio = dt.Rows[0]["strNombre"].ToString(), IntNumPuntos = Convert.ToInt16(dt.Rows[0]["numPuntos"]) }; strMensaje = ""; return(xdatos); } else { strMensaje = "El premio se encuentra temporalmente agotado"; return(null); } } else { strMensaje = "No hay conexión con la base de datos"; return(null); } } catch (Exception ex) { strMensaje = ex.Message; return(null); } }
public static Premio ReadPremioFromDb(int id) { var premio = new Premio(); var parametros = new List <SqlParameter>(); parametros.Add(new SqlParameter("@id", id)); var query = DataBase.ejecutarFuncion("Select top 1 * from premio g where g.premio_cod = @id", parametros); SqlDataReader reader = query.ExecuteReader(); while (reader.Read()) { premio = new Premio() { Id = (int)reader.GetValue(Ordinales.Premio["Premio_Id"]), Descripcion = reader.GetValue(Ordinales.Premio["Premio_Desc"]).ToString(), Puntos = (int)reader.GetValue(Ordinales.Premio["Premio_Puntos"]) }; } return(premio); }
public frmAbrirPremio(frmPrincipal padre, Premio p) { this.padre = padre; this.p = p; InitializeComponent(); CenterToScreen(); abrirImagen.Filter = "PNG Files (*.png)|*.png"; textNombre.Text = p.nombre; textCoins.Text = p.coins + ""; checkActivado.Checked = p.activado; if (p.imagen) { nombreImagen.Text = "Tiene ya una imagen"; } else { nombreImagen.Text = "No tiene imagen"; } }
public void insertarNuevoPremio(Premio premio) { string procedure = "[TheBigBangQuery].[insertarNuevoPremio] @puntos, @nombre, @vencimiento"; try { SqlCommand command = new SqlCommand(procedure); command.CommandText = procedure; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@puntos", premio.puntosNecesarios); command.Parameters.AddWithValue("@nombre", premio.nombre); command.Parameters.AddWithValue("@vencimiento", premio.fechaVencimiento); DatabaseConection.executeNoParamFunction(command); } catch (Exception ex) { throw new SqlInsertException("Error al insertar el premio", 0); } }
public UiContainer BindFields(string objUiContainer) { var uiContainer = UiContainer.Build(objUiContainer); var tblPremios = uiContainer.GetCtrlModel <CtrlTableModel>("tblPremios"); var premio = new Premio(tblPremios.GetSelectedRow()); var txtId = uiContainer.GetCtrlModel <CtrlInputModel>("txtId"); var txtNombre = uiContainer.GetCtrlModel <CtrlInputModel>("txtNombre"); var txtDescripcion = uiContainer.GetCtrlModel <CtrlInputModel>("txtDescripcion"); var btnGuardar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnGuardar"); var btnEliminar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnEliminar"); var btnActualizar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnActualizar"); txtId.Value = premio.IdPremio.ToString(); txtId.Disabled = true; txtNombre.Value = premio.NombrePremio; txtDescripcion.Value = premio.DescripcionPremio; btnGuardar.Value = "Guardar"; btnGuardar.ButtonType = "info"; btnGuardar.Disabled = true; btnGuardar.EvtOnClick = " "; btnEliminar.Value = "Eliminar"; btnEliminar.ButtonType = "danger"; btnEliminar.Disabled = false; btnEliminar.EvtOnClick = "deletePremio()"; btnActualizar.Value = "Actualizar"; btnActualizar.ButtonType = "warning"; btnActualizar.Disabled = false; btnActualizar.EvtOnClick = "updatePremio()"; uiContainer.UpdateModel(txtId); uiContainer.UpdateModel(txtNombre); uiContainer.UpdateModel(txtDescripcion); uiContainer.UpdateModel(btnGuardar); uiContainer.UpdateModel(btnEliminar); uiContainer.UpdateModel(btnActualizar); return(uiContainer); }
public virtual IEnumerable <ProvisaoDto> CalculaProvisao(Premio premio, decimal valorUltimaProvisao) { var dataExecucao = premio.EventoOperacional.DataExecucaoEvento; var competenciaCalculo = dataExecucao.Date.AddDays(1 - dataExecucao.Day); var provisionavel = premio.Cobertura.TipoItemProdutoId != (short)TipoItemProdutoEnum.VGBL && premio.Cobertura.TipoItemProdutoId != (short)TipoItemProdutoEnum.PGBL; var listaProvisao = new List <ProvisaoDto>(); if (provisionavel) { var pmbac = _calculo.CalcularPMBAC(premio.Cobertura, competenciaCalculo, valorUltimaProvisao); pmbac.ProvisaoId = (short)TipoProvisaoEnum.PMBAC; pmbac.DataMovimentacao = pmbac.DataMovimentacao != default(DateTime) ? pmbac.DataMovimentacao : DateTime.Now; listaProvisao.Add(pmbac); } return(listaProvisao.AsEnumerable()); }
public UiContainer UpdatePremio(string objUiContainer) { var uiContainer = UiContainer.Build(objUiContainer); var txtId = uiContainer.GetCtrlModel <CtrlInputModel>("txtId"); var txtNombre = uiContainer.GetCtrlModel <CtrlInputModel>("txtNombre"); var txtDescripcion = uiContainer.GetCtrlModel <CtrlInputModel>("txtDescripcion"); var tblPremios = uiContainer.GetCtrlModel <CtrlTableModel>("tblPremios"); var mu = new PremioManagement(); var premio = new Premio() { IdPremio = Convert.ToInt32(txtId.Value), NombrePremio = txtNombre.Value, DescripcionPremio = txtDescripcion.Value }; mu.UpdatePremio(premio); txtId.Disabled = true; var list = mu.RetrieveAllPremios <Premio>(); tblPremios.RowList.Clear(); foreach (var prem in list) { tblPremios.RowList.Add(new List <string>() { prem.IdPremio.ToString(), prem.NombrePremio, prem.DescripcionPremio }); } uiContainer.UpdateModel(tblPremios); uiContainer.UpdateModel(txtId); uiContainer.UpdateModel(txtNombre); uiContainer.UpdateModel(txtDescripcion); return(uiContainer); }
public async Task <Premio> CriarPremio(Premio premio, EventoPremio evento) { var cobertura = await _coberturas.ObterPorItemCertificado(premio.ItemCertificadoApoliceId); if (!evento.RegimeFinanceiroPermitido.Contains(cobertura.RegimeFinanceiroId.GetValueOrDefault())) { return(null); } var contribuicoes = await ObterNumeroContribuicoes(premio, cobertura.NumeroContribuicoesInicial); cobertura.ComNumeroContribuicoes(contribuicoes); premio.ComCobertura(cobertura) .ComTipoMovimento((short)evento.TipoMovimento) .InformaEvento(evento); await ValidarPremioAnterior(premio); premio.AdicionarMovimentoProvisao(_calculador.CriarProvisao(premio)); return(premio); }
public static List <Premio> ListarArticulo(string idPremio) { try { Premio newLineOrder = new Premio(); List <Premio> order = new List <Premio>(); DataSet dsArt = Premio.ConsultarPremiosArticulo(idPremio); DataTable dt = dsArt.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { Premio prem = new Premio(); prem.Premio_Articulo = dt.Rows[i]["Referencia"].ToString(); prem.Premio_cantidad = Convert.ToDecimal(dt.Rows[i]["Cantidad"]); prem.Premio_talla = dt.Rows[i]["Talla"].ToString(); order.Add(prem); } return(order); } catch (Exception e) { throw new Exception(e.Message, e.InnerException); } }
public List <T> RetrieveByName <T>(Premio premio) { var lst = new List <T>(); try { var list = _factory.RetrieveByName <Premio>(premio); if (list.Count > 0) { foreach (var obj in list) { lst.Add((T)Convert.ChangeType(obj, typeof(T))); //se convierte la lista a un tipo List<T> para que pueda ser retornada //al formulario y reconocida como una lista de una instancia de User's } } } catch (Exception ex) { _exMan.ManageException(ex); } return(lst); //se retorna la lista al formulario }
public void DadoUmPremioCapitalizadoDeveCalcularPMBAC() { CriaEventoEmissaoPremio(TipoRegimeFinanceiroEnum.Capitalizacao, TipoProvisaoEnum.PMBAC); _premio = _evento.Premios.First(); _premio.InformaEvento(_evento); _resultado = PmbacBuilder.UmBuilder().Padrao().Build(); _facade = new Mock <ICalculoFacade>(); _facade.Setup(x => x.CalcularPMBAC(It.IsAny <CoberturaContratada>(), It.IsAny <DateTime>(), It.IsAny <decimal>())).Returns(_resultado); _provisao.Setup(x => x.ObterUltimoMovimentoProvisao(It.IsAny <Premio>(), TipoProvisaoEnum.PMBAC)).Returns(Task.FromResult(_movimentoProvisao)); _calculadorPMBAC.Setup(x => x.CalculaProvisao(It.IsAny <Premio>(), It.IsAny <decimal>())).Returns(new List <ProvisaoDto>() { _resultado }); _calculadorProvisao = new CalculadorProvisaoPremio(_calculadorPPNG.Object, _calculadorPMBAC.Object, _provisao.Object); _calculadorProvisao.CriarProvisao(_premio); _calculadorPMBAC.Verify(m => m.CalculaProvisao(It.IsAny <Premio>(), It.IsAny <decimal>())); }
private void addPremioAoFilme(object sender, RoutedEventArgs e) { OpenConnectionDB(); Premio p = new Premio(); if (comboBox3f.SelectedItem == null) { MessageBox.Show("Campo 'Filme' é obrigatorio!"); return; } p.filme_id = Convert.ToInt32(comboBox3f.Text.Split('[', ']')[1]); if (textBox11f.Text.Length == 0) { MessageBox.Show("Campo 'Ano' é obrigatorio!"); return; } else if (!textBox11f.Text.All(char.IsDigit)) { MessageBox.Show("Campo 'Ano' apenas pode possuir digitos!"); return; } else { p.ano = Convert.ToInt32(textBox11f.Text); } if (textBox10f.Text.Length == 0) { MessageBox.Show("Campo 'Tipo' é obrigatorio!"); return; } else { p.tipo = textBox10f.Text; } if (textBox9f.Text.Length == 0) { MessageBox.Show("Campo 'Descrição' é obrigatorio!"); return; } else { p.descricao = textBox9f.Text; } string queryInsertSQLDML = "INSERT INTO gestordefilmes.premio(idfilme, ano, tipo, descricao) VALUES(@idfilme, @ano, @tipo, @descricao)"; SqlCommand insertQuery = new SqlCommand(queryInsertSQLDML, cnn); insertQuery.Parameters.AddWithValue("@idfilme", p.filme_id); insertQuery.Parameters.AddWithValue("@ano", p.ano); insertQuery.Parameters.AddWithValue("@tipo", p.tipo); insertQuery.Parameters.AddWithValue("@descricao", p.descricao); try { insertQuery.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("ERRO ao inserir Prémio na Base de Dados", "Gestor de Filmes", MessageBoxButton.OK, MessageBoxImage.Error); Console.WriteLine(ex.Message); return; } cnn.Close(); MessageBox.Show("Prémio '" + p.tipo + "' foi adicionao ao filme '" + comboBox3f.Text.Split('[', ']')[1] + "' com sucesso!", "Gestor de Filmes", MessageBoxButton.OK, MessageBoxImage.Information); textBox9f.Clear(); textBox10f.Clear(); textBox11f.Clear(); }
protected void btAgregar_Click(object sender, EventArgs e) { string strIdPremio = _idpremio; string strDataDetalle = ""; string listExistentes = ""; string strErrorCantidad = ""; DataSet data = (DataSet)Session[DSArticuloPremio]; DataTable dt = data.Tables[0]; int intIdDespacho = Convert.ToInt32(_idpremio); for (int i = 0; i <= gvStock.Rows.Count - 1; i++) { CheckBox ckSelect = ((CheckBox)(gvStock.Rows[i].FindControl("chkSelec"))); if (ckSelect.Checked) { ckSelect.Checked = false; int cantStk = 0; int cant = 0; string str_ArtId = ((HiddenField)(gvStock.Rows[i].FindControl("hf_ArtId"))).Value; string str_Talla = ((HiddenField)(gvStock.Rows[i].FindControl("hf_Talla"))).Value; string str_Cantidad_Stock = ((HiddenField)(gvStock.Rows[i].FindControl("hf_Cantidad"))).Value; string str_Cantidad = ((TextBox)(gvStock.Rows[i].FindControl("txtCantidad"))).Text; string str_Precio = ((HiddenField)(gvStock.Rows[i].FindControl("hf_Precio"))).Value; cantStk = Convert.ToInt32(str_Cantidad_Stock); cant = Convert.ToInt32(str_Cantidad); DataRow[] _filas = dt.Select("Referencia='" + str_ArtId + "' and Talla='" + str_Talla + "'", "precio asc"); if (_filas.Length > 0) { string _articulo = _filas[0]["Referencia"].ToString(); string _talla = _filas[0]["Talla"].ToString(); listExistentes += "(Referencia:" + _articulo + "- Talla:" + _talla + "),"; } else { if (cant <= 0 || cant > cantStk) { strErrorCantidad += "(Referencia:" + str_ArtId + "- Talla:" + str_Talla + "),"; } else { strDataDetalle += "<row "; strDataDetalle += " Codigo=¿" + str_ArtId + "¿ "; strDataDetalle += " Talla=¿" + str_Talla + "¿ "; strDataDetalle += " Cantidad=¿" + str_Cantidad + "¿ "; strDataDetalle += " Precio=¿" + str_Precio + "¿ "; strDataDetalle += "/>"; } } } } if (listExistentes != "") { listExistentes = "No se agregaron articulos con tallas ya asociados al premio:" + listExistentes.TrimEnd(',') + "."; } if (strDataDetalle == "") { if (strErrorCantidad != "") { this.msnMessage.LoadMessage("Error : Debe ingresar cantidades validas (menor o igual al stock)." + strErrorCantidad.TrimEnd(',') + ".", ucMessage.MessageType.Error); } else { this.msnMessage.LoadMessage("Error : Debe elegir al menos un elemento de la lista." + listExistentes, ucMessage.MessageType.Error); } } else { Boolean resullt = Premio.InsertarArticuloPremio(_user._bas_id, _idpremio, strDataDetalle); if (resullt) { msnMessage.LoadMessage("Se agrego los articulos seleccionados." + listExistentes, UserControl.ucMessage.MessageType.Information); } else { this.msnMessage.LoadMessage("Error en el guardado de los articulos.", ucMessage.MessageType.Error); } } CargarArticulosPremio(); if (TxtItem.Text.Trim() != "") { initGrid(TxtItem.Text.Trim()); } }
public static IEnumerable <DateTime> CompeteciasProvisao(this Premio premio) { return(premio.Competencia.ObterCompetenciasProvisao(premio.FimVigencia)); }
private async Task ValidarPremioAnterior(Premio premio) { var premioAnterior = await _premios.ObterPremioAnterior(premio.ItemCertificadoApoliceId, premio.Numero); premio.ValidaPremioAnterior(premioAnterior); }
public static void CreatePremio(Premio premio) { List <SqlParameter> parametros = GenerarParametrosPremio(premio); DataBase.WriteInBase("Ingresarpremios", "SP", parametros); }
public static void DeletePremio(Premio premio) { List <SqlParameter> parametros = GenerarParametrosPremio(premio); DataBase.WriteInBase("Deletepremio", "SP", parametros); }
public VM_PCMFichasBase(FichasBase fichasBase) { Codigo = fichasBase.IdInterno; Pais = fichasBase.IdPais; LineaDeNegocio = fichasBase.IdLineaNegocio; TituloLargo = FormatText(fichasBase.Titulo); TituloCorto = FormatText(fichasBase.TituloDistribuidora); Subtitulo = FormatText(fichasBase.Subtitulo); Coeditorial = fichasBase.Coeditorial; LenguaPrincipal = fichasBase.Idioma; // LenguasSecundarias foreach (var item in fichasBase.FichasBaseIdiomasSecundarios.OrderBy(x => x.Orden)) { LenguasSecundarias += $"{item.IdIdioma},"; } if (!string.IsNullOrEmpty(LenguasSecundarias)) { LenguasSecundarias = LenguasSecundarias.Substring(0, LenguasSecundarias.Length - 1); } // Rol foreach (var item in fichasBase.RelFichasPersonas.OrderBy(x => x.Orden)) { Rol += $"{item.IdRol},"; } if (!string.IsNullOrEmpty(Rol)) { Rol = Rol.Substring(0, Rol.Length - 1); } // Persona // Autor foreach (var item in fichasBase.RelFichasPersonas.OrderBy(x => x.Orden)) { if (item.IdRol == "AUT") { Persona += $"{item.IdPersona},"; } //Autor += $"{item.IdPersona},"; else { Persona += $"{item.IdPersona},"; } } if (!string.IsNullOrEmpty(Persona)) { Persona = Persona.Substring(0, Persona.Length - 1); } if (!string.IsNullOrEmpty(Autor)) { Autor = Autor.Substring(0, Autor.Length - 1); } Edad = fichasBase.EdadMinima; ZonaGeografica = fichasBase.IdZonaGeografica; Comercializaciones = fichasBase.IdInternoOrigen; TipoMaterialEducativo = fichasBase.IdTipoMaterialEducativo; Coleccion = fichasBase.IdColeccion; Serie = fichasBase.IdSerie; N_Coleccion = fichasBase.NumeroColeccion; N_Serie = fichasBase.NumeroSerie; Genero = fichasBase.IdGenero; DRM = fichasBase.IdDrm; Accesibilidad = fichasBase.IdAccesibilidad; ISBN = fichasBase.Isbn; EAN13 = fichasBase.Ean13; Encuadernacion = fichasBase.TipoEncuadernacion; Estado = fichasBase.IdEstadoSap; EjemplaresPorCaja = fichasBase.NEjemplaresCaja; NumeroDePaginas = fichasBase.NumeroPaginas; Alto = fichasBase.Alto; Ancho = fichasBase.Ancho; Grosor = fichasBase.Grosor; Peso = fichasBase.Peso; PrecioSinImpuestos = fichasBase.PrecioSinIvae; PrecioConImpuestos = fichasBase.PrecioConIvae; Impuestos = fichasBase.IvaPorCiento; // Edicion foreach (var item in fichasBase.E2Tiradasedicion.OrderBy(x => x.NumeroEdicion)) { Edicion += $"{item.NumeroEdicion},"; } if (!string.IsNullOrEmpty(Edicion)) { Edicion = Edicion.Substring(0, Edicion.Length - 1); } // Fecha foreach (var item in fichasBase.E2Tiradasedicion.OrderBy(x => x.NumeroEdicion)) { if (item.Fecha.HasValue) { Edicion += $"{item.Fecha.Value:ddMMyyyy},"; } } if (!string.IsNullOrEmpty(Fecha)) { Fecha = Fecha.Substring(0, Fecha.Length - 1); } // Tirada foreach (var item in fichasBase.E2Tiradasedicion.OrderBy(x => x.NumeroEdicion)) { Tirada += $"{item.Tirada},"; } if (!string.IsNullOrEmpty(Tirada)) { Tirada = Tirada.Substring(0, Tirada.Length - 1); } // DepositoLegal foreach (var item in fichasBase.E2Tiradasedicion.OrderBy(x => x.NumeroEdicion)) { DepositoLegal += $"{item.DepositoLegal},"; } if (!string.IsNullOrEmpty(Tirada)) { DepositoLegal = DepositoLegal.Substring(0, DepositoLegal.Length - 1); } LineaDeProducto = fichasBase.CodLineaP; // Soporte foreach (var item in fichasBase.FichasBaseSoportes.OrderBy(x => x.Orden)) { Soporte += $"{item.IdSoporte},"; } if (!string.IsNullOrEmpty(Soporte)) { Soporte = Soporte.Substring(0, Soporte.Length - 1); } TipoMaterialSAP = fichasBase.IdTipoMaterialSap; GrupoArticulo = fichasBase.E2GruposArticulo.CodigoGrupo; UsoComercial = fichasBase.IdUsoComercial; Campana = fichasBase.IdCampaña; Proyecto = fichasBase.IdProyecto; ProyectoDeGestion = fichasBase.IdProyectoGestion; // JerarquiaTotal foreach (var item in fichasBase.E2RamasclasifFicha) { JerarquiaTotal += $"{item.IdClasificacion},"; } if (!string.IsNullOrEmpty(JerarquiaTotal)) { JerarquiaTotal = JerarquiaTotal.Substring(0, JerarquiaTotal.Length - 1); } // Sinopsis foreach (var item in fichasBase.FichasAplicacions) { Sinopsis += $"{FormatText(item.Sinopsis)},"; } if (!string.IsNullOrEmpty(Sinopsis)) { Sinopsis = Sinopsis.Substring(0, Sinopsis.Length - 1); } // Resumen foreach (var item in fichasBase.FichasAplicacions) { Resumen += $"{FormatText(item.Resumen)},"; } if (!string.IsNullOrEmpty(Resumen)) { Resumen = Resumen.Substring(0, Resumen.Length - 1); } // Indice foreach (var item in fichasBase.FichasAplicacions) { Indice += $"{FormatText(item.Indice)},"; } if (!string.IsNullOrEmpty(Indice)) { Indice = Indice.Substring(0, Indice.Length - 1); } // FraseDescriptivaEspecial_Ninos foreach (var item in fichasBase.RelFrasesDescriptivas) { if (item.IdPublicoObjetivo == 0) { FraseDescriptivaEspecial_Ninos += $"{FormatText(item.FraseDescriptiva)},"; } } if (!string.IsNullOrEmpty(FraseDescriptivaEspecial_Ninos)) { FraseDescriptivaEspecial_Ninos = FraseDescriptivaEspecial_Ninos.Substring(0, FraseDescriptivaEspecial_Ninos.Length - 1); } // FraseDescriptivaGeneral foreach (var item in fichasBase.RelFrasesDescriptivas) { if (item.IdPublicoObjetivo == 1) { FraseDescriptivaGeneral += $"{FormatText(item.FraseDescriptiva)},"; } } if (!string.IsNullOrEmpty(FraseDescriptivaGeneral)) { FraseDescriptivaGeneral = FraseDescriptivaGeneral.Substring(0, FraseDescriptivaGeneral.Length - 1); } // FraseDescriptivaEspecial_Chavales foreach (var item in fichasBase.RelFrasesDescriptivas) { if (item.IdPublicoObjetivo == 3) { FraseDescriptivaEspecial_Chavales += $"{FormatText(item.FraseDescriptiva)},"; } } if (!string.IsNullOrEmpty(FraseDescriptivaEspecial_Chavales)) { FraseDescriptivaEspecial_Chavales = FraseDescriptivaEspecial_Chavales.Substring(0, FraseDescriptivaEspecial_Chavales.Length - 1); } // Premio foreach (var item in fichasBase.E2FichasBasePremio.OrderBy(x => x.Anyo)) { Premio += $"{item.IdPremio},"; } if (!string.IsNullOrEmpty(Premio)) { Premio = Premio.Substring(0, Premio.Length - 1); } // PremioAno foreach (var item in fichasBase.E2FichasBasePremio.OrderBy(x => x.Anyo)) { PremioAno += $"{item.Anyo},"; } if (!string.IsNullOrEmpty(PremioAno)) { PremioAno = PremioAno.Substring(0, PremioAno.Length - 1); } // PremioComentarios foreach (var item in fichasBase.E2FichasBasePremio.OrderBy(x => x.Anyo)) { PremioComentarios += $"{FormatText(item.Comentarios)},"; } if (!string.IsNullOrEmpty(PremioComentarios)) { PremioComentarios = PremioComentarios.Substring(0, PremioComentarios.Length - 1); } // PalabraClave foreach (var item in fichasBase.FichasBaseTesauroes) { if (item.IdTipo == 1) { PalabraClave += $"{item.IdArbol},"; } } if (!string.IsNullOrEmpty(PalabraClave)) { PalabraClave = PalabraClave.Substring(0, PalabraClave.Length - 1); } // Valores (Tesauro) foreach (var item in fichasBase.FichasBaseTesauroes) { if (item.IdTipo == 3) { Valores += $"{item.IdArbol},"; } } if (!string.IsNullOrEmpty(Valores)) { Valores = Valores.Substring(0, Valores.Length - 1); } // ClasificacionCDU foreach (var item in fichasBase.FichasBaseCodigoCdus) { ClasificacionCDU += $"{item.IdCodigoCdu},"; } if (!string.IsNullOrEmpty(ClasificacionCDU)) { ClasificacionCDU = ClasificacionCDU.Substring(0, ClasificacionCDU.Length - 1); } // ClasificacionBIC foreach (var item in fichasBase.FichasBaseClasificacionEcis) { ClasificacionBIC += $"{item.IdcLasificacionEci},"; } if (!string.IsNullOrEmpty(ClasificacionBIC)) { ClasificacionBIC = ClasificacionBIC.Substring(0, ClasificacionBIC.Length - 1); } FechaAltaEnElSistema = fichasBase.FechaCreacion; FechaNecesidadDeInformacion = fichasBase.FechaNecesidadInformacion; FechaCreacionProyectoPS = fichasBase.FechaCreacionProyectoPs; FechaRecepcionDePrototipos = fichasBase.FechaRecepcionPrototipos; FechaPuestaEnMarchaDeFabricacion = fichasBase.FechaPuestaEnMarchaFabricacion; FechaFinProcesoInteriores = fichasBase.FechaFinProcesadoInteriores; FechaAltaEnLogistica = fichasBase.FechaAltaLogistica; FechaComercializacion = fichasBase.FechaDisponibilidadComercial; FechaDeCreacion = fichasBase.FechaCreacion; UsuarioDeCreacion = fichasBase.UsuarioCreacion; FechaDeModificacion = fichasBase.FechaActualizacion; UsuarioDeModificacion = fichasBase.UsuarioActualizacion; FechaDePublicacion = fichasBase.FechaPublicacion; UsuarioDePublicacion = fichasBase.UsuarioPublicacion; FechaDeDespublicacion = fichasBase.FechaRetirada; UsuarioDeDespublicacion = fichasBase.UsuarioRetirada; FechaLibroDisponibleEnWeb = fichasBase.FechaPublicacion; FechaLibroDisponibleEnDILVE = fichasBase.FechaCreacionDilve; TituloOriginal = fichasBase.TituloOriginal; EditorialOriginal = fichasBase.EditorialOriginal; IdiomaOriginal = fichasBase.IdiomaOriginal; // TitulosAfines foreach (var item in fichasBase.TitulosAfines.OrderBy(x => x.Orden)) { TitulosAfines += $"{item.IdObraAfin},"; } if (!string.IsNullOrEmpty(TitulosAfines)) { TitulosAfines = TitulosAfines.Substring(0, TitulosAfines.Length - 1); } // MaterialesAnejos foreach (var item in fichasBase.TitulosAnejoes.OrderBy(x => x.Orden)) { MaterialesAnejos += $"{item.IdObraAneja},"; } if (!string.IsNullOrEmpty(MaterialesAnejos)) { MaterialesAnejos = MaterialesAnejos.Substring(0, MaterialesAnejos.Length - 1); } // MaterialesReferencia foreach (var item in fichasBase.TFichasBaseMaterialesReferencias_IdInternoReferencia) { MaterialesReferencia += $"{item.IdInternoReferencia},"; } if (!string.IsNullOrEmpty(MaterialesReferencia)) { MaterialesReferencia = MaterialesReferencia.Substring(0, MaterialesReferencia.Length - 1); } // MaterialesAuxiliares // MaterialesAuxiliaresTipoDeDocumento foreach (var item in fichasBase.Documentoes) { MaterialesAuxiliares += $"{item.IdDocumento},"; MaterialesAuxiliaresTipoDeDocumento += $"{item.Tipo},"; if (item.TipoLink == false) { PathMaterialesAuxiliares += $"\\\\sesficazu02.gesm.net\\ecatprepro$\\Documentos_Materiales{item.Path},"; } else { PathMaterialesAuxiliares += $"{item.Path},"; } } if (!string.IsNullOrEmpty(MaterialesAuxiliares)) { MaterialesAuxiliares = MaterialesAuxiliares.Substring(0, MaterialesAuxiliares.Length - 1); } if (!string.IsNullOrEmpty(MaterialesAuxiliaresTipoDeDocumento)) { MaterialesAuxiliaresTipoDeDocumento = MaterialesAuxiliaresTipoDeDocumento.Substring(0, MaterialesAuxiliaresTipoDeDocumento.Length - 1); } if (!string.IsNullOrEmpty(PathMaterialesAuxiliares)) { PathMaterialesAuxiliares = PathMaterialesAuxiliares.Substring(0, PathMaterialesAuxiliares.Length - 1); } // FechaContrato // EstadoContrato // DisponibleVentaDerechos // Restrictivo // MasInformacion foreach (var item in fichasBase.TFichasBaseAmbitosCesions) { FechaContrato += $"{item.Fecha:ddMMyyyy},"; EstadoContrato += $"{item.IdEstado},"; DisponibleVentaDerechos += $"{Convert.ToInt16(item.DisponibleVentaDerechos)},"; Restrictivo += $"{Convert.ToInt16(item.EsRestrictivo)},"; ComentariosInternos += $"{item.ComentariosInternos},"; MasInformacion += $"{item.MasInformacion},"; //TerritoriosVenta //TerritoriosExcluidos foreach (var valor in item.TFichasBaseAmbitosCesionValores) { if (!valor.Exclusivo) { TerritoriosVenta += $"{valor.IdAmbitoCesion},"; } else { TerritoriosExcluidos += $"{valor.IdAmbitoCesion},"; } } //RestriccionesVenta foreach (var valor in item.TFichasBaseAmbitosCesionRestricciones) { RestriccionesVenta += $"{valor.IdAmbitoCesionRestriccion},"; } } if (!string.IsNullOrEmpty(FechaContrato)) { FechaContrato = FechaContrato.Substring(0, FechaContrato.Length - 1); } if (!string.IsNullOrEmpty(DisponibleVentaDerechos)) { DisponibleVentaDerechos = DisponibleVentaDerechos.Substring(0, DisponibleVentaDerechos.Length - 1); } if (!string.IsNullOrEmpty(Restrictivo)) { Restrictivo = Restrictivo.Substring(0, Restrictivo.Length - 1); } if (!string.IsNullOrEmpty(ComentariosInternos)) { ComentariosInternos = ComentariosInternos.Substring(0, ComentariosInternos.Length - 1); } if (!string.IsNullOrEmpty(MasInformacion)) { MasInformacion = MasInformacion.Substring(0, MasInformacion.Length - 1); } if (!string.IsNullOrEmpty(TerritoriosVenta)) { TerritoriosVenta = TerritoriosVenta.Substring(0, TerritoriosVenta.Length - 1); } if (!string.IsNullOrEmpty(TerritoriosExcluidos)) { TerritoriosExcluidos = TerritoriosExcluidos.Substring(0, TerritoriosExcluidos.Length - 1); } if (!string.IsNullOrEmpty(RestriccionesVenta)) { RestriccionesVenta = RestriccionesVenta.Substring(0, RestriccionesVenta.Length - 1); } if (!string.IsNullOrEmpty(EstadoContrato)) { EstadoContrato = EstadoContrato.Substring(0, EstadoContrato.Length - 1); } // MarcaPublicado MarcaPublicado = fichasBase.PublicableWeb; // Imagenes foreach (var item in fichasBase.TbFichasBaseImagenes) { // PortadasBajaResolucion if (item.IdTipoImagen == 1) { PortadasBajaResolucion += $"{item.Fichero},"; } // AltaResolucion if (item.IdTipoImagen == 2) { AltaResolucion += $"{item.Fichero},"; } // Interiores if (item.IdTipoImagen == 3) { Interiores += $"{item.Fichero},"; } // Bodegones if (item.IdTipoImagen == 5) { Bodegones += $"{item.Fichero},"; } } if (!string.IsNullOrEmpty(PortadasBajaResolucion)) { PortadasBajaResolucion = PortadasBajaResolucion.Substring(0, PortadasBajaResolucion.Length - 1); } if (!string.IsNullOrEmpty(AltaResolucion)) { AltaResolucion = AltaResolucion.Substring(0, AltaResolucion.Length - 1); } if (!string.IsNullOrEmpty(Interiores)) { Interiores = Interiores.Substring(0, Interiores.Length - 1); } if (!string.IsNullOrEmpty(Bodegones)) { Bodegones = Bodegones.Substring(0, Bodegones.Length - 1); } }
public UiContainer DeletePremio(string objUiContainer) { var uiContainer = UiContainer.Build(objUiContainer); var txtId = uiContainer.GetCtrlModel <CtrlInputModel>("txtId"); var txtNombre = uiContainer.GetCtrlModel <CtrlInputModel>("txtNombre"); var txtDescripcion = uiContainer.GetCtrlModel <CtrlInputModel>("txtDescripcion"); var btnGuardar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnGuardar"); var btnEliminar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnEliminar"); var btnActualizar = uiContainer.GetCtrlModel <CtrlButtonModel>("btnActualizar"); var tblPremios = uiContainer.GetCtrlModel <CtrlTableModel>("tblPremios"); var mu = new PremioManagement(); var premio = new Premio() { IdPremio = Convert.ToInt32(txtId.Value) }; mu.DeletePremio(premio); var list = mu.RetrieveAllPremios <Premio>(); tblPremios.RowList.Clear(); foreach (var act in list) { tblPremios.RowList.Add(new List <string>() { act.IdPremio.ToString(), act.NombrePremio, act.DescripcionPremio }); } txtId.Value = ""; txtId.Disabled = true; txtNombre.Value = ""; txtDescripcion.Value = ""; btnGuardar.Value = "Guardar"; btnGuardar.ButtonType = "info"; btnGuardar.Disabled = false; btnGuardar.EvtOnClick = "createPremio()"; btnEliminar.Value = "Eliminar"; btnEliminar.ButtonType = "info"; btnEliminar.Disabled = true; btnEliminar.EvtOnClick = " "; btnActualizar.Value = "Actualizar"; btnActualizar.ButtonType = "info"; btnActualizar.Disabled = true; btnActualizar.EvtOnClick = " "; uiContainer.UpdateModel(tblPremios); uiContainer.UpdateModel(txtId); uiContainer.UpdateModel(txtNombre); uiContainer.UpdateModel(txtDescripcion); uiContainer.UpdateModel(btnGuardar); uiContainer.UpdateModel(btnEliminar); uiContainer.UpdateModel(btnActualizar); return(uiContainer); }
private void DiminuiQuantidade(Premio premio) { premio.Quantidade--; db.Entry(premio).State = EntityState.Modified; db.SaveChanges(); }