Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        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 ActivityParametersGrid_OnItemDataBound(Object sender, Telerik.Web.UI.GridItemEventArgs eventArgs)
        {
            Telerik.Web.UI.RadComboBox activityParameterValueSelection;

            Telerik.Web.UI.RadTextBox activityParameterFixedValue;

            System.Collections.Generic.Dictionary <String, String> bindingContexts = new Dictionary <String, String> ();

            String parameterName;


            if (MercuryApplication == null)
            {
                return;
            }


            if ((eventArgs.Item is Telerik.Web.UI.GridEditableItem) && (eventArgs.Item.IsInEditMode))
            {
                Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;


                if ((ActivityActionSelection.SelectedItem != null) && (ActivityActionSelection.SelectedValue != "0"))
                {
                    parameterName = (String)editItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];

                    activityParameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ActivityParameterValueSelection");

                    activityParameterValueSelection.Items.Clear();

                    if (!EditCareInterventionActivity.Action.ActionParameters[parameterName].Required)
                    {
                        activityParameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("* Not Assigned", "0"));
                    }


                    bindingContexts = (new Client.Core.Individual.Case.MemberCase(MercuryApplication)).ParameterValueSelection(EditCareInterventionActivity.Action.ActionParameters[parameterName].DataType);

                    foreach (String currentBindingContextName in bindingContexts.Keys)
                    {
                        activityParameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentBindingContextName, bindingContexts[currentBindingContextName]));
                    }


                    activityParameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ActivityParameterFixedValue");

                    activityParameterFixedValue.Enabled = EditCareInterventionActivity.Action.ActionParameters[parameterName].AllowFixedValue;

                    activityParameterFixedValue.EmptyMessage = (EditCareInterventionActivity.Action.ActionParameters[parameterName].AllowFixedValue) ? String.Empty : "(Not Available)";

                    activityParameterFixedValue.Text = String.Empty;
                }
            }

            return;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        protected void CarePlanInterventionActivitiesGrid_OnItemCreated(Object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if ((e.Item is Telerik.Web.UI.GridEditableItem) && (e.Item.IsInEditMode))
            {
                if (CarePlanIntervention == null)
                {
                    return;
                }

                Telerik.Web.UI.GridEditableItem item = (Telerik.Web.UI.GridEditableItem)e.Item;
            }

            return;
        }
Esempio n. 6
0
        protected void CarePlanInterventionGrid_OnItemCreated(Object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if ((e.Item is Telerik.Web.UI.GridEditableItem) && (e.Item.IsInEditMode))
            {
                if (MemberCaseCarePlan == null)
                {
                    return;
                }

                Telerik.Web.UI.GridEditableItem item = (Telerik.Web.UI.GridEditableItem)e.Item;


                Telerik.Web.UI.RadComboBox AddCarePlanInterventionExistingSelection = (Telerik.Web.UI.RadComboBox)item.FindControl("AddCarePlanInterventionExistingSelection");

                if (AddCarePlanInterventionExistingSelection == null)
                {
                    return;
                }

                AddCarePlanInterventionExistingSelection.DataSource = MercuryApplication.CareInterventionsAvailable(true);

                AddCarePlanInterventionExistingSelection.DataTextField = "Name";

                AddCarePlanInterventionExistingSelection.DataValueField = "Id";


                Telerik.Web.UI.RadComboBox AddCarePlanInterventionCareMeasureSelection = (Telerik.Web.UI.RadComboBox)item.FindControl("AddCarePlanInterventionCareMeasureSelection");

                if (AddCarePlanInterventionCareMeasureSelection == null)
                {
                    return;
                }

                AddCarePlanInterventionCareMeasureSelection.DataSource = MercuryApplication.CareMeasuresAvailableEnabledVisible(true);

                AddCarePlanInterventionCareMeasureSelection.DataTextField = "Name";

                AddCarePlanInterventionCareMeasureSelection.DataValueField = "Id";
            }

            return;
        }
