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 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. 5
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. 6
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;
        }