public DataTable SearchCount(AlimentoNutrienteEntityFilter EntityFilter) { DbCommand storedProcCommand = this.DataBase.GetStoredProcCommand("AlimentoNutriente_SearchCount"); try { using (storedProcCommand) { this.DataBase.AddInParameter(storedProcCommand, "WhereExtendido", DbType.String, (object)EntityFilter.WhereExtendido); this.DataBase.AddInParameter(storedProcCommand, "OrdenDeRegistros", DbType.String, (object)EntityFilter.OrderBy); this.DataBase.AddInParameter(storedProcCommand, "OpeAlimentoId", DbType.String, (object)ConvertirOperadores.ConvertirOperador(EntityFilter.OpeAlimentoId)); this.DataBase.AddInParameter(storedProcCommand, "AlimentoId", DbType.Int32, (object)EntityFilter.AlimentoId); this.DataBase.AddInParameter(storedProcCommand, "OpeNutrienteId", DbType.String, (object)ConvertirOperadores.ConvertirOperador(EntityFilter.OpeNutrienteId)); this.DataBase.AddInParameter(storedProcCommand, "NutrienteId", DbType.Int32, (object)EntityFilter.NutrienteId); this.DataBase.AddInParameter(storedProcCommand, "OpeCantidad", DbType.String, (object)ConvertirOperadores.ConvertirOperador(EntityFilter.OpeCantidad)); this.DataBase.AddInParameter(storedProcCommand, "Cantidad", DbType.Decimal, (object)EntityFilter.Cantidad); this.DataBase.AddInParameter(storedProcCommand, "OpeFntID", DbType.String, (object)ConvertirOperadores.ConvertirOperador(EntityFilter.OpeFntID)); this.DataBase.AddInParameter(storedProcCommand, "FntID", DbType.AnsiString, (object)EntityFilter.FntID); return(this.DataBase.ExecuteDataSet(storedProcCommand).Tables[0]); } } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ItemCommand_lvGeneric(object sender, ListViewCommandEventArgs e) { try { String[] arguments = e.CommandArgument.ToString().Split('|'); Int32 alimentoId = int.Parse("0" + arguments[0]); string alimento = arguments[1]; if (e.CommandName.ToString().ToUpper() == "ELIMINAR") { //-- Si existe la realcion de al menos un registro, //-- NO SE PUEDE ELIMINAR EL ALIMENTO //-------------------------------------------------- AlimentoNutrienteBus busAliNutriente = new AlimentoNutrienteBus(); AlimentoNutrienteEntityFilter filterAliNutriente = new AlimentoNutrienteEntityFilter(); filterAliNutriente.OpeAlimentoId = Helpers.Operators.Operadores_Int.Igual; filterAliNutriente.AlimentoId = alimentoId; DataTable dtControl = busAliNutriente.Search(filterAliNutriente); if (dtControl != null && dtControl.Rows.Count > 0) { ltrMessage.Text = string.Format("<span style='color:red;'>No es posible eliminar el Alimento [<b>{0}</b>] ya que tiene Nutrientes asignados!</span>", alimento); ltrMessage.Visible = true; return; } EncuestaAlimentoBus busEncuestaAli = new EncuestaAlimentoBus(); EncuestaAlimentoEntityFilter filterEncuestaAli = new EncuestaAlimentoEntityFilter(); filterEncuestaAli.OpeAlimentoId = Helpers.Operators.Operadores_Int.Igual; filterEncuestaAli.AlimentoId = alimentoId; dtControl = busEncuestaAli.Search(filterEncuestaAli); if (dtControl != null && dtControl.Rows.Count > 0) { ltrMessage.Text = string.Format("<span style='color:red;'>No es posible eliminar el Alimento [<b>{0}</b>] ya existe en ciertas Encuestas!</span>", alimento); ltrMessage.Visible = true; return; } //-------------------------------------------------- //-- ELIMINO el ALIMENTO //-------------------------------------------------- keyAlimento.AlimentoId = alimentoId; busAlimento.Delete(keyAlimento); lvGeneric.DataBind(); ltrMessage.Text = string.Format("<span style='color:red;'>El alimento {0} fue Eliminado!</span>", alimento); ltrMessage.Visible = true; } } catch (Exception ex) { Logger.LogExceptionStatic(ex); } }
public DataTable SearchCount(AlimentoNutrienteEntityFilter EntityFilter) { try { return(this.CreateDataAccess().SearchCount(EntityFilter)); } catch (Exception ex) { Helpers.Logger.Logger.LogExceptionStatic(ex); throw ex; } }
public AlimentoNutrienteEntityInfo.AlimentoNutrienteEntityInfoList Search(AlimentoNutrienteEntityFilter EntityFilter, bool NoUtilizar) { try { return(this.DataTableToListOfEntityInfo(this.CreateDataAccess().Search(EntityFilter))); } catch (Exception ex) { Helpers.Logger.Logger.LogExceptionStatic(ex); throw ex; } }
public void Search(AlimentoNutrienteEntityFilter EntityFilter, out AlimentoNutrienteEntityInfo.AlimentoNutrienteEntityInfoList listaAGenerar) { try { listaAGenerar = this.DataTableToListOfEntityInfo(this.CreateDataAccess().Search(EntityFilter)); } catch (Exception ex) { Helpers.Logger.Logger.LogExceptionStatic(ex); throw ex; } }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ItemCommand_lvGeneric(object sender, ListViewCommandEventArgs e) { try { String[] arguments = e.CommandArgument.ToString().Split('|'); Int32 nutrienteId = int.Parse("0" + arguments[0]); string nutriente = arguments[1]; if (e.CommandName.ToString().ToUpper() == "ELIMINAR") { //-- Si existe la relacion de al menos un registro, //-- NO SE PUEDE ELIMINAR EL NUTRIENTE //-------------------------------------------------- AlimentoNutrienteBus busAliNutriente = new AlimentoNutrienteBus(); AlimentoNutrienteEntityFilter filterAliNutriente = new AlimentoNutrienteEntityFilter(); filterAliNutriente.OpeNutrienteId = Helpers.Operators.Operadores_Int.Igual; filterAliNutriente.NutrienteId = nutrienteId; DataTable dtControl = busAliNutriente.Search(filterAliNutriente); if (dtControl != null && dtControl.Rows.Count > 0) { ltrMessage.Text = string.Format("<span style='color:red;'>No es posible eliminar el Nutriente [<b>{0}</b>] ya que tiene Alimentos asignados!</span>", nutriente); ltrMessage.Visible = true; return; } //-- Elimino el nutriente //-------------------------------------------------- keyNutriente.NutrienteId = nutrienteId; busNutriente.Delete(keyNutriente); lvGeneric.DataBind(); ltrMessage.Text = string.Format("<span style='color:red;'>El nutriente [<b>{0}</b>] fue Eliminado!</span>", nutriente); ltrMessage.Visible = true; } } catch (Exception ex) { Logger.LogExceptionStatic(ex); } }