Esempio n. 7
0
        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 ActivityThresholdsGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            Client.Core.Individual.CareInterventionActivity careInterventionActivity = EditCareInterventionActivity;

            Mercury.Client.Core.Activity.ActivityThreshold threshold;

            String parameterName;

            Telerik.Web.UI.RadNumericTextBox thresholdRelativeDateValue;

            Telerik.Web.UI.RadComboBox thresholdRelativeDateQualifier;

            Telerik.Web.UI.RadComboBox thresholdStatusSelection;

            Telerik.Web.UI.RadComboBox thresholdActionSelection;

            Telerik.Web.UI.RadComboBox parameterValueSelection;

            Telerik.Web.UI.RadTextBox parameterFixedValue;

            Int64 actionId = 0;


            if (MercuryApplication == null)
            {
                return;
            }


            // SaveResponseLabel.Text = String.Empty;

            switch (eventArgs.CommandName)
            {
            case Telerik.Web.UI.RadGrid.EditCommandName:

                #region Edit Command

                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "Thresholds":

                    Telerik.Web.UI.GridEditCommandColumn editColumn = (Telerik.Web.UI.GridEditCommandColumn)ActivityThresholdsGrid.MasterTableView.GetColumn("EditCommandColumn");

                    if (!editColumn.Visible)
                    {
                        editColumn.Visible = true;
                    }

                    Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                    break;


                case "ThresholdParameters":

                    editColumn = (Telerik.Web.UI.GridEditCommandColumn)eventArgs.Item.OwnerTableView.GetColumn("EditCommandColumn");

                    if (!editColumn.Visible)
                    {
                        editColumn.Visible = true;
                    }

                    break;
                }

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.InitInsertCommandName:

                break;

            case Telerik.Web.UI.RadGrid.PerformInsertCommandName:

                #region Perform Insert Command

                Telerik.Web.UI.GridEditableItem insertedItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                thresholdRelativeDateValue = (Telerik.Web.UI.RadNumericTextBox)insertedItem.FindControl("ActivityThresholdRelativeDateValue");

                thresholdRelativeDateQualifier = (Telerik.Web.UI.RadComboBox)insertedItem.FindControl("ActivityThresholdRelativeDateQualifier");

                thresholdStatusSelection = (Telerik.Web.UI.RadComboBox)insertedItem.FindControl("ActivityThresholdStatusSelection");

                thresholdActionSelection = (Telerik.Web.UI.RadComboBox)insertedItem.FindControl("ActivityThresholdActionSelection");


                try {
                    if (thresholdRelativeDateValue.Value == null)
                    {
                        throw new ApplicationException("No Threshold Date Specified.");
                    }


                    threshold = careInterventionActivity.GetNewThreshold();

                    threshold.RelativeDateValue = Int32.Parse(thresholdRelativeDateValue.Value.ToString());

                    threshold.RelativeDateQualifier = (Mercury.Server.Application.DateQualifier)Int32.Parse(thresholdRelativeDateQualifier.SelectedItem.Value);

                    threshold.Status = (Mercury.Server.Application.ActivityStatus)Int32.Parse(thresholdStatusSelection.SelectedValue);


                    // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                    //actionId = Int64.Parse (thresholdActionSelection.SelectedValue);

                    //threshold.Action = MercuryApplication.ActionById (actionId);

                    //if (threshold.Action == null) { threshold.Action = new Mercury.Client.Core.Action.Action (MercuryApplication); }


                    if (!EditCareInterventionActivity.HasThreshold(threshold))
                    {
                        careInterventionActivity.Thresholds.Add(threshold);

                        EditCareInterventionActivity = careInterventionActivity;
                    }

                    else
                    {
                        throw new ApplicationException("Duplicate Threshold");
                    }
                }

                catch (Exception MercuryApplicationException) {
                    // SaveResponseLabel.Text = "Error: " + MercuryApplicationException.Message;
                }

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.UpdateCommandName:

                #region Update Command

                Telerik.Web.UI.GridEditableItem updatedItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "Thresholds":

                    thresholdRelativeDateValue = (Telerik.Web.UI.RadNumericTextBox)updatedItem.FindControl("ActivityThresholdRelativeDateValue");

                    thresholdRelativeDateQualifier = (Telerik.Web.UI.RadComboBox)updatedItem.FindControl("ActivityThresholdRelativeDateQualifier");

                    thresholdStatusSelection = (Telerik.Web.UI.RadComboBox)updatedItem.FindControl("ActivityThresholdStatusSelection");

                    thresholdActionSelection = (Telerik.Web.UI.RadComboBox)updatedItem.FindControl("ActivityThresholdActionSelection");

                    threshold = careInterventionActivity.SortedThresholds.Values[updatedItem.ItemIndex];

                    threshold.RelativeDateValue = Int32.Parse(thresholdRelativeDateValue.Value.ToString());

                    threshold.RelativeDateQualifier = (Mercury.Server.Application.DateQualifier)Int32.Parse(thresholdRelativeDateQualifier.SelectedItem.Value);

                    threshold.Status = (Mercury.Server.Application.ActivityStatus)Int32.Parse(thresholdStatusSelection.SelectedValue);


                    // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                    //actionId = Int64.Parse (thresholdActionSelection.SelectedValue);

                    //if (threshold.Action.Id != actionId) {

                    //    threshold.Action = MercuryApplication.ActionById (actionId);

                    //    if (threshold.Action == null) { threshold.Action = new Mercury.Client.Core.Action.Action (MercuryApplication); }

                    //}

                    break;

                case "ThresholdParameters":         // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                    Int64 thresholdKey = Int64.Parse((String)((Telerik.Web.UI.GridEditableItem)eventArgs.Item).OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ThresholdKey"]);

                    threshold = careInterventionActivity.SortedThresholds[thresholdKey];

                    parameterName = (String)((Telerik.Web.UI.GridEditableItem)eventArgs.Item).OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];

                    if (threshold.Action.ActionParameters.ContainsKey(parameterName))
                    {
                        parameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ActivityThresholdParameterValue");

                        parameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ActivityThresholdParameterFixedValue");

                        if ((parameterValueSelection.SelectedItem != null) || (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                        {
                            if ((threshold.Action.ActionParameters[parameterName].AllowFixedValue) && (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                            {
                                threshold.Action.ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.FixedValue;

                                threshold.Action.ActionParameters[parameterName].Value = parameterFixedValue.Text;

                                threshold.Action.ActionParameters[parameterName].ValueDescription = parameterFixedValue.Text;
                            }

                            else
                            {
                                threshold.Action.ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.DataMapping;

                                threshold.Action.ActionParameters[parameterName].Value = parameterValueSelection.SelectedItem.Value;

                                threshold.Action.ActionParameters[parameterName].ValueDescription = parameterValueSelection.SelectedItem.Text;
                            }


                            if ((threshold.Action.Name == "Workflow") && (parameterName == "Workflow"))
                            {
                                threshold.Action.RebindActionParameters(MercuryApplication);
                            }
                        }
                    }

                    break;
                }

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.ExpandCollapseCommandName:

                #region Expand/Collapse Command

                System.Data.DataTable parameterTable = (System.Data.DataTable)Session[SessionCachePrefix + "ActivityThresholdsGrid.ParameterTable"];

                parameterTable.Rows.Clear();

                Int32 currentThresholdIndex = 0;

                foreach (Mercury.Client.Core.Activity.ActivityThreshold currentThreshold in careInterventionActivity.SortedThresholds.Values)
                {
                    if (currentThreshold.Action != null)
                    {
                        foreach (String currentParameterName in currentThreshold.Action.ActionParameters.Keys)
                        {
                            parameterTable.Rows.Add(currentThresholdIndex, currentParameterName, currentThreshold.Action.ActionParameters[currentParameterName].ValueDescription);
                        }
                    }

                    currentThresholdIndex = currentThresholdIndex + 1;
                }

                ActivityThresholdsGrid.MasterTableView.DetailTables[0].DataSource = parameterTable;

                ActivityThresholdsGrid.MasterTableView.DetailTables[0].DataBind();

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.DeleteCommandName:

                Int32 deleteIndex = eventArgs.Item.DataSetIndex;

                if ((deleteIndex > -1) && (deleteIndex < careInterventionActivity.Thresholds.Count))
                {
                    threshold = careInterventionActivity.SortedThresholds.Values[deleteIndex];

                    careInterventionActivity.Thresholds.Remove(threshold);
                }

                break;

            default:

                System.Diagnostics.Debug.WriteLine(eventArgs.CommandName);

                break;
            }


            EditCareInterventionActivity = careInterventionActivity;

            return;
        }
        protected void ActivityThresholdsGrid_OnItemDataBound(Object sender, Telerik.Web.UI.GridItemEventArgs eventArgs)
        {
            Telerik.Web.UI.RadNumericTextBox thresholdRelativeDateValue;

            Telerik.Web.UI.RadComboBox thresholdRelativeDateQualifier;

            Telerik.Web.UI.RadComboBox thresholdStatusSelection;

            Telerik.Web.UI.RadComboBox thresholdActionSelection;

            Client.Core.Activity.ActivityThreshold threshold;

            System.Collections.Generic.Dictionary <String, String> bindingContexts;


            if (MercuryApplication == null)
            {
                return;
            }


            if ((eventArgs.Item is Telerik.Web.UI.GridEditableItem) && (eventArgs.Item.IsInEditMode))
            {
                Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;


                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "Thresholds":

                    thresholdRelativeDateValue = (Telerik.Web.UI.RadNumericTextBox)editItem.FindControl("ActivityThresholdRelativeDateValue");

                    thresholdRelativeDateQualifier = (Telerik.Web.UI.RadComboBox)editItem.FindControl("ActivityThresholdRelativeDateQualifier");

                    thresholdStatusSelection = (Telerik.Web.UI.RadComboBox)editItem.FindControl("ActivityThresholdStatusSelection");


                    // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                    //thresholdActionSelection = (Telerik.Web.UI.RadComboBox)editItem.FindControl ("ActivityThresholdActionSelection");


                    //thresholdActionSelection.Items.Clear ();

                    //thresholdActionSelection.Items.Add (new Telerik.Web.UI.RadComboBoxItem ("* No Action Selected", "0"));

                    //foreach (Mercury.Server.Application.Action currentAction in MercuryApplication.ActionsAvailable (false)) {

                    //    thresholdActionSelection.Items.Add (new Telerik.Web.UI.RadComboBoxItem (currentAction.Name, currentAction.Id.ToString ()));

                    //}


                    if (eventArgs.Item.ItemIndex != -1)
                    {
                        threshold = EditCareInterventionActivity.SortedThresholds.Values[eventArgs.Item.ItemIndex];

                        if (threshold != null)
                        {
                            thresholdRelativeDateValue.Value = threshold.RelativeDateValue;

                            thresholdRelativeDateQualifier.SelectedValue = threshold.RelativeDateQualifier.ToString();

                            thresholdStatusSelection.SelectedValue = ((Int32)threshold.Status).ToString();


                            // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                            // thresholdActionSelection.SelectedValue = threshold.Action.Id.ToString ();
                        }
                    }

                    break;

                case "ThresholdParameters":     // RESERVED IF ACTIONS ARE ADDED TO CARE LEVEL ACTIVITY THRESHOLDS

                    Int64 thresholdKey = Int64.Parse((String)((Telerik.Web.UI.GridEditableItem)eventArgs.Item).OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ThresholdKey"]);

                    threshold = EditCareInterventionActivity.SortedThresholds[thresholdKey];

                    String parameterName = (String)editItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];

                    Telerik.Web.UI.RadComboBox parameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ActivityThresholdParameterValue");

                    Telerik.Web.UI.RadTextBox parameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ActivityThresholdParameterFixedValue");


                    parameterValueSelection.Items.Clear();

                    if (!threshold.Action.ActionParameters[parameterName].Required)
                    {
                        parameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("* Not Assigned", "0"));
                    }



                    bindingContexts = (new Client.Core.Individual.Case.MemberCase(MercuryApplication)).ParameterValueSelection(threshold.Action.ActionParameters[parameterName].DataType);

                    foreach (String currentBindingContextName in bindingContexts.Keys)
                    {
                        parameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentBindingContextName, bindingContexts[currentBindingContextName]));
                    }

                    parameterFixedValue.Enabled = threshold.Action.ActionParameters[parameterName].AllowFixedValue;

                    parameterFixedValue.EmptyMessage = (threshold.Action.ActionParameters[parameterName].AllowFixedValue) ? String.Empty : "(Not Available)";

                    parameterFixedValue.Text = String.Empty;

                    break;
                }
            }

            return;
        }
        protected void ActivityParametersGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            String parameterName;

            Telerik.Web.UI.RadComboBox parameterValueSelection;

            Telerik.Web.UI.RadTextBox parameterFixedValue;

            Client.Core.Individual.CareInterventionActivity careInterventionActivity = EditCareInterventionActivity;


            if (MercuryApplication == null)
            {
                return;
            }


            switch (eventArgs.CommandName)
            {
            case Telerik.Web.UI.RadGrid.EditCommandName:

                #region Edit Command

                Telerik.Web.UI.GridEditCommandColumn editColumn = (Telerik.Web.UI.GridEditCommandColumn)ActivityParametersGrid.MasterTableView.GetColumn("EditCommandColumn");

                if (!editColumn.Visible)
                {
                    editColumn.Visible = true;
                }

                Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.UpdateCommandName:

                #region Update Command

                parameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ActivityParameterValueSelection");

                parameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ActivityParameterFixedValue");

                if ((parameterValueSelection.SelectedItem != null) || (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                {
                    parameterName = (String)((Telerik.Web.UI.GridEditableItem)eventArgs.Item).OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];

                    if ((careInterventionActivity.Action.ActionParameters[parameterName].AllowFixedValue) && (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                    {
                        careInterventionActivity.Action.ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.FixedValue;

                        careInterventionActivity.Action.ActionParameters[parameterName].Value = parameterFixedValue.Text;

                        careInterventionActivity.Action.ActionParameters[parameterName].ValueDescription = parameterFixedValue.Text;
                    }

                    else
                    {
                        careInterventionActivity.Action.ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.DataMapping;

                        careInterventionActivity.Action.ActionParameters[parameterName].Value = parameterValueSelection.SelectedItem.Value;

                        careInterventionActivity.Action.ActionParameters[parameterName].ValueDescription = parameterValueSelection.SelectedItem.Text;
                    }

                    if ((careInterventionActivity.Action.Name == "Workflow") && (parameterName == "Workflow"))
                    {
                        careInterventionActivity.Action.RebindActionParameters(MercuryApplication);
                    }
                }

                #endregion

                break;
            }

            EditCareInterventionActivity = careInterventionActivity;

            InitializeActivityParametersGrid();

            return;
        }
        protected void ConditionEventsGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            String eventName;

            Telerik.Web.UI.RadComboBox conditionEventActionSelection;

            Int64 actionId;

            String parameterName;

            Telerik.Web.UI.RadComboBox parameterValueSelection;

            Telerik.Web.UI.RadTextBox parameterFixedValue;


            if (MercuryApplication == null)
            {
                return;
            }

            switch (eventArgs.CommandName)
            {
            case Telerik.Web.UI.RadGrid.EditCommandName:

                #region Edit Command

                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "ConditionEvent":

                    Telerik.Web.UI.GridEditCommandColumn editColumn = (Telerik.Web.UI.GridEditCommandColumn)ConditionEventsGrid.MasterTableView.GetColumn("EditCommandColumn");

                    if (!editColumn.Visible)
                    {
                        editColumn.Visible = true;
                    }

                    Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                    break;

                case "ConditionEventParameters":

                    editColumn = (Telerik.Web.UI.GridEditCommandColumn)eventArgs.Item.OwnerTableView.GetColumn("EditCommandColumn");

                    if (!editColumn.Visible)
                    {
                        editColumn.Visible = true;
                    }

                    break;
                }

                #endregion

                break;

            case Telerik.Web.UI.RadGrid.UpdateCommandName:

                #region Update Command

                Telerik.Web.UI.GridEditableItem updatedItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;

                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "ConditionEvent":

                    eventName = (String)updatedItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["EventName"];

                    conditionEventActionSelection = (Telerik.Web.UI.RadComboBox)updatedItem.FindControl("ConditionEventActionSelection");

                    actionId = Int64.Parse(conditionEventActionSelection.SelectedValue);

                    condition.Events[eventName] = MercuryApplication.ActionById(actionId);

                    if (condition.Events[eventName] == null)
                    {
                        condition.Events[eventName] = new Mercury.Client.Core.Action.Action(MercuryApplication);
                    }

                    break;

                case "ConditionEventParameters":

                    parameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ConditionEventParameterValueSelection");

                    parameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ConditionEventParameterFixedValue");

                    if ((parameterValueSelection.SelectedItem != null) || (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                    {
                        eventName = (String)updatedItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["EventName"];

                        parameterName = (String)((Telerik.Web.UI.GridEditableItem)eventArgs.Item).OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];


                        if ((condition.Events[eventName].ActionParameters[parameterName].AllowFixedValue) && (!String.IsNullOrEmpty(parameterFixedValue.Text)))
                        {
                            condition.Events[eventName].ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.FixedValue;

                            condition.Events[eventName].ActionParameters[parameterName].Value = parameterFixedValue.Text;

                            condition.Events[eventName].ActionParameters[parameterName].ValueDescription = parameterFixedValue.Text;
                        }

                        else
                        {
                            condition.Events[eventName].ActionParameters[parameterName].ValueType = Mercury.Server.Application.ActionParameterValueType.DataMapping;

                            condition.Events[eventName].ActionParameters[parameterName].Value = parameterValueSelection.SelectedItem.Value;

                            condition.Events[eventName].ActionParameters[parameterName].ValueDescription = parameterValueSelection.SelectedItem.Text;
                        }

                        if ((condition.Events[eventName].Name == "Workflow") && (parameterName == "Workflow"))
                        {
                            condition.Events[eventName].RebindActionParameters(MercuryApplication);
                        }
                    }

                    break;
                }

                #endregion

                break;
            }


            return;
        }
        protected void ConditionEventsGrid_OnItemDataBound(Object sender, Telerik.Web.UI.GridItemEventArgs eventArgs)
        {
            Telerik.Web.UI.RadComboBox conditionEventActionSelection;

            Telerik.Web.UI.RadComboBox conditionEventParameterValueSelection;

            Telerik.Web.UI.RadTextBox conditionEventParameterFixedValue;

            System.Collections.Generic.Dictionary <String, String> bindingContexts;

            String eventName;

            String parameterName;


            if (MercuryApplication == null)
            {
                return;
            }

            if ((eventArgs.Item is Telerik.Web.UI.GridEditableItem) && (eventArgs.Item.IsInEditMode))
            {
                Telerik.Web.UI.GridEditableItem editItem = (Telerik.Web.UI.GridEditableItem)eventArgs.Item;


                switch (eventArgs.Item.OwnerTableView.Name)
                {
                case "ConditionEvent":

                    conditionEventActionSelection = (Telerik.Web.UI.RadComboBox)editItem.FindControl("ConditionEventActionSelection");

                    conditionEventActionSelection.Items.Clear();

                    conditionEventActionSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("* No Action Selected", "0"));

                    foreach (Mercury.Server.Application.Action currentAction in MercuryApplication.ActionsAvailable(false))
                    {
                        conditionEventActionSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentAction.Name, currentAction.Id.ToString()));
                    }


                    if (eventArgs.Item.ItemIndex != -1)
                    {
                        eventName = (String)editItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["EventName"];

                        conditionEventActionSelection.SelectedValue = condition.Events[eventName].Id.ToString();
                    }

                    break;


                case "ConditionEventParameters":

                    eventName = (String)editItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["EventName"];

                    parameterName = (String)editItem.OwnerTableView.DataKeyValues[eventArgs.Item.ItemIndex]["ParameterName"];

                    conditionEventParameterValueSelection = (Telerik.Web.UI.RadComboBox)eventArgs.Item.FindControl("ConditionEventParameterValueSelection");

                    conditionEventParameterValueSelection.Items.Clear();

                    if (!condition.Events[eventName].ActionParameters[parameterName].Required)
                    {
                        conditionEventParameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem("* Not Assigned", "0"));
                    }

                    bindingContexts = condition.ParameterValueSelection(condition.Events[eventName].ActionParameters[parameterName].DataType);

                    foreach (String currentBindingContextName in bindingContexts.Keys)
                    {
                        conditionEventParameterValueSelection.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentBindingContextName, bindingContexts[currentBindingContextName]));
                    }

                    conditionEventParameterFixedValue = (Telerik.Web.UI.RadTextBox)eventArgs.Item.FindControl("ConditionEventParameterFixedValue");

                    conditionEventParameterFixedValue.Enabled = condition.Events[eventName].ActionParameters[parameterName].AllowFixedValue;

                    conditionEventParameterFixedValue.EmptyMessage = (condition.Events[eventName].ActionParameters[parameterName].AllowFixedValue) ? String.Empty : "(Not Available)";

                    conditionEventParameterFixedValue.Text = String.Empty;

                    break;
                }
            }

            return;
        }
