public List<Tabla_Receta_TemplateDTO> loadTemplate(int Id_Template) { string query = @"select a.*, b.Descripcion_Medicamento as Tem_Medicamento from Tabla_receta_Template a left join Tabla_Catalogo_Medicamento b on b.Id_Medicamento = a.Id_Medicamento where Id_Template = @Id_Template"; var oneTemp = new Tabla_Receta_TemplateDTO(); oneTemp.Id_Template = Id_Template; Helpers h = new Helpers(); var lTemporal = h.GetAllParametized(query, oneTemp); return lTemporal; }
public void loadTemplate() { try { string query = @"select * from Tabla_receta_Template a left join Tabla_Catalogo_Medicamento b on b.Id_Medicamento = a.Id_Medicamento where Id_Template = @Id_Template"; var oneTemp = new Tabla_Receta_TemplateDTO(); oneTemp.Id_Template = Convert.ToInt32(ddlTemplate.SelectedItem.Value); Helpers h = new Helpers(); var lTemporal = h.GetAllParametized(query, oneTemp); rptTemplate.DataSource = lTemporal; rptTemplate.DataBind(); } catch { } }
protected void addToList(object sender, EventArgs e) { var lTemplates = (List<Tabla_Receta_TemplateDTO>)Session["lTemplates"]; int id; if (lTemplates == null) { lTemplates = new List<Tabla_Receta_TemplateDTO>(); id = 0; } else if (lTemplates.Count > 0) { id = lTemplates[lTemplates.Count - 1].Id_Template + 1; } else { id = 0; } var oneTemplate = new Tabla_Receta_TemplateDTO { Id_Template = id, Id_Receta_Template = id, Id_Medicamento = Convert.ToInt32(ddlMedicamento.SelectedItem.Value), Tem_Medicamento = ddlMedicamento.SelectedItem.Text, Tem_Dosis = txtDos.Value, Tem_Notas = txtNot.Value }; lTemplates.Add(oneTemplate); Session["lTemplates"] = lTemplates; loadItems(); }
protected void saveToTemplate(object sender, EventArgs e) { Helpers h = new Helpers(); var lTemporal = (List<Tabla_Receta_TemplateDTO>)Session["lTemplates"]; string queryInsert = "insert into Tabla_Receta_Template (Id_Medicamento, Tem_Dosis, Tem_Notas, Tem_Nombre, Id_Template) values (@Id_Medicamento, @Tem_Dosis, @Tem_Notas, @Tem_Nombre, @Id_Template)"; var oneT = new Tabla_Receta_TemplateDTO(); string queryLast = "SELECT TOP 1 Id_Template FROM Tabla_Receta_Template ORDER BY Id_Template DESC"; var lIdTemplate = h.GetAllParametized(queryLast, oneT); if (lIdTemplate.Count == 0) { oneT.Id_Template = 0; } else if (lTemporal[0].Id_Template != 0) { oneT.Id_Template = getCurrentId(); } else { oneT.Id_Template = lIdTemplate[0].Id_Template + 1; } if (!ddlTemplate.Enabled) { string query = "delete Tabla_Receta_Template where Id_Template = @Id_Template"; h.ExecuteNonQueryParam(query, new Tabla_Receta_TemplateDTO { Id_Template = Convert.ToInt32(ddlTemplate.SelectedItem.Value) }); } foreach (var y in lTemporal) { var oneTemplate = new Tabla_Receta_TemplateDTO(); oneTemplate.Id_Medicamento = y.Id_Medicamento; oneTemplate.Tem_Dosis = y.Tem_Dosis; oneTemplate.Tem_Notas = y.Tem_Notas; oneTemplate.Tem_Nombre = txtNombre.Value; oneTemplate.Id_Template = oneT.Id_Template; h.ExecuteNonQueryParam(queryInsert, oneTemplate); } Session["lTemplates"] = null; loadItems(); loadTemporal(); ddlTemplate.Enabled = true; cancelRow.Visible = false; txtNombre.Value = ""; txtSearch.Text = ""; }
public string loadTemplate(int Id_Template) { string query = @"select a.*, b.Descripcion_Medicamento as Tem_Medicamento from Tabla_receta_Template a left join Tabla_Catalogo_Medicamento b on b.Id_Medicamento = a.Id_Medicamento where Id_Template = @Id_Template"; var oneTemp = new Tabla_Receta_TemplateDTO(); oneTemp.Id_Template = Id_Template; Helpers h = new Helpers(); var lTemporal = h.GetAllParametized(query, oneTemp); string json = JsonConvert.SerializeObject(lTemporal); return json; }
protected void saveToUse(object sender, EventArgs e) { int Id_Template = Convert.ToInt32(ddlTemplate.SelectedItem.Value); string query = @"select a.*, b.Descripcion_Medicamento as Tem_Medicamento from Tabla_receta_Template a left join Tabla_Catalogo_Medicamento b on b.Id_Medicamento = a.Id_Medicamento where Id_Template = @Id_Template"; var oneTemp = new Tabla_Receta_TemplateDTO(); oneTemp.Id_Template = Id_Template; Helpers h = new Helpers(); var lTemporal = h.GetAllParametized(query, oneTemp); string queryInsert = "insert into Tabla_Temporal_Receta (Id_FichaIdentificacion, Tem_Dosis, Tem_Notas, Id_Medicamento, Id_Consulta) values (@Id_FichaIdentificacion, @Tem_Dosis, @Tem_Notas, @Id_Medicamento, @Id_Consulta)"; string queryDelete = "delete from Tabla_Temporal_Receta where Id_Consulta = @Id_Consulta and Id_FichaIdentificacion = @Id_FichaIdentificacion"; h.ExecuteNonQueryParam(queryDelete, new Tabla_Temporal_RecetaDTO { Id_FichaIdentificacion = Id_FichaIdentificacion, Id_Consulta = Id_Consulta }); foreach (var y in lTemporal) { var oneTe = new Tabla_Temporal_RecetaDTO(); oneTe.Id_Consulta = Id_Consulta; oneTe.Id_FichaIdentificacion = Id_FichaIdentificacion; oneTe.Id_Medicamento = y.Id_Medicamento; oneTe.Tem_Dosis = y.Tem_Dosis; oneTe.Tem_Notas = y.Tem_Notas; h.ExecuteNonQueryParam(queryInsert, oneTe); loadTemporal(); } string script = "AlertaGuardar();"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); return; }
protected void saveToTemplate(object sender, EventArgs e) { string query = "select * from Tabla_Temporal_Receta where Id_Consulta = @Id_Consulta and Id_FichaIdentificacion = @Id_FichaIdentificacion"; Helpers h = new Helpers(); var oneTemp = new Tabla_Temporal_RecetaDTO(); oneTemp.Id_Consulta = Id_Consulta; oneTemp.Id_FichaIdentificacion = Id_FichaIdentificacion; var lTemporal = h.GetAllParametized(query, oneTemp); string queryInsert = "insert into Tabla_Receta_Template (Id_Medicamento, Tem_Dosis, Tem_Notas, Tem_Nombre, Id_Template) values (@Id_Medicamento, @Tem_Dosis, @Tem_Notas, @Tem_Nombre, @Id_Template)"; var oneT = new Tabla_Receta_TemplateDTO(); string queryLast = "SELECT TOP 1 Id_Template FROM Tabla_Receta_Template ORDER BY Id_Template DESC"; var lIdTemplate = h.GetAllParametized(queryLast, oneT); if (lIdTemplate.Count == 0) { oneT.Id_Template = 0; } else { oneT.Id_Template = lIdTemplate[0].Id_Template + 1; } foreach (var y in lTemporal) { var oneTemplate = new Tabla_Receta_TemplateDTO(); oneTemplate.Id_Medicamento = y.Id_Medicamento; oneTemplate.Tem_Dosis = y.Tem_Dosis; oneTemplate.Tem_Notas = y.Tem_Notas; oneTemplate.Tem_Nombre = txtNombre.Value; oneTemplate.Id_Template = oneT.Id_Template; h.ExecuteNonQueryParam(queryInsert, oneTemplate); } loadTemporal(); string script = "AlertaGuardar();"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); return; }