protected void GrdPatientLabs_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.Item is Telerik.Web.UI.GridEditableItem) { try { Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem; var ObjId = editedItem.GetDataKeyValue("Id"); int Id = ObjId != null ? (int)ObjId : 0; Data.DataProvider.Instance().DeleteLaboratory(Id); DisplayAlert("El exámen de laboratorio fue eliminado correctamente", "Eliminar Exámen", "Info"); GrdPatientLabs.Rebind(); GrdLabDetails.Rebind(); TxtObservation.Text = string.Empty; } catch (Exception ex) { e.Canceled = true; DisplayAlert(ex); } } }
protected void BtnProcess_Click(object sender, EventArgs e) { try { int LabId = 0; foreach (Telerik.Web.UI.GridDataItem item in GrdPatientLabs.SelectedItems) { LabId = int.Parse(item["Id"].Text); } if (LabId == 0) { DisplayAlert("Debe seleccionar primero un laboratorio", "Seleccionar Laboratorio", "Alert"); return; } Data.DataProvider.Instance().SetClosedLaboratory(LabId, UserId); GrdPatientLabs.Rebind(); GrdLabDetails.Rebind(); TxtObservation.Text = string.Empty; TxtObservation.Enabled = false; BtnSaveObservation.Enabled = false; BtnProcess.Enabled = false; DisplayAlert("Exámen de laboratorio procesado correctamente.", "Exámen Procesado", "Info"); } catch (Exception ex) { DisplayAlert(ex); } }
protected void CmbPatientsLabs_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { try { System.Data.DataTable dt = Data.DataProvider.Instance().GetPatients(int.Parse(CmbPatientsLabs.SelectedValue)); foreach (System.Data.DataRow drow in dt.Rows) { LblPatPersonalId.Text = drow["PersonalId"].ToString(); LblPatName.Text = drow["DisplayName"].ToString(); LblPatGender.Text = drow["Gender_Desc"].ToString(); LblPatYears.Text = drow["Years"].ToString(); LblPatPhone.Text = drow["Phone"].ToString(); LblPatCellPhone.Text = drow["CellPhone"].ToString(); LblPatWhatsapp.Text = drow["Whatsapp"].ToString(); LblPatEmail.Text = drow["Email"].ToString(); } GrdPatientLabs.Rebind(); } catch (Exception ex) { DisplayAlert(ex); } }
protected void GrdPatientLabs_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.Item is Telerik.Web.UI.GridEditableItem) { try { if (string.IsNullOrEmpty(CmbPatientsLabs.SelectedValue)) { DisplayAlert("Debe seleccionar un paciente primero.", "Alerta", "Alert"); e.Canceled = true; return; } Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem; int PatientId = int.Parse(CmbPatientsLabs.SelectedValue); int DoctorId = 0; int Id = 0; string LabName = string.Empty; System.Collections.Hashtable newValues = new System.Collections.Hashtable(); e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); foreach (System.Collections.DictionaryEntry item in newValues) { switch (item.Key.ToString()) { case "DoctorId": DoctorId = item.Value != null?int.Parse(item.Value.ToString()) : 0; break; case "LabName": LabName = item.Value.ToString(); break; } } if (string.IsNullOrEmpty(CmbPatientsLabs.SelectedValue)) { DisplayAlert("Debe seleccionar un doctor.", "Alerta", "Alert"); return; } Id = Data.DataProvider.Instance().SetLaboratory(PatientId, DoctorId, LabName, string.Empty, UserId); GrdPatientLabs.Rebind(); RowIndex = 0; TxtObservation.Text = string.Empty; DisplayAlert("Laboratorio creado correctamente, puede proceder a agregar los detalles del mismo.", "Laboratorio Creado", "Info"); } catch (Exception ex) { e.Canceled = true; DisplayAlert(ex); } } }
protected void BtnClearResult_Click(object sender, EventArgs e) { GrdPatientLabs.Rebind(); GrdLabDetails.Rebind(); TxtObservation.Text = string.Empty; TxtObservation.Enabled = false; BtnSaveObservation.Enabled = false; BtnProcess.Enabled = false; BtnExport.Enabled = false; }
protected void GrdPatientLabs_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.Item != null) { if (e.Item.ItemIndex >= 0) { string Status = string.Empty; string Observation = string.Empty; e.Item.Selected = true; foreach (Telerik.Web.UI.GridDataItem item in GrdPatientLabs.SelectedItems) { Status = item["Status"].Text; TxtObservation.Text = item["Observation"].Text.Replace(" ", ""); if (Status == "Procesado") { TxtObservation.Enabled = false; BtnSaveObservation.Enabled = false; BtnProcess.Enabled = false; BtnExport.Enabled = true; } else { TxtObservation.Enabled = true; BtnSaveObservation.Enabled = true; BtnProcess.Enabled = true; BtnExport.Enabled = false; } } } else { if (e.CommandName == "RebindGrid") { GrdPatientLabs.Rebind(); GrdLabDetails.Rebind(); TxtObservation.Text = string.Empty; TxtObservation.Enabled = false; BtnSaveObservation.Enabled = false; BtnProcess.Enabled = false; BtnExport.Enabled = false; } } } GrdLabDetails.Rebind(); }
protected void GrdPatientLabs_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.Item is Telerik.Web.UI.GridEditableItem) { try { Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem; int Id = 0; string LabName = string.Empty; int DoctorId = 0; string Observation = string.Empty; var objId = editedItem.GetDataKeyValue("Id"); Observation = GrdPatientLabs.Items[editedItem.ItemIndex]["Observation"].Text.Replace(" ", string.Empty); Id = objId != null ? (int)objId : 0; System.Collections.Hashtable newValues = new System.Collections.Hashtable(); e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); foreach (System.Collections.DictionaryEntry item in newValues) { switch (item.Key.ToString()) { case "LabName": LabName = item.Value.ToString(); break; case "DoctorId": DoctorId = item.Value != null?int.Parse(item.Value.ToString()) : 0; break; case "Observation": Observation = item.Value.ToString(); break; } } if (DoctorId == 0) { DisplayAlert("Debe seleccionar un medico", "Alerta", "Alert"); return; } Data.DataProvider.Instance().SetLaboratory(0, DoctorId, LabName, Observation, UserId, Id); TxtObservation.Text = Observation; GrdPatientLabs.Rebind(); GrdLabDetails.Rebind(); BtnSaveObservation.Enabled = false; BtnProcess.Enabled = false; DisplayAlert("Laboratorio actualizado correctamente", "Laboratorio Actualizado", "Info"); } catch (Exception ex) { e.Canceled = true; DisplayAlert(ex); } } }