Esempio n. 13
0
        protected void GrdPatientLabs_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is Telerik.Web.UI.GridEditableItem && e.Item.IsInEditMode)
            {
                try
                {
                    Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem;

                    Telerik.Web.UI.GridEditManager editMan = editedItem.EditManager;

                    Telerik.Web.UI.GridDropDownListColumnEditor editor = (Telerik.Web.UI.GridDropDownListColumnEditor)(editMan.GetColumnEditor("LstDoctors"));
                    editor.DataSource     = Data.DataProvider.Instance().GetDoctors();
                    editor.DataValueField = "Id";
                    editor.DataTextField  = "DisplayName";
                    editor.DataBind();

                    editor.ComboBoxControl.Width        = 400;
                    editor.ComboBoxControl.Font.Size    = 10;
                    editor.ComboBoxControl.EmptyMessage = "Seleccione un Doctor";

                    if (editedItem.DataItem != null && editedItem.DataItem is System.Data.DataRowView)
                    {
                        System.Data.DataRowView dataItem = (System.Data.DataRowView)editedItem.DataItem;
                        if (dataItem != null)
                        {
                            editor.SelectedValue = dataItem["DoctorId"].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogError(ex.Message);
                    DisplayAlert(ex.Message);
                }
            }

            if (e.Item is Telerik.Web.UI.GridDataItem)
            {
                Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)e.Item;
                string status  = dataItem["Status"].Text;
                string LabName = dataItem["LabName"].Text;

                Telerik.Web.UI.ElasticButton editControl   = (Telerik.Web.UI.ElasticButton)dataItem["EditColumn"].Controls[0];
                Telerik.Web.UI.ElasticButton deleteControl = (Telerik.Web.UI.ElasticButton)dataItem["DeleteColumn"].Controls[0];

                deleteControl.ToolTip = "Eliminar";

                if (status == "Procesado")
                {
                    editControl.Enabled     = false;
                    editControl.ForeColor   = System.Drawing.Color.LightGray;
                    deleteControl.Enabled   = false;
                    deleteControl.ForeColor = System.Drawing.Color.LightGray;
                }
                else
                {
                    deleteControl.Attributes["onclick"] = "if (!confirm('¿Desea borrar el laboratorio " + LabName + "? Se borraran todos los datos relacionados al mismo')) {return false;}";
                }
            }

            if (e.Item is Telerik.Web.UI.GridCommandItem)
            {
                Telerik.Web.UI.GridCommandItem   cmditm = (Telerik.Web.UI.GridCommandItem)e.Item;
                System.Web.UI.WebControls.Button btn1   = (System.Web.UI.WebControls.Button)cmditm.FindControl("AddNewRecordButton");

                if (string.IsNullOrEmpty(CmbPatientsLabs.SelectedValue))
                {
                    btn1.Visible = false;
                }
                else
                {
                    btn1.Visible = true;
                }
            }
        }
Esempio n. 14
0
        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);
                }
            }
        }
Esempio n. 15
0
        protected void GrdLabDetails_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.Item is Telerik.Web.UI.GridEditableItem)
            {
                try
                {
                    int    LabId        = 0;
                    string LabDetail    = string.Empty;
                    string LabResult    = string.Empty;
                    string LabReference = string.Empty;
                    string LabUnit      = string.Empty;
                    bool   Remark       = false;

                    foreach (Telerik.Web.UI.GridDataItem item in GrdPatientLabs.SelectedItems)
                    {
                        LabId = int.Parse(item["Id"].Text);
                    }

                    if (LabId == 0)
                    {
                        DisplayAlert("Debe seleccionar un laboratorio primero.", "Alerta", "Alert");
                        e.Canceled = true;
                        return;
                    }

                    Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem;

                    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(LabId, LabDetail, LabResult, LabReference, LabUnit, Remark, UserId);
                    GrdLabDetails.Rebind();
                    DisplayAlert("Resultado agregado correctamente", "Laboratorio Agregado", "Info");
                }
                catch (Exception ex)
                {
                    e.Canceled = true;

                    DisplayAlert(ex);
                }
            }
        }
Esempio n. 16
0
        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("&nbsp;", 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);
                }
            }
        }