protected void EntityContactInformationHistoryGrid_OnItemCreated(Object sender, Telerik.Web.UI.GridItemEventArgs eventArgs) { if (MercuryApplication == null) { return; } if (eventArgs.Item is Telerik.Web.UI.GridCommandItem) { AllowUserInteraction = AllowUserInteraction && ( (MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.MemberContactInformationManage)) ); } if ((eventArgs.Item is Telerik.Web.UI.GridEditableItem) && (eventArgs.Item.IsInEditMode)) { Telerik.Web.UI.GridEditableItem item = (Telerik.Web.UI.GridEditableItem)eventArgs.Item; Telerik.Web.UI.RadComboBox EntityContactInformationEditContactType = (Telerik.Web.UI.RadComboBox)item.FindControl("EntityContactInformationEditContactType"); Telerik.Web.UI.RadDatePicker effectiveDatePicker = (Telerik.Web.UI.RadDatePicker)item.FindControl("EntityContactInformationEditEffectiveDate"); Telerik.Web.UI.RadDatePicker terminationDatePicker = (Telerik.Web.UI.RadDatePicker)item.FindControl("EntityContactInformationEditTerminationDate"); if (eventArgs.Item.OwnerTableView.IsItemInserted) { // ITEM TO BE INSERTED, SET INITIAL SETTINGS FOR THE INSERT effectiveDatePicker.SelectedDate = DateTime.Today; } else { // ITEM TO BE EDITED, VALUES ARE DATA BOUND IN THE TEMPLATE DEFINITION UNDER ASP EntityContactInformationEditContactType.SelectedValue = item.GetDataKeyValue("ContactTypeInt32").ToString(); effectiveDatePicker.SelectedDate = Convert.ToDateTime(item.GetDataKeyValue("EffectiveDate")); if (!Convert.ToDateTime(item.GetDataKeyValue("TerminationDate")).Equals(new DateTime(9999, 12, 31))) { terminationDatePicker.SelectedDate = Convert.ToDateTime(item.GetDataKeyValue("TerminationDate")); } } } return; }
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 GrdLabDetails_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().DeleteLaboratoryDetail(Id); DisplayAlert("Resultado eliminado correctamente", "Eliminar Resultado", "Info"); GrdLabDetails.Rebind(); } catch (Exception ex) { e.Canceled = true; DisplayAlert(ex); } } }
protected void GrdLabDetails_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 LabDetail = string.Empty; string LabResult = string.Empty; string LabReference = string.Empty; string LabUnit = string.Empty; bool Remark = false; var objId = editedItem.GetDataKeyValue("Id"); 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 "LabDetail": LabDetail = item.Value.ToString(); break; case "LabResult": LabResult = item.Value.ToString(); break; case "LabReference": LabReference = item.Value.ToString(); break; case "LabUnit": LabUnit = item.Value.ToString(); break; case "Remark": Remark = bool.Parse(item.Value.ToString()); break; } } Data.DataProvider.Instance().SetLaboratoryDetail(0, LabDetail, LabResult, LabReference, LabUnit, Remark, UserId, Id); GrdLabDetails.Rebind(); DisplayAlert("Resultado actualizado correctamente", "Resultado Actualizado", "Info"); } catch (Exception ex) { e.Canceled = true; DisplayAlert(ex); } } }
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); } } }