public static servicios Select_Record(servicios serviciosPara) { servicios servicios = new servicios(); SqlConnection connection = hospitalData.GetConnection(); string selectProcedure = "[serviciosSelect]"; SqlCommand selectCommand = new SqlCommand(selectProcedure, connection); selectCommand.CommandType = CommandType.StoredProcedure; selectCommand.Parameters.AddWithValue("@Id_servicio", serviciosPara.Id_servicio); try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { servicios.Id_servicio = System.Convert.ToInt32(reader["Id_servicio"]); servicios.Nombre_servicio = reader["Nombre_servicio"] is DBNull ? null : reader["Nombre_servicio"].ToString(); } else { servicios = null; } reader.Close(); } catch (SqlException) { return(servicios); } finally { connection.Close(); } return(servicios); }
public void CargarServicios() { List <servicios> lista = new List <servicios>(); DAL.HospitalDataSetTableAdapters.H2_Servicio_ListaTableAdapter adapter = new DAL.HospitalDataSetTableAdapters.H2_Servicio_ListaTableAdapter(); DAL.HospitalDataSet.H2_Servicio_ListaDataTable aTable = adapter.GetData(null, ""); cbo_cama.Text = ""; cbo_sala.Text = ""; lista.Add(new servicios { id = -1, descripcion = "" }); foreach (DAL.HospitalDataSet.H2_Servicio_ListaRow row in aTable.Rows) { servicios d = new servicios(); d.id = row.Id; d.descripcion = row.Descripcion; if (row.state_id == 1) { lista.Add(d); } } cbo_servicio.DataSource = lista; }
public static List <servicios> List() { List <servicios> serviciosList = new List <servicios>(); SqlConnection connection = hospitalData.GetConnection(); String selectProcedure = "[hospitales_servicios_servicios18Select]"; SqlCommand selectCommand = new SqlCommand(selectProcedure, connection); try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(); servicios servicios = new servicios(); while (reader.Read()) { servicios = new servicios(); servicios.Id_servicio = System.Convert.ToInt32(reader["Id_servicio"]); servicios.Nombre_servicio = Convert.ToString(reader["Nombre_servicio"]); serviciosList.Add(servicios); } reader.Close(); } catch (SqlException) { return(serviciosList); } finally { connection.Close(); } return(serviciosList); }
public ActionResult DeleteConfirmed(int id) { servicios servicios = db.servicios.Find(id); db.servicios.Remove(servicios); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,fecharegistro,cctv,telefonia,alarmas,correo,antivirus,respaldoaplicaciones,usuarioswifi,internetcarga,internetdescarga")] servicios servicios) { if (ModelState.IsValid) { db.Entry(servicios).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(servicios)); }
public string AddServiceService(servicios service) { if (data.AddService(service)) { return("Servicio agregado con éxito"); } else { return("Ha ocurrido un error. Inténtelo más tarde"); } }
public string UpdateServiceService(servicios service) { if (data.UpdateService(service)) { return("Servicio actualizado correctamente"); } else { return("Ha ocurrido un error. Inténtelo más tarde"); } }
private async void reiniciarFormulario() { this.Refresh(); this.Controls.Clear(); this.InitializeComponent(); this.Cita = new citaModel(); CitaBase = new citas(); Servicio = new servicios(); await obtenerMaxFolio(); txtcita.Focus(); }
public bool AddService(servicios service) { dbContext.servicios.Add(service); if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
// Actualizar registros public ActionResult actualizarServicio(String nombre, int precio, String prop, int id) { //int precio1 = Convert.ToInt32(precio); servicios serv = db.servicios.FirstOrDefault(x => x.Id_servicio == id); serv.Servicio = nombre; serv.Precio = precio; serv.Propiedades = prop; db.SaveChanges(); ViewBag.result = "Record Inserted Successfully!"; return(RedirectToAction("Indice", "Home")); }
public static bool Update(servicios oldservicios, servicios newservicios) { SqlConnection connection = hospitalData.GetConnection(); string updateProcedure = "[serviciosUpdate]"; SqlCommand updateCommand = new SqlCommand(updateProcedure, connection); updateCommand.CommandType = CommandType.StoredProcedure; if (newservicios.Nombre_servicio != null) { updateCommand.Parameters.AddWithValue("@NewNombre_servicio", newservicios.Nombre_servicio); } else { updateCommand.Parameters.AddWithValue("@NewNombre_servicio", DBNull.Value); } updateCommand.Parameters.AddWithValue("@OldId_servicio", oldservicios.Id_servicio); if (oldservicios.Nombre_servicio != null) { updateCommand.Parameters.AddWithValue("@OldNombre_servicio", oldservicios.Nombre_servicio); } else { updateCommand.Parameters.AddWithValue("@OldNombre_servicio", DBNull.Value); } updateCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int); updateCommand.Parameters["@ReturnValue"].Direction = ParameterDirection.Output; try { connection.Open(); updateCommand.ExecuteNonQuery(); int count = System.Convert.ToInt32(updateCommand.Parameters["@ReturnValue"].Value); if (count > 0) { return(true); } else { return(false); } } catch (SqlException) { return(false); } finally { connection.Close(); } }
//Realizar Registros public ActionResult altaServicio(String nombre, int precio, String prop) { servicios serv = new servicios(); serv.Servicio = nombre; serv.Precio = precio; serv.Propiedades = prop; db.servicios.Add(serv); db.SaveChanges(); ViewBag.result = "Record Inserted Successfully!"; return(RedirectToAction("Indice", "Home")); }
public bool DeleteService(int id) { servicios service = dbContext.servicios.Where(s => s.idservicios == id).FirstOrDefault(); dbContext.servicios.Remove(service); if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
// GET: servicios/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } servicios servicios = db.servicios.Find(id); if (servicios == null) { return(HttpNotFound()); } return(View(servicios)); }
public bool UpdateService(servicios serviceToUpdate) { servicios service = dbContext.servicios.Where(s => s.idservicios == serviceToUpdate.idservicios).FirstOrDefault(); service.descripcion = serviceToUpdate.descripcion; service.imagen = serviceToUpdate.imagen; service.nombre = serviceToUpdate.nombre; if (dbContext.SaveChanges() == 1) { return(true); } else { return(false); } }
public async Task <servicios> crearNuevo(servicios servicio) { using (var db = new estetica_lupitaEntities()) { var response = db.servicios.Add(servicio); await db.SaveChangesAsync(); await auditCtrl.auditar(new auditorias { descripcion = $"Crear servicio {servicio.sv_descripcion}", fecha = DateTime.Now, hora = DateTime.Now.TimeOfDay, usuario = global.LoggedUser.usuario_name }); return(response); } }
public ActionResult Create([Bind(Include = "Nombre_servicio" )] servicios servicios) { if (ModelState.IsValid) { bool bSucess = false; bSucess = serviciosData.Add(servicios); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Insert"); } } return(View(servicios)); }
public void CargarSala(int Servicio) { List <servicios> lista = new List <servicios>(); DAL.HospitalDataSetTableAdapters.H2_Sala_ListaTableAdapter adapter = new DAL.HospitalDataSetTableAdapters.H2_Sala_ListaTableAdapter(); DAL.HospitalDataSet.H2_Sala_ListaDataTable aTable = adapter.GetData(null, Servicio); foreach (DAL.HospitalDataSet.H2_Sala_ListaRow row in aTable.Rows) { servicios d = new servicios(); d.id = row.Id; d.descripcion = row.Descripcion; if (row.state_id == 1) { lista.Add(d); } } cbo_sala.DataSource = lista; }
public async Task <servicios> actualizar(servicios servicio) { using (var db = new estetica_lupitaEntities()) { var response = await db.servicios.FindAsync(servicio.idservicio); response.sv_descripcion = servicio.sv_descripcion; response.sv_precio = servicio.sv_precio; await db.SaveChangesAsync(); await auditCtrl.auditar(new auditorias { descripcion = $"Actualizar servicio {servicio.sv_descripcion}", fecha = DateTime.Now, hora = DateTime.Now.TimeOfDay, usuario = global.LoggedUser.usuario_name }); return(response); } }
public static bool Add(servicios servicios) { SqlConnection connection = hospitalData.GetConnection(); string insertProcedure = "[serviciosInsert]"; SqlCommand insertCommand = new SqlCommand(insertProcedure, connection); insertCommand.CommandType = CommandType.StoredProcedure; if (servicios.Nombre_servicio != null) { insertCommand.Parameters.AddWithValue("@Nombre_servicio", servicios.Nombre_servicio); } else { insertCommand.Parameters.AddWithValue("@Nombre_servicio", DBNull.Value); } insertCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int); insertCommand.Parameters["@ReturnValue"].Direction = ParameterDirection.Output; try { connection.Open(); insertCommand.ExecuteNonQuery(); int count = System.Convert.ToInt32(insertCommand.Parameters["@ReturnValue"].Value); if (count > 0) { return(true); } else { return(false); } } catch (SqlException) { return(false); } finally { connection.Close(); } }
public ActionResult DeleteConfirmed( Int32?Id_servicio ) { servicios servicios = new servicios(); servicios.Id_servicio = System.Convert.ToInt32(Id_servicio); servicios = serviciosData.Select_Record(servicios); bool bSucess = false; bSucess = serviciosData.Delete(servicios); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Delete"); } return(null); }
public ActionResult Edit(servicios servicios) { servicios oservicios = new servicios(); oservicios.Id_servicio = System.Convert.ToInt32(servicios.Id_servicio); oservicios = serviciosData.Select_Record(servicios); if (ModelState.IsValid) { bool bSucess = false; bSucess = serviciosData.Update(oservicios, servicios); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Update"); } } return(View(servicios)); }
// GET: /servicios/Delete/<id> public ActionResult Delete( Int32?Id_servicio ) { if ( Id_servicio == null ) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } servicios servicios = new servicios(); servicios.Id_servicio = System.Convert.ToInt32(Id_servicio); servicios = serviciosData.Select_Record(servicios); if (servicios == null) { return(HttpNotFound()); } return(View(servicios)); }
public ServiciosAsociadosDTModeloVista() { Titulo = new ExtendedEntry() { Keyboard = Keyboard.Text, //IsAutocapitalize = true, Placeholder = "Alias de servicio", PlaceholderColor = Color.FromHex("D9D9D9"), FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.FromHex("4D4D4D"), BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.FillAndExpand, HasBorder = false, FontSize = App.DisplayScreenWidth / 25.066666666666667 }; //Titulo.SetBinding(ExtendedEntry.TextColorProperty, "Color"); Titulo.SetBinding(ExtendedEntry.TextProperty, "alias"); Titulo.Focused += (sender, e) => { Titulo.TextChanged += Titulo_TextChanged; }; Titulo.Unfocused += (sender, e) => { Titulo.TextChanged -= Titulo_TextChanged; servicios ContextoActual = (servicios)this.BindingContext; /*if (ContextoActual != null && !string.IsNullOrEmpty(ContextoActual.name)) * App.Database.InsertLista(ContextoActual);*/ }; Label Proveedor = new Label { BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Proveedor.SetBinding(Label.TextProperty, "proveedor"); Label Categoria = new Label { BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Categoria.SetBinding(Label.TextProperty, "categoria"); Label Saldo = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 31.333333333333333) }; Saldo.SetBinding(Label.TextProperty, "saldo"); Label Aviso = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Aviso.SetBinding(Label.TextProperty, "aviso"); Label Vencimiento = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Vencimiento.SetBinding(Label.TextProperty, "vencimiento"); Header = new Grid { Padding = new Thickness((App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 16.347826086956522), (App.DisplayScreenWidth / 10.742857142857143), 0), ColumnSpacing = App.DisplayScreenWidth / 32, RowSpacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) } } }; Header.Children.Add(Titulo, 0, 0); Header.Children.Add(Proveedor, 0, 1); Header.Children.Add(Categoria, 0, 2); Footer = new Grid { Padding = new Thickness((App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 16.347826086956522), (App.DisplayScreenWidth / 10.742857142857143), 0), RowSpacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; Footer.Children.Add(Saldo, 0, 0); Footer.Children.Add(Aviso, 0, 1); Footer.Children.Add(Vencimiento, 0, 2); Grid Contenido = new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 0, //Padding = App.DisplayScreenWidth/21.333333333333333, RowSpacing = App.DisplayScreenWidth / 26.666666666666667, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; Contenido.Children.Add(Header, 0, 0); Contenido.Children.Add(Footer, 0, 0); View = new Grid { Padding = new Thickness((App.DisplayScreenWidth / 12.533333333333333), (App.DisplayScreenWidth / 37.6), 0, (App.DisplayScreenWidth / 37.6)), Children = { new Frame { Padding = 0, HeightRequest = App.DisplayScreenWidth / 2.506666666666667, BackgroundColor = Color.Transparent, HasShadow = true, HorizontalOptions = LayoutOptions.FillAndExpand, Content = new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = 0, Children = { new Image { Source = "iServicioBackground", Aspect = Aspect.Fill }, Contenido } } } } }; }
public ServiciosAsociadosDTModeloVista() { Titulo = new ExtendedEntry() { Margin = 0, IsEnabled = false, Keyboard = Keyboard.Text, Placeholder = "Alias de servicio", PlaceholderColor = Color.FromHex("D9D9D9"), FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.FromHex("4D4D4D"), BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.FillAndExpand, HasBorder = false, FontSize = App.DisplayScreenWidth / 25.066666666666667 }; Titulo.SetBinding(ExtendedEntry.TextProperty, "alias"); Titulo.Focused += (sender, e) => { Titulo.TextChanged += Titulo_TextChanged; }; Titulo.Unfocused += (sender, e) => { Titulo.TextChanged -= Titulo_TextChanged; servicios ContextoActual = (servicios)this.BindingContext; /*if (ContextoActual != null && !string.IsNullOrEmpty(ContextoActual.name)) * App.Database.InsertLista(ContextoActual);*/ }; IconView Editar = new IconView { Source = "iEditar", Foreground = Color.FromHex("BFBFBF"), WidthRequest = App.DisplayScreenWidth / 25.066666666666667, HeightRequest = App.DisplayScreenHeight / 25.066666666666667 }; TapGestureRecognizer EditarTAP = new TapGestureRecognizer { NumberOfTapsRequired = 1 }; EditarTAP.Tapped += (sender, e) => { if (Titulo.IsEnabled) { Titulo.Unfocus(); Titulo.IsEnabled = false; } else { Titulo.IsEnabled = true; Titulo.Focus(); } }; Editar.GestureRecognizers.Add(EditarTAP); Label Proveedor = new Label { BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Proveedor.SetBinding(Label.TextProperty, "proveedor"); Image iProveedor = new Image { Source = "iEEGSA", HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, WidthRequest = App.DisplayScreenWidth / 3.159663865546218, HeightRequest = App.DisplayScreenWidth / 6.121784435037447, Aspect = Aspect.Fill }; Label Categoria = new Label { BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Categoria.SetBinding(Label.TextProperty, "categoria"); Label Saldo = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 31.333333333333333) }; Saldo.SetBinding(Label.TextProperty, "saldo"); Label Aviso = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Aviso.SetBinding(Label.TextProperty, "aviso"); Label Vencimiento = new Label { HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent, FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null), TextColor = Color.FromHex("4D4D4D"), FontSize = (App.DisplayScreenWidth / 37.6) }; Vencimiento.SetBinding(Label.TextProperty, "vencimiento"); Header = new Grid { Padding = 0, ColumnSpacing = App.DisplayScreenWidth / 37.6, RowSpacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) } } }; Header.Children.Add(Titulo, 0, 0); Header.Children.Add(Proveedor, 0, 1); Header.Children.Add(Categoria, 0, 2); Header.Children.Add(Editar, 1, 0); Footer = new Grid { Padding = 0, RowSpacing = 0, VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; Footer.Children.Add(Saldo, 0, 0); Footer.Children.Add(Aviso, 0, 1); Footer.Children.Add(Vencimiento, 0, 2); Grid Contenido = new Grid { Padding = new Thickness((App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 16.347826086956522), (App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 18.8)), HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = App.DisplayScreenWidth / 26.666666666666667, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; Contenido.Children.Add(Header, 0, 0); Contenido.Children.Add(new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, Children = { iProveedor, Footer } }, 0, 1); View = new Grid { Padding = new Thickness((App.DisplayScreenWidth / 12.533333333333333), (App.DisplayScreenWidth / 37.6), 0, (App.DisplayScreenWidth / 37.6)), Children = { new Frame { Padding = 0, HeightRequest = App.DisplayScreenWidth / 2.211764705882353, BackgroundColor = Color.Transparent, HasShadow = true, HorizontalOptions = LayoutOptions.FillAndExpand, Content = new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = 0, Children = { new Image { Source = "iServicioBackground", Aspect = Aspect.Fill }, Contenido } } } } }; }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ REIMPRIMIR REPORTE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public ActionResult ReimprimirReport(int id) { contratos cont = new contratos(); cont = db.contratos.SqlQuery("SELECT * FROM contratos WHERE Id_Contrato=" + id).FirstOrDefault(); //**************************************************************************************************************************************************** //consulta jardin; List <jardin> jard = db.jardin.SqlQuery("SELECT * FROM jardin").ToList(); List <contratos> c = db.contratos.SqlQuery("SELECT * FROM contratos where Id_Contrato=" + id).ToList(); var innerJoinQuery = from jardin in jard join contratos in c on jardin.NomJar equals contratos.Jardin select new { contratos = contratos.Jardin, jardin = jardin.Direccion }; var result = ""; foreach (var item in innerJoinQuery) { result = item.contratos + ", " + item.jardin; } //Consulta Servicios List <servicios> serv = db.servicios.SqlQuery("SELECT * FROM servicios").ToList(); var var1 = cont.Servicios; String[] var2 = var1.Split(','); int i = 0; var val1 = ""; var val2 = ""; var val3 = ""; var val4 = ""; var val5 = ""; var val6 = ""; var val7 = ""; var val8 = ""; var val9 = ""; var val10 = ""; var val11 = ""; var val12 = ""; var val13 = ""; var val14 = ""; var val15 = ""; var val16 = ""; var val17 = ""; var val18 = ""; var val19 = ""; var val20 = ""; var cont1 = ""; var cont2 = ""; var cont3 = ""; var cont4 = ""; var cont5 = ""; var cont6 = ""; var cont7 = ""; var cont8 = ""; var cont9 = ""; var cont10 = ""; var cont11 = ""; var cont12 = ""; var cont13 = ""; var cont14 = ""; var cont15 = ""; var cont16 = ""; var cont17 = ""; var cont18 = ""; var cont19 = ""; var cont20 = ""; //serv var serv1 = ""; var serv2 = ""; var serv3 = ""; var serv4 = ""; var serv5 = ""; var serv6 = ""; var serv7 = ""; var serv8 = ""; var serv9 = ""; var serv10 = ""; var serv11 = ""; var serv12 = ""; var serv13 = ""; var serv14 = ""; var serv15 = ""; var serv16 = ""; var serv17 = ""; var serv18 = ""; var serv19 = ""; var serv20 = ""; for (i = 0; i < var2.Length; i++) { var prba = from servicios in serv join contratos in var2[i] on servicios.Servicio equals var2[i] select new { contratos = var2[i], servicios = servicios.Propiedades }; foreach (var item in prba) { if (i == 0) { cont1 = item.contratos; val1 = item.servicios; serv1 = "***" + " " + "Servicio de" + " " + cont1 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val1; } else if (i == 1) { cont2 = item.contratos; val2 = item.servicios; serv2 = "***" + " " + "Servicio de" + " " + cont2 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val2; } else if (i == 2) { cont3 = item.contratos; val3 = item.servicios; serv3 = "***" + " " + "Servicio de" + " " + cont3 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val3; } else if (i == 3) { cont4 = item.contratos; val4 = item.servicios; serv4 = "***" + " " + "Servicio de" + " " + cont4 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val4; } else if (i == 4) { cont5 = item.contratos; val5 = item.servicios; serv5 = "***" + " " + "Servicio de" + " " + cont5 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val5; } else if (i == 5) { cont6 = item.contratos; val6 = item.servicios; serv6 = "***" + " " + "Servicio de" + " " + cont6 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val6; } else if (i == 6) { cont7 = item.contratos; val7 = item.servicios; serv7 = "***" + " " + "Servicio de" + " " + cont7 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val7; } else if (i == 7) { cont8 = item.contratos; val8 = item.servicios; serv8 = "***" + " " + "Servicio de" + " " + cont8 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val8; } else if (i == 8) { cont9 = item.contratos; val9 = item.servicios; serv9 = "***" + " " + "Servicio de" + " " + cont9 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val9; } else if (i == 9) { cont10 = item.contratos; val10 = item.servicios; serv10 = "***" + " " + "Servicio de" + " " + cont10 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val10; } else if (i == 10) { cont11 = item.contratos; val11 = item.servicios; serv11 = "***" + " " + "Servicio de" + " " + cont11 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val11; } else if (i == 11) { cont12 = item.contratos; val12 = item.servicios; serv12 = "***" + " " + "Servicio de" + " " + cont12 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val12; } else if (i == 12) { cont13 = item.contratos; val13 = item.servicios; serv13 = "***" + " " + "Servicio de" + " " + cont13 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val13; } else if (i == 13) { cont14 = item.contratos; val14 = item.servicios; serv14 = "***" + " " + "Servicio de" + " " + cont14 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val14; } else if (i == 14) { cont15 = item.contratos; val15 = item.servicios; serv15 = "***" + " " + "Servicio de" + " " + cont15 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val15; } else if (i == 15) { cont16 = item.contratos; val16 = item.servicios; serv16 = "***" + " " + "Servicio de" + " " + cont16 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val16; } else if (i == 16) { cont17 = item.contratos; val17 = item.servicios; serv17 = "***" + " " + "Servicio de" + " " + cont17 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val17; } else if (i == 17) { cont18 = item.contratos; val18 = item.servicios; serv18 = "***" + " " + "Servicio de" + " " + cont18 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val18; } else if (i == 18) { cont19 = item.contratos; val19 = item.servicios; serv19 = "***" + " " + "Servicio de" + " " + cont19 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val19; } else if (i == 19) { cont20 = item.contratos; val20 = item.servicios; serv20 = "***" + " " + "Servicio de" + " " + cont20 + ", en" + " " + result + ". " + "\n" + "Incluye el siguiente servicio: " + "\n" + val20; } } } /*var result2 = val1 + "\n" + "\n" + val2 + "\n" + "\n" + val3 + "\n" + "\n" + val4 + "\n" + "\n" + val5 + "\n" + "\n" + val6 + "\n" + "\n" + * val7 + "\n" + "\n" + val8 + "\n" + "\n" + val9 + "\n" + "\n" + val10 + "\n" + "\n" + val11 + "\n" + "\n" + val12 + "\n" + "\n" + * val13 + "\n" + "\n" + val14 + "\n" + "\n" + val15 + "\n" + "\n" + val16 + "\n" + "\n" + val17 + "\n" + "\n" + val18 + "\n" + "\n" + * val19 + "\n" + "\n" + val20;*/ var servic = serv1.ToUpper() + "\n" + "\n" + serv2.ToUpper() + "\n" + "\n" + serv3.ToUpper() + "\n" + "\n" + serv4.ToUpper() + "\n" + "\n" + serv5.ToUpper() + "\n" + "\n" + serv6.ToUpper() + "\n" + "\n" + serv7.ToUpper() + "\n" + "\n" + serv8.ToUpper() + "\n" + "\n" + serv9.ToUpper() + "\n" + "\n" + serv10.ToUpper() + "\n" + "\n" + serv11.ToUpper() + "\n" + "\n" + serv12.ToUpper() + "\n" + "\n" + serv13.ToUpper() + "\n" + "\n" + serv14.ToUpper() + "\n" + "\n" + serv15.ToUpper() + "\n" + "\n" + serv16.ToUpper() + "\n" + "\n" + serv17.ToUpper() + "\n" + "\n" + serv18.ToUpper() + "\n" + "\n" + serv19.ToUpper() + "\n" + "\n" + serv20.ToUpper(); //******************************************************************************************************************************************************************** DataTable dt = new DataTable("Contratos"); dt.Columns.Add("IdContrato"); dt.Columns.Add("NombreCliente"); dt.Columns.Add("NombreJardin"); dt.Columns.Add("Fecha"); dt.Columns.Add("Servicios"); dt.Columns.Add("Precio"); dt.Columns.Add("FormaPago"); dt.Columns.Add("Detalles"); dt.Columns.Add("Encabezado"); ReportDocument rd = new ReportDocument(); rd.Load(Server.MapPath("~/Report/CrystalReport1.rpt")); servicios servv = new servicios(); var varServ = cont.Servicios; var prec = enletras(cont.Precio); var Detalles = ""; //CARGA DE TEXTO AL REPORTE /* var reFinal = "Servicio de"+" "+varServ + ", en"+" "+ result +". " ; * var Detalles = "Incluye el siguiente servicio: " + "\n" + res; * var ejemplo= "Servicio de" + " " + varServ + ", en" + " " + result + ". "+"\n"+"\n"+ "Incluye el siguiente servicio: " + "\n" + res;*/ //DATOS AL DATASET EN LA PARTE DEL ENCABEZADO var Enc = "Contrato de Prestación de Servicios Profesionales de escenario para " + " " + varServ + ", que celebran, por una parte MARÍA TIMARÁN LÓPEZ representante de Remember Box en lo sucesivo el Profesional, y por la otra " + " " + cont.Nombre + " " + "en lo sucesivo el Cliente, Instrumento que se celebra de conformidad con las siguientes Declaraciones y Cláusulas:"; var Foot = "Por la prestación de los servicios de renta" + " " + cont.Servicios + " " + " el Cliente pagará a el Profesional la cantidad de " + "$" + cont.Precio + " " + "(" + prec + " " + "PESOS 00/100 MN)" + " " + cont.FormaPago + "."; // serv = db.servicios.SqlQuery("SELECT * FROM servicios").FirstOrDefault(); var fech = cont.FechaEv; var day = String.Format("{0:dd}", fech); var month = String.Format("{0:MMMM}", fech); var year = String.Format("{0:yyyy}", fech); var footFecha = "El presente contrato entrará en vigor el día de su firma, y concluirá el día " + " " + day + " " + "de" + " " + month + " " + "del" + " " + year + " " + " al concluir su evento."; //TERMINA CARGA DE TEXTO AL REPORTE /*for (int i = 0; i <= var2.Length-1; i++) * { * serv = db.servicios.SqlQuery("SELECT Propiedades FROM servicios where Servicio=" + var2[0].ToString()).FirstOrDefault(); * * }*/ //dt.Rows.Add(cont.Id_Contrato, cont.Nombre, cont.Jardin, cont.Fecha, cont.Servicios, cont.Precio, cont.FormaPago, servv.Propiedades); //dt.Rows.Add(cont.Id_Contrato, cont.Nombre, result, footFecha, servic, cont.Precio, Foot, Detalles, Enc); //dt.Rows.Add(cont.Nombre, cont.Jardin,cont.Fecha,cont.Servicios,cont.Precio,cont.FormaPago); DataSet ds = new DataSet(); ds.Tables.Add(dt); rd.SetDataSource(ds); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Contrato.pdf")); } catch (Exception ex) { throw; } /*String rutaGuardado = Server.MapPath("~/Contrato.pdf"); * rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, rutaGuardado); * * //mostrar * ProcessStartInfo loPSI = new ProcessStartInfo(); * Process loProceso = new Process(); * loPSI.FileName = ""; * try * { * loProceso = Process.Start(rutaGuardado); * } * catch (Exception x) * { * //MessageBox.Show(Exp.Message, "XXXX", MessageBoxButtons.OK, MessageBoxIcon.Information); * } * return RedirectToAction("Indice", "Home");*/ }
public ServicioSasociadoDetalle(servicios Servicio) { NavigationPage.SetBackButtonTitle(this, Servicio.alias.ToUpper()); MessagingCenter.Subscribe <FacturasDTModeloVista>(this, "PDF", async(sender) => { await Navigation.PushAsync(new FacturaVista()); }); Label Bienvenida = new Label { BackgroundColor = Color.Transparent, Margin = new Thickness((App.DisplayScreenWidth / 12.533333333333333), 0, 0, 0), HorizontalTextAlignment = TextAlignment.Start, HorizontalOptions = LayoutOptions.FillAndExpand, FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.White, FontSize = (App.DisplayScreenWidth / 15.04) }; Bienvenida.Text = Servicio.alias; continuar = new CircleImage { BackgroundColor = Color.Transparent, BorderColor = Color.FromHex("f6f6f6"), BorderThickness = Convert.ToInt32(App.DisplayScreenWidth / 107.428571428571429), Aspect = Aspect.AspectFill, Source = "iContinuarA" }; TapGestureRecognizer continuarTAP = new TapGestureRecognizer { NumberOfTapsRequired = 1 }; continuarTAP.Tapped += ContinuarTAP_Tapped; continuar.GestureRecognizers.Add(continuarTAP); RelativeLayout CC = new RelativeLayout() { Padding = 0, WidthRequest = App.DisplayScreenWidth, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.Transparent, }; CC.Children.Add(new Image { Aspect = Aspect.Fill, Source = "header", HeightRequest = App.DisplayScreenHeight / 2.889679715302491 }, Constraint.Constant(0), Constraint.Constant(-60), Constraint.Constant(App.DisplayScreenWidth), Constraint.Constant(App.DisplayScreenHeight / 2.889679715302491) ); CC.Children.Add(Bienvenida, Constraint.Constant(0), Constraint.Constant(App.DisplayScreenHeight / 10.15), Constraint.Constant(App.DisplayScreenWidth) ); CC.Children.Add(continuar, Constraint.Constant((App.DisplayScreenWidth / 1.540983606557377)), Constraint.Constant(App.DisplayScreenHeight / 4.69364161849711), Constraint.Constant(App.DisplayScreenHeight / 12.492307692307692), Constraint.Constant(App.DisplayScreenHeight / 12.492307692307692) ); facturas = new List <facturas> { new facturas { alias = "FACTURA MARZO 2018", proveedor = "EEGSA", categoria = string.Empty, saldo = !Servicio.alias.Equals("CASA PROPIA")?"TOTAL: Q.2,150.00":"TOTAL: Q.852.00", aviso = string.Empty, vencimiento = "Ven: 01 - 03 - 2018", background = "iFacturaBackground", iconEstado = "iNoSeleccionado", backgroundColor = Color.FromHex("BFBFBF") }, }; if (!Servicio.alias.Equals("CASA PROPIA")) { facturas.Add(new facturas { alias = "FACTURA ABRIL 2018", proveedor = "EEGSA", categoria = string.Empty, saldo = "TOTAL: Q.2,150.00", aviso = string.Empty, vencimiento = "Ven: 13 - 07 - 1991", background = "iFacturaBackground", iconEstado = "iNoSeleccionado", backgroundColor = Color.FromHex("BFBFBF") }); facturas.Add(new facturas { alias = "FACTURA MAYO 2018", proveedor = "EEGSA", categoria = string.Empty, saldo = "TOTAL: Q.2,150.00", aviso = string.Empty, vencimiento = "Ven: 13 - 07 - 1991", background = "iFacturaBackground", iconEstado = "iNoSeleccionado", backgroundColor = Color.FromHex("BFBFBF") }); } Facturas = new ExtendedListView { ItemTemplate = new DataTemplate(typeof(FacturasDTModeloVista)), Margin = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, ItemsSource = facturas, RowHeight = Convert.ToInt32((App.DisplayScreenWidth / 1.978947368421053)), IsScrollEnable = true, IsPullToRefreshEnabled = false, SeparatorVisibility = SeparatorVisibility.None, SeparatorColor = Color.White, BackgroundColor = Color.Transparent, HasUnevenRows = false }; Facturas.ItemSelected += Facturas_ItemSelected; Grid Contenido = new Grid { Padding = 0, BackgroundColor = Color.White, RowSpacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; Contenido.Children.Add(CC, 0, 0); Contenido.Children.Add(Facturas, 0, 1); Padding = 0; Content = Contenido; }