using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using abcUtils=ViziGenLtd.abcUtils;
using BL = ViziGenLtd.ViziGenBL;

public partial class ProductMM : MMPageBase
{
    // ----------------------------------------------------------------------------------
    // Enums
    // ----------------------------------------------------------------------------------
    private enum eView
    {
        vNew,
        vNewDone,
        vReview,
        vEdit,
        vEditDone,
        vDelete,
        vDeleteDone,
        vHelpProductName,
        vHelpDownloadFileName,
        vHelpApplication,
        vHelpVersion,
        vHelpBeta,
        vHelpDateStartSubscription,
        vHelpDateEndSubscription,
        vHelpDateStartDownload,
        vHelpDateEndDownload,
        vPickDateStartSubscription,
        vPickDateEndSubscription,
        vPickDateStartDownload,
        vPickDateEndDownload,
    }
    // ----------------------------------------------------------------------------------
    // ViewState
    // ----------------------------------------------------------------------------------
    /// <summary>
    /// Holds ViewState key for the attribute DateStartSubscription
    /// </summary>
    private static string m_sViewStateKeyDateStartSubscription;

    /// <summary>
    /// ViewState value with key of "vsKey_DateStartSubscription"
    /// </summary>
    private DateTime? vsDateStartSubscription
    {
        get
        {
            DateTime? value = null;
            Object oValue = ViewState[m_sViewStateKeyDateStartSubscription];
            if (oValue != null)
            {
                value = (DateTime?)oValue;
            }
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyDateStartSubscription] = value;
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute DateEndSubscription
    /// </summary>
    private static string m_sViewStateKeyDateEndSubscription;

    /// <summary>
    /// ViewState value with key of "vsKey_DateEndSubscription"
    /// </summary>
    private DateTime? vsDateEndSubscription
    {
        get
        {
            DateTime? value = null;
            Object oValue = ViewState[m_sViewStateKeyDateEndSubscription];
            if (oValue != null)
            {
                value = (DateTime?)oValue;
            }
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyDateEndSubscription] = value;
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute DateStartDownload
    /// </summary>
    private static string m_sViewStateKeyDateStartDownload;

    /// <summary>
    /// ViewState value with key of "vsKey_DateStartDownload"
    /// </summary>
    private DateTime? vsDateStartDownload
    {
        get
        {
            DateTime? value = null;
            Object oValue = ViewState[m_sViewStateKeyDateStartDownload];
            if (oValue != null)
            {
                value = (DateTime?)oValue;
            }
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyDateStartDownload] = value;
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute DateEndDownload
    /// </summary>
    private static string m_sViewStateKeyDateEndDownload;

    /// <summary>
    /// ViewState value with key of "vsKey_DateEndDownload"
    /// </summary>
    private DateTime? vsDateEndDownload
    {
        get
        {
            DateTime? value = null;
            Object oValue = ViewState[m_sViewStateKeyDateEndDownload];
            if (oValue != null)
            {
                value = (DateTime?)oValue;
            }
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyDateEndDownload] = value;
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute Application
    /// </summary>
    private static string m_sViewStateKeyApplication;

    /// <summary>
    /// ViewState value with key of "vsKey_Application"
    /// </summary>
    private int? vsApplication
    {
        get
        {
            int? value = null;
            Object oValue = ViewState[m_sViewStateKeyApplication];
            if (oValue == null)
            {
                value = 0;
            }
            else
            {
                value = (int)oValue;
            }
            return value;
        }
        set
        {
            if (value == 0)
            {
                ViewState[m_sViewStateKeyApplication] = null;
            }
            else
            {
                ViewState[m_sViewStateKeyApplication] = value;
            }
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute Version
    /// </summary>
    private static string m_sViewStateKeyVersion;

    /// <summary>
    /// ViewState value with key of "vsKey_Version"
    /// </summary>
    private int? vsVersion
    {
        get
        {
            int? value = null;
            Object oValue = ViewState[m_sViewStateKeyVersion];
            if (oValue == null)
            {
                value = 0;
            }
            else
            {
                value = (int)oValue;
            }
            return value;
        }
        set
        {
            if (value == 0)
            {
                ViewState[m_sViewStateKeyVersion] = null;
            }
            else
            {
                ViewState[m_sViewStateKeyVersion] = value;
            }
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute Beta
    /// </summary>
    private static string m_sViewStateKeyBeta;

    /// <summary>
    /// ViewState value with key of "vsKey_Beta"
    /// </summary>
    private int? vsBeta
    {
        get
        {
            int? value = null;
            Object oValue = ViewState[m_sViewStateKeyBeta];
            if (oValue == null)
            {
                value = 0;
            }
            else
            {
                value = (int)oValue;
            }
            return value;
        }
        set
        {
            if (value == 0)
            {
                ViewState[m_sViewStateKeyBeta] = null;
            }
            else
            {
                ViewState[m_sViewStateKeyBeta] = value;
            }
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute ProductName
    /// </summary>
    private static string m_sViewStateKeyProductName;

    /// <summary>
    /// ViewState value with key of "vsKey_ProductName"
    /// </summary>
    private string vsProductName
    {
        get
        {
            string value = (string)ViewState[m_sViewStateKeyProductName];
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyProductName] = value;
        }
    }
    /// <summary>
    /// Holds ViewState key for the attribute DownloadFileName
    /// </summary>
    private static string m_sViewStateKeyDownloadFileName;

    /// <summary>
    /// ViewState value with key of "vsKey_DownloadFileName"
    /// </summary>
    private string vsDownloadFileName
    {
        get
        {
            string value = (string)ViewState[m_sViewStateKeyDownloadFileName];
            return value;
        }
        set
        {
            ViewState[m_sViewStateKeyDownloadFileName] = value;
        }
    }
    // ----------------------------------------------------------------------------------
    // Constructors
    // ----------------------------------------------------------------------------------
    /// <summary>
    /// Static constructor
    /// </summary>
    static ProductMM()
    {
        m_sViewStateKeyProductName = "vsKey_ProductName";
        m_sViewStateKeyDownloadFileName = "vsKey_DownloadFileName";
        m_sViewStateKeyApplication = "vsKey_Application";
        m_sViewStateKeyVersion = "vsKey_Version";
        m_sViewStateKeyBeta = "vsKey_Beta";
        m_sViewStateKeyDateStartSubscription = "vsKey_DateStartSubscription";
        m_sViewStateKeyDateEndSubscription = "vsKey_DateEndSubscription";
        m_sViewStateKeyDateStartDownload = "vsKey_DateStartDownload";
        m_sViewStateKeyDateEndDownload = "vsKey_DateEndDownload";
    }
    // ----------------------------------------------------------------------------------
    // Methods
    // ----------------------------------------------------------------------------------
    /// <summary>
    /// Saves a Product object's values in ViewState
    /// </summary>
    private void SaveObject(BL.ProductBL p_Product)
    {
        vsDateStartSubscription = p_Product.DateStartSubscription;
        vsDateEndSubscription = p_Product.DateEndSubscription;
        vsDateStartDownload = p_Product.DateStartDownload;
        vsDateEndDownload = p_Product.DateEndDownload;
        vsProductName = p_Product.ProductName;
        vsDownloadFileName = p_Product.DownloadFileName;
        vsApplication = (int)p_Product.Application;
        vsVersion = (int)p_Product.Version;
        vsBeta = (int)p_Product.Beta;
    }
    /// <summary>
    /// Refreshes a View from ViewState
    /// </summary>
    private void RefreshView(int p_nView)
    {
        eView evView = (eView)p_nView;
        switch (evView)
        {
            case eView.vNew:
            {
                break;
            }
            case eView.vReview:
            {
                if (vsProductName != null)
                {
                    txt_Review_ProductName.Text = vsProductName.ToString();
                }
                if (vsDownloadFileName != null)
                {
                    txt_Review_DownloadFileName.Text = vsDownloadFileName.ToString();
                }
                if (vsApplication != null)
                {
                    txt_Review_Application.Text = vsApplication.ToString();
                }
                if (vsVersion != null)
                {
                    txt_Review_Version.Text = vsVersion.ToString();
                }
                if (vsBeta != null)
                {
                    txt_Review_Beta.Text = vsBeta.ToString();
                }
                if (vsDateStartSubscription != null)
                {
                    txt_Review_DateStartSubscription.Text = vsDateStartSubscription.ToString();
                }
                if (vsDateEndSubscription != null)
                {
                    txt_Review_DateEndSubscription.Text = vsDateEndSubscription.ToString();
                }
                if (vsDateStartDownload != null)
                {
                    txt_Review_DateStartDownload.Text = vsDateStartDownload.ToString();
                }
                if (vsDateEndDownload != null)
                {
                    txt_Review_DateEndDownload.Text = vsDateEndDownload.ToString();
                }
                break;
            }
            case eView.vEdit:
            {
                break;
            }
            case eView.vDelete:
            {
                if (vsProductName != null)
                {
                    txt_Delete_ProductName.Text = vsProductName.ToString();
                }
                if (vsDownloadFileName != null)
                {
                    txt_Delete_DownloadFileName.Text = vsDownloadFileName.ToString();
                }
                if (vsApplication != null)
                {
                    txt_Delete_Application.Text = vsApplication.ToString();
                }
                if (vsVersion != null)
                {
                    txt_Delete_Version.Text = vsVersion.ToString();
                }
                if (vsBeta != null)
                {
                    txt_Delete_Beta.Text = vsBeta.ToString();
                }
                if (vsDateStartSubscription != null)
                {
                    txt_Delete_DateStartSubscription.Text = vsDateStartSubscription.ToString();
                }
                if (vsDateEndSubscription != null)
                {
                    txt_Delete_DateEndSubscription.Text = vsDateEndSubscription.ToString();
                }
                if (vsDateStartDownload != null)
                {
                    txt_Delete_DateStartDownload.Text = vsDateStartDownload.ToString();
                }
                if (vsDateEndDownload != null)
                {
                    txt_Delete_DateEndDownload.Text = vsDateEndDownload.ToString();
                }
                break;
            }
        }
    }
    /// <summary>
    /// Load Product object from database and display details on passed-in eView
    /// </summary>
    /// <param name="p_evView"></param>
    private void DisplayObject(eView p_evView)
    {
        BL.ProductBL oProduct = null;
        try
        {
            // Get the Id of the object
            int nObjectId = ObjectId;

            // Load the object
            oProduct = new BL.ProductBL();
            oProduct.LoadViaId(base.ObjectId);
            if (oProduct.IsLoaded())
            {
                // Save the CCN
                CCN = oProduct.CCN;

                // Populate the view
                switch (p_evView)
                {
                    case eView.vNew:
                    {
                        txt_New_ProductName.Text = oProduct.ProductName_DisplayText;
                        txt_New_DownloadFileName.Text = oProduct.DownloadFileName_DisplayText;
                        txt_New_DateStartSubscription.Text = oProduct.DateStartSubscription_DisplayText;
                        txt_New_DateEndSubscription.Text = oProduct.DateEndSubscription_DisplayText;
                        txt_New_DateStartDownload.Text = oProduct.DateStartDownload_DisplayText;
                        txt_New_DateEndDownload.Text = oProduct.DateEndDownload_DisplayText;
                        ddl_New_Application.EnumToSelect = oProduct.Application;
                        ddl_New_Version.EnumToSelect = oProduct.Version;
                        ddl_New_Beta.EnumToSelect = oProduct.Beta;
                        break;
                    }
                    case eView.vReview:
                    {
                        txt_Review_ProductName.Text = oProduct.ProductName_DisplayText;
                        txt_Review_DownloadFileName.Text = oProduct.DownloadFileName_DisplayText;
                        txt_Review_Application.Text = oProduct.Application_DisplayText;
                        txt_Review_Version.Text = oProduct.Version_DisplayText;
                        txt_Review_Beta.Text = oProduct.Beta_DisplayText;
                        txt_Review_DateStartSubscription.Text = oProduct.DateStartSubscription_DisplayText;
                        txt_Review_DateEndSubscription.Text = oProduct.DateEndSubscription_DisplayText;
                        txt_Review_DateStartDownload.Text = oProduct.DateStartDownload_DisplayText;
                        txt_Review_DateEndDownload.Text = oProduct.DateEndDownload_DisplayText;
                        break;
                    }
                    case eView.vEdit:
                    {
                        txt_Edit_ProductName.Text = oProduct.ProductName_DisplayText;
                        txt_Edit_DownloadFileName.Text = oProduct.DownloadFileName_DisplayText;
                        txt_Edit_DateStartSubscription.Text = oProduct.DateStartSubscription_DisplayText;
                        txt_Edit_DateEndSubscription.Text = oProduct.DateEndSubscription_DisplayText;
                        txt_Edit_DateStartDownload.Text = oProduct.DateStartDownload_DisplayText;
                        txt_Edit_DateEndDownload.Text = oProduct.DateEndDownload_DisplayText;
                        ddl_Edit_Application.EnumToSelect = oProduct.Application;
                        ddl_Edit_Version.EnumToSelect = oProduct.Version;
                        ddl_Edit_Beta.EnumToSelect = oProduct.Beta;
                        break;
                    }
                    case eView.vDelete:
                    {
                        txt_Delete_ProductName.Text = oProduct.ProductName_DisplayText;
                        txt_Delete_DownloadFileName.Text = oProduct.DownloadFileName_DisplayText;
                        txt_Delete_Application.Text = oProduct.Application_DisplayText;
                        txt_Delete_Version.Text = oProduct.Version_DisplayText;
                        txt_Delete_Beta.Text = oProduct.Beta_DisplayText;
                        txt_Delete_DateStartSubscription.Text = oProduct.DateStartSubscription_DisplayText;
                        txt_Delete_DateEndSubscription.Text = oProduct.DateEndSubscription_DisplayText;
                        txt_Delete_DateStartDownload.Text = oProduct.DateStartDownload_DisplayText;
                        txt_Delete_DateEndDownload.Text = oProduct.DateEndDownload_DisplayText;
                        break;
                    }
                }
            }
            else
            {
                // Display error message saying that the Product has been deleted
                string sErrMsg = Resources.UserStringsGenerated.Validation_Deleted;
                switch (p_evView)
                {
                    case eView.vReview:
                    {
                        valSumReview.HeaderText = string.Empty;
                        cv_Review_Form.Text = string.Format(sErrMsg, "Product");
                        cv_Review_Form.IsValid = false;
                        break;
                    }
                    case eView.vEdit:
                    {
                        valSumEdit.HeaderText = string.Empty;
                        cv_Edit_Form.Text = string.Format(sErrMsg, "Product");
                        cv_Edit_Form.IsValid = false;
                        btn_OK_Edit.Enabled = false;
                        break;
                    }
                    case eView.vDelete:
                    {
                        valSumDelete.HeaderText = string.Empty;
                        cv_Delete_Form.Text = string.Format(sErrMsg, "Product");
                        cv_Delete_Form.IsValid = false;
                        btn_OK_Delete.Enabled = false;
                        break;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
            if (oProduct != null)
            {
                oProduct.Dispose();
            }
        }
    }
    /// <summary>
    /// Displays errors on vNew
    /// </summary>
    /// <param name="p_ErrorDetails"></param>
    private void DisplayErrorsNew(List<abcUtils.ErrorDetail> p_ErrorDetails)
    {
        string sErrMsg = "<img src='/ViziGenWeb/App_Themes/ViziGen/Images/Error.gif' alt='{0}' />";
        bool bDisplayStarMsg = false;
        foreach (abcUtils.ErrorDetail oErrorDetail in p_ErrorDetails)
        {
            switch (oErrorDetail.Ordinal)
            {
                case (int)(BL.ProductBL.Column.ProductName):
                {
                    cv_New_ProductName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_ProductName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DownloadFileName):
                {
                    cv_New_DownloadFileName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_DownloadFileName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Application):
                {
                    cv_New_Application.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_Application.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Version):
                {
                    cv_New_Version.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_Version.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Beta):
                {
                    cv_New_Beta.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_Beta.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartSubscription):
                {
                    cv_New_DateStartSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_DateStartSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndSubscription):
                {
                    cv_New_DateEndSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_DateEndSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartDownload):
                {
                    cv_New_DateStartDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_DateStartDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndDownload):
                {
                    cv_New_DateEndDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_New_DateEndDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                default:
                {
                    cv_New_Form.Text = oErrorDetail.ErrorMessage;
                    cv_New_Form.IsValid = false;
                    break;
                }
            }
        }
        if (bDisplayStarMsg)
        {
            valSumNew.Visible = true;
        }
        else
        {
            valSumNew.Visible = false;
        }
    }
    /// <summary>
    /// Displays errors on vEdit
    /// </summary>
    /// <param name="p_ErrorDetails"></param>
    private void DisplayErrorsEdit(List<abcUtils.ErrorDetail> p_ErrorDetails)
    {
        string sErrMsg = "<img src='/ViziGenWeb/App_Themes/ViziGen/Images/Error.gif' alt='{0}' />";
        bool bDisplayStarMsg = false;
        foreach (abcUtils.ErrorDetail oErrorDetail in p_ErrorDetails)
        {
            switch (oErrorDetail.Ordinal)
            {
                case (int)(BL.ProductBL.Column.ProductName):
                {
                    cv_Edit_ProductName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_ProductName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DownloadFileName):
                {
                    cv_Edit_DownloadFileName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_DownloadFileName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Application):
                {
                    cv_Edit_Application.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_Application.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Version):
                {
                    cv_Edit_Version.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_Version.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Beta):
                {
                    cv_Edit_Beta.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_Beta.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartSubscription):
                {
                    cv_Edit_DateStartSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_DateStartSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndSubscription):
                {
                    cv_Edit_DateEndSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_DateEndSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartDownload):
                {
                    cv_Edit_DateStartDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_DateStartDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndDownload):
                {
                    cv_Edit_DateEndDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Edit_DateEndDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                default:
                {
                    cv_Edit_Form.Text = oErrorDetail.ErrorMessage;
                    cv_Edit_Form.IsValid = false;
                    break;
                }
            }
        }
        if (bDisplayStarMsg)
        {
            valSumEdit.Visible = true;
        }
        else
        {
            valSumEdit.Visible = false;
        }
    }
    /// <summary>
    /// Displays errors on vDelete
    /// </summary>
    /// <param name="p_ErrorDetails"></param>
    private void DisplayErrorsDelete(List<abcUtils.ErrorDetail> p_ErrorDetails)
    {
        string sErrMsg = "<img src='/ViziGenWeb/App_Themes/ViziGen/Images/Error.gif' alt='{0}' />";
        bool bDisplayStarMsg = false;
        foreach (abcUtils.ErrorDetail oErrorDetail in p_ErrorDetails)
        {
            switch (oErrorDetail.Ordinal)
            {
                case (int)(BL.ProductBL.Column.ProductName):
                {
                    cv_Delete_ProductName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_ProductName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DownloadFileName):
                {
                    cv_Delete_DownloadFileName.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_DownloadFileName.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Application):
                {
                    cv_Delete_Application.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_Application.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Version):
                {
                    cv_Delete_Version.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_Version.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.Beta):
                {
                    cv_Delete_Beta.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_Beta.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartSubscription):
                {
                    cv_Delete_DateStartSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_DateStartSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndSubscription):
                {
                    cv_Delete_DateEndSubscription.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_DateEndSubscription.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateStartDownload):
                {
                    cv_Delete_DateStartDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_DateStartDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                case (int)(BL.ProductBL.Column.DateEndDownload):
                {
                    cv_Delete_DateEndDownload.Text = string.Format(sErrMsg, oErrorDetail.ErrorMessage);
                    cv_Delete_DateEndDownload.IsValid = false;
                    bDisplayStarMsg = true;
                    break;
                }

                default:
                {
                    cv_Delete_Form.Text = oErrorDetail.ErrorMessage;
                    cv_Delete_Form.IsValid = false;
                    break;
                }
            }
        }
        if (bDisplayStarMsg)
        {
            valSumDelete.Visible = true;
        }
        else
        {
            valSumDelete.Visible = false;
        }
    }
    // ----------------------------------------------------------------------------------
    // Event Handlers
    // ----------------------------------------------------------------------------------
    /// <summary>
    /// This is called when the page is loaded
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                // Pick up info from calling page
                GetInfoFromCaller();

                if (Direction == eDirection.Forward)
                {
                    // Get the PostBackUrl for the return buttons
                    string sPostBackUrl = base.CreatePostBackUrl(CallingPage, eCapability.Null, eDirection.Backward);

                    // Activate the appropriate view for the OpCode
                    switch (OpCode)
                    {
                        case eCapability.New:
                        {
                            // Set up the return buttons on vNew
                            btn_Cancel_New.PostBackUrl = sPostBackUrl;
                            btn_OK_NewDone.PostBackUrl = sPostBackUrl;

                            // Display vNew
                            mvForm.ActiveViewIndex = (int)eView.vNew;
                            break;
                        }
                        case eCapability.Edit:
                        {
                            // Set up the return buttons on vEdit
                            btn_Cancel_Edit.PostBackUrl = sPostBackUrl;
                            btn_OK_EditDone.PostBackUrl = sPostBackUrl;

                            // Load and display the object on vEdit
                            DisplayObject(eView.vEdit);

                            // Display vEdit
                            mvForm.ActiveViewIndex = (int)eView.vEdit;
                            break;
                        }
                        case eCapability.Review:
                        {
                            // Set up the return buttons on vReview
                            btn_OK_Review.PostBackUrl = sPostBackUrl;

                            // Load and display the object on vEdit
                            DisplayObject(eView.vReview);

                            // Display vReview
                            mvForm.ActiveViewIndex = (int)eView.vReview;
                            break;
                        }
                        case eCapability.Delete:
                        {
                            // Set up the return buttons on vDelete
                            btn_Cancel_Delete.PostBackUrl = sPostBackUrl;
                            this.btn_OK_DeleteDone.PostBackUrl = sPostBackUrl;

                            // Load and display the object on vEdit
                            DisplayObject(eView.vDelete);

                            // Display vDelete
                            mvForm.ActiveViewIndex = (int)eView.vDelete;
                            break;
                        }
                        default:
                        {
                            string sErrMsg = Resources.SystemStringsGenerated.Exception_Page_OpCode;
                            sErrMsg = string.Format(sErrMsg, OpCode.ToString(), "ProductMM.aspx");
                            Exception ex = new Exception(sErrMsg);
                            throw ex;
                        }
                    }
                }
                else
                {
                    string sErrMsg = Resources.SystemStringsGenerated.Exception_Page_Direction;
                    sErrMsg = string.Format(sErrMsg, Direction.ToString(), "ProductMM.aspx");
                    Exception ex = new Exception(sErrMsg);
                    throw ex;
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Add button is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_New_Click(object sender, EventArgs e)
    {
        BL.ProductBL oProduct = null;
        try
        {
            if (Page.IsValid)
            {
                // Create a new Product object
                oProduct = new BL.ProductBL();

                // Create a collection for any errors
                List<abcUtils.ErrorDetail> oErrorDetails = new List<abcUtils.ErrorDetail>();

                // Update the Product object
                oProduct.ProductName_Set(txt_New_ProductName.Text, oErrorDetails);
                oProduct.DownloadFileName_Set(txt_New_DownloadFileName.Text, oErrorDetails);
                oProduct.DateStartSubscription_Set(txt_New_DateStartSubscription.Text, oErrorDetails);
                oProduct.DateEndSubscription_Set(txt_New_DateEndSubscription.Text, oErrorDetails);
                oProduct.DateStartDownload_Set(txt_New_DateStartDownload.Text, oErrorDetails);
                oProduct.DateEndDownload_Set(txt_New_DateEndDownload.Text, oErrorDetails);
                oProduct.Application_Set(ddl_New_Application.GetSelectedEnum(),oErrorDetails);
                oProduct.Version_Set(ddl_New_Version.GetSelectedEnum(),oErrorDetails);
                oProduct.Beta_Set(ddl_New_Beta.GetSelectedEnum(),oErrorDetails);

                // Validate the Product object
                oProduct.Validate(oErrorDetails);

                if (oErrorDetails.Count == 0)
                {
                    // Save the Product object
                    oProduct.Save();

                    // Check for errors
                    if (oProduct.ErrorDetails.Count == 0)
                    {
                        if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.Loaded_Clean)
                        {
                            // Display vNewDone
                            mvForm.ActiveViewIndex = (int)eView.vNewDone;
                        }
                        else if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.ChangeFailure_NotUnique)
                        {
                            // Validate the object again to discover which keys aren't unique
                            oProduct.Validate(oErrorDetails);

                            // Display the errors
                            DisplayErrorsNew(oErrorDetails);
                        }
                    }
                    else
                    {
                        DisplayErrorsEdit(oProduct.ErrorDetails);
                    }
                }
                else
                {
                    DisplayErrorsNew(oErrorDetails);
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
            if (oProduct != null)
            {
                oProduct.Dispose();
            }
        }
    }
    /// <summary>
    /// This is called when the data picker button for DateStartSubscription is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_New_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the DatePicker view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Set the date on the DatePicker View
            if (string.IsNullOrEmpty(txt_New_DateStartSubscription.Text))
            {
                cal_DateStartSubscription.SelectedDate = DateTime.Today;
                cal_DateStartSubscription.VisibleDate = DateTime.Today;
            }
            else
            {
                cal_DateStartSubscription.SelectedDate = DateTime.Parse(txt_New_DateStartSubscription.Text);
                cal_DateStartSubscription.VisibleDate = DateTime.Parse(txt_New_DateStartSubscription.Text);
            }

            // Display the DatePicker View for DateStartSubscription
            mvForm.ActiveViewIndex = (int)eView.vPickDateStartSubscription;
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when the data picker button for DateEndSubscription is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_New_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the DatePicker view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Set the date on the DatePicker View
            if (string.IsNullOrEmpty(txt_New_DateEndSubscription.Text))
            {
                cal_DateEndSubscription.SelectedDate = DateTime.Today;
                cal_DateEndSubscription.VisibleDate = DateTime.Today;
            }
            else
            {
                cal_DateEndSubscription.SelectedDate = DateTime.Parse(txt_New_DateEndSubscription.Text);
                cal_DateEndSubscription.VisibleDate = DateTime.Parse(txt_New_DateEndSubscription.Text);
            }

            // Display the DatePicker View for DateEndSubscription
            mvForm.ActiveViewIndex = (int)eView.vPickDateEndSubscription;
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when the data picker button for DateStartDownload is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_New_DatePick_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the DatePicker view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Set the date on the DatePicker View
            if (string.IsNullOrEmpty(txt_New_DateStartDownload.Text))
            {
                cal_DateStartDownload.SelectedDate = DateTime.Today;
                cal_DateStartDownload.VisibleDate = DateTime.Today;
            }
            else
            {
                cal_DateStartDownload.SelectedDate = DateTime.Parse(txt_New_DateStartDownload.Text);
                cal_DateStartDownload.VisibleDate = DateTime.Parse(txt_New_DateStartDownload.Text);
            }

            // Display the DatePicker View for DateStartDownload
            mvForm.ActiveViewIndex = (int)eView.vPickDateStartDownload;
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when the data picker button for DateEndDownload is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_New_DatePick_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the DatePicker view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Set the date on the DatePicker View
            if (string.IsNullOrEmpty(txt_New_DateEndDownload.Text))
            {
                cal_DateEndDownload.SelectedDate = DateTime.Today;
                cal_DateEndDownload.VisibleDate = DateTime.Today;
            }
            else
            {
                cal_DateEndDownload.SelectedDate = DateTime.Parse(txt_New_DateEndDownload.Text);
                cal_DateEndDownload.VisibleDate = DateTime.Parse(txt_New_DateEndDownload.Text);
            }

            // Display the DatePicker View for DateEndDownload
            mvForm.ActiveViewIndex = (int)eView.vPickDateEndDownload;
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when OK is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartSubscription.Text = cal_DateStartSubscription.SelectedDate.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartSubscription.Text = cal_DateStartSubscription.SelectedDate.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when OK is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndSubscription.Text = cal_DateEndSubscription.SelectedDate.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndSubscription.Text = cal_DateEndSubscription.SelectedDate.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when OK is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_DatePick_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartDownload.Text = cal_DateStartDownload.SelectedDate.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartDownload.Text = cal_DateStartDownload.SelectedDate.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when OK is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_DatePick_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndDownload.Text = cal_DateEndDownload.SelectedDate.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndDownload.Text = cal_DateEndDownload.SelectedDate.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Min_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartSubscription.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartSubscription.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Min_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndSubscription.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndSubscription.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Min_DatePick_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartDownload.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartDownload.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Min_DatePick_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndDownload.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndDownload.Text = new DateTime(1753, 1, 1, 12, 0, 0).ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Max_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartSubscription.Text = DateTime.MaxValue.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartSubscription.Text = DateTime.MaxValue.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Max_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndSubscription.Text = DateTime.MaxValue.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndSubscription.Text = DateTime.MaxValue.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Max_DatePick_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartDownload.Text = DateTime.MaxValue.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartDownload.Text = DateTime.MaxValue.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Max_DatePick_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndDownload.Text = DateTime.MaxValue.ToShortDateString();
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndDownload.Text = DateTime.MaxValue.ToShortDateString();
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Clear_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartSubscription.Text = string.Empty;
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartSubscription.Text = string.Empty;
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Clear_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndSubscription.Text = string.Empty;
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndSubscription.Text = string.Empty;
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Clear_DatePick_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateStartDownload.Text = string.Empty;
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateStartDownload.Text = string.Empty;
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when Min is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Clear_DatePick_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            if (HelpDestination == (int)eView.vNew)
            {
                txt_New_DateEndDownload.Text = string.Empty;
            }
            else if (HelpDestination == (int)eView.vEdit)
            {
                txt_Edit_DateEndDownload.Text = string.Empty;
            }
            // Display the view that was showing before the DatePicker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }

    /// <summary>
    /// This is called when SetYear is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetYear_PickDate_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateStartSubscription.SelectedDate;
            DateTime dtNew = new DateTime(int.Parse(txt_Year_PickDateDateStartSubscription.Text),
                dtOld.Month, dtOld.Day, dtOld.Hour, dtOld.Minute, dtOld.Second);
            cal_DateStartSubscription.SelectedDate = dtNew;
            cal_DateStartSubscription.VisibleDate = dtNew;
        }
        catch
        {
        }
    }

    /// <summary>
    /// This is called when SetYear is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetYear_PickDate_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateEndSubscription.SelectedDate;
            DateTime dtNew = new DateTime(int.Parse(txt_Year_PickDateDateEndSubscription.Text),
                dtOld.Month, dtOld.Day, dtOld.Hour, dtOld.Minute, dtOld.Second);
            cal_DateEndSubscription.SelectedDate = dtNew;
            cal_DateEndSubscription.VisibleDate = dtNew;
        }
        catch
        {
        }
    }

    /// <summary>
    /// This is called when SetYear is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetYear_PickDate_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateStartDownload.SelectedDate;
            DateTime dtNew = new DateTime(int.Parse(txt_Year_PickDateDateStartDownload.Text),
                dtOld.Month, dtOld.Day, dtOld.Hour, dtOld.Minute, dtOld.Second);
            cal_DateStartDownload.SelectedDate = dtNew;
            cal_DateStartDownload.VisibleDate = dtNew;
        }
        catch
        {
        }
    }

    /// <summary>
    /// This is called when SetYear is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetYear_PickDate_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateEndDownload.SelectedDate;
            DateTime dtNew = new DateTime(int.Parse(txt_Year_PickDateDateEndDownload.Text),
                dtOld.Month, dtOld.Day, dtOld.Hour, dtOld.Minute, dtOld.Second);
            cal_DateEndDownload.SelectedDate = dtNew;
            cal_DateEndDownload.VisibleDate = dtNew;
        }
        catch
        {
        }
    }

    /// <summary>
    /// This is called when SetYear is clicked on vPickDateStartSubscription (the date picker view for DateStartSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetMonth_PickDate_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateStartSubscription.SelectedDate;
            DateTime dtNew = new DateTime(dtOld.Year,int.Parse(ddl_Month_PickDate_DateStartSubscription.SelectedValue),
                dtOld.Day,dtOld.Hour,dtOld.Minute,dtOld.Second);
            cal_DateStartSubscription.SelectedDate = dtNew;
            cal_DateStartSubscription.VisibleDate = dtNew;
        }
        catch
        {
        }
    }
    /// <summary>
    /// This is called when SetYear is clicked on vPickDateEndSubscription (the date picker view for DateEndSubscription)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetMonth_PickDate_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateEndSubscription.SelectedDate;
            DateTime dtNew = new DateTime(dtOld.Year,int.Parse(ddl_Month_PickDate_DateEndSubscription.SelectedValue),
                dtOld.Day,dtOld.Hour,dtOld.Minute,dtOld.Second);
            cal_DateEndSubscription.SelectedDate = dtNew;
            cal_DateEndSubscription.VisibleDate = dtNew;
        }
        catch
        {
        }
    }
    /// <summary>
    /// This is called when SetYear is clicked on vPickDateStartDownload (the date picker view for DateStartDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetMonth_PickDate_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateStartDownload.SelectedDate;
            DateTime dtNew = new DateTime(dtOld.Year,int.Parse(ddl_Month_PickDate_DateStartDownload.SelectedValue),
                dtOld.Day,dtOld.Hour,dtOld.Minute,dtOld.Second);
            cal_DateStartDownload.SelectedDate = dtNew;
            cal_DateStartDownload.VisibleDate = dtNew;
        }
        catch
        {
        }
    }
    /// <summary>
    /// This is called when SetYear is clicked on vPickDateEndDownload (the date picker view for DateEndDownload)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_SetMonth_PickDate_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dtOld = cal_DateEndDownload.SelectedDate;
            DateTime dtNew = new DateTime(dtOld.Year,int.Parse(ddl_Month_PickDate_DateEndDownload.SelectedValue),
                dtOld.Day,dtOld.Hour,dtOld.Minute,dtOld.Second);
            cal_DateEndDownload.SelectedDate = dtNew;
            cal_DateEndDownload.VisibleDate = dtNew;
        }
        catch
        {
        }
    }
    /// <summary>
    /// This is called when Cancel is clicked on date picker view
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_Cancel_DatePick_Click(object sender, EventArgs e)
    {
        try
        {
            // Display the view that was showing before the date picker view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Update button is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_Edit_Click(object sender, EventArgs e)
    {
        BL.ProductBL oProduct = null;
        try
        {
            if (Page.IsValid)
            {
                // Load the Product object from the database
                oProduct = new BL.ProductBL();
                oProduct.LoadViaId(ObjectId);

                // Was the Product loaded?
                if (oProduct.IsLoaded())
                {
                    // Check the CCN
                    if (oProduct.CCN == this.CCN)
                    {
                        // Create a collection for any errors
                        List<abcUtils.ErrorDetail> oErrorDetails = new List<abcUtils.ErrorDetail>();

                        // Update the Product object
                        oProduct.ProductName_Set(txt_Edit_ProductName.Text,oErrorDetails);
                        oProduct.DownloadFileName_Set(txt_Edit_DownloadFileName.Text,oErrorDetails);
                        oProduct.DateStartSubscription_Set(txt_Edit_DateStartSubscription.Text,oErrorDetails);
                        oProduct.DateEndSubscription_Set(txt_Edit_DateEndSubscription.Text,oErrorDetails);
                        oProduct.DateStartDownload_Set(txt_Edit_DateStartDownload.Text,oErrorDetails);
                        oProduct.DateEndDownload_Set(txt_Edit_DateEndDownload.Text,oErrorDetails);
                        oProduct.Application_Set(ddl_Edit_Application.GetSelectedEnum(), oErrorDetails);
                        oProduct.Version_Set(ddl_Edit_Version.GetSelectedEnum(), oErrorDetails);
                        oProduct.Beta_Set(ddl_Edit_Beta.GetSelectedEnum(), oErrorDetails);

                        if (oErrorDetails.Count == 0)
                        {
                            // Check to see if the Product is dirty
                            if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.Loaded_Clean)
                            {
                                // No changes have been made - issue warning
                                valSumEdit.HeaderText = string.Empty;
                                cv_Edit_Form.Text = Resources.UserStringsGenerated.Validation_NoChanges;
                                cv_Edit_Form.IsValid = false;
                            }
                            else
                            {
                                // Save the Product object
                                oProduct.Save();

                                // Check for errors
                                if (oProduct.ErrorDetails.Count == 0)
                                {
                                    if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.Loaded_Clean)
                                    {
                                        // Display vEditDone
                                        mvForm.ActiveViewIndex = (int)eView.vEditDone;
                                    }
                                    else if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.ChangeFailure_NotUnique)
                                    {
                                        oErrorDetails.Clear();
                                        oProduct.Validate(oErrorDetails);
                                        DisplayErrorsEdit(oErrorDetails);
                                    }
                                    else if (oProduct.eState == ViziGenLtd.abcSql.abcSqlEnums.eState.UpdateFailure_ConcurrencyClash)
                                    {
                                        // The Product has been modified by another user
                                        valSumEdit.HeaderText = string.Empty;
                                        string sErrMsg = Resources.UserStringsGenerated.Validation_Update_CCN;
                                        cv_Edit_Form.Text = string.Format(sErrMsg, "Product");
                                        cv_Edit_Form.IsValid = false;
                                        btn_OK_Edit.Enabled = false;
                                    }
                                }
                                else
                                {
                                    DisplayErrorsEdit(oProduct.ErrorDetails);
                                }
                            }
                        }
                        else
                        {
                            DisplayErrorsEdit(oErrorDetails);
                        }
                    }
                    else
                    {
                        // The Product has been modified by another user
                        valSumEdit.HeaderText = string.Empty;
                        string sErrMsg = Resources.UserStringsGenerated.Validation_Update_CCN;
                        cv_Edit_Form.Text = string.Format(sErrMsg, "Product");
                        cv_Edit_Form.IsValid = false;
                        btn_OK_Edit.Enabled = false;
                    }
                }
                else
                {
                    // The Product has been deleted by another user
                    valSumEdit.HeaderText = string.Empty;
                    string sErrMsg = Resources.UserStringsGenerated.Validation_Deleted;
                    cv_Edit_Form.Text = string.Format(sErrMsg, "Product");
                    cv_Edit_Form.IsValid = false;
                    btn_OK_Edit.Enabled = false;
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
            if (oProduct != null)
            {
                oProduct.Dispose();
            }
        }
    }
        /// <summary>
        /// This is called when the data picker button for DateStartSubscription is clicked on vEdit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Edit_DatePick_DateStartSubscription_Click(object sender, EventArgs e)
        {
            try
            {
                // Set so that the DatePicker view returns to the Edit view
                HelpDestination = (int)eView.vEdit;

                // Set the date on the DatePicker View
                if (string.IsNullOrEmpty(txt_Edit_DateStartSubscription.Text))
                {
                    cal_DateStartSubscription.SelectedDate = DateTime.Today;
                    cal_DateStartSubscription.VisibleDate = DateTime.Today;
                }
                else
                {
                    cal_DateStartSubscription.SelectedDate = DateTime.Parse(txt_Edit_DateStartSubscription.Text);
                    cal_DateStartSubscription.VisibleDate = DateTime.Parse(txt_Edit_DateStartSubscription.Text);
                }

                // Display the DatePicker View for DateStartSubscription
                mvForm.ActiveViewIndex = (int)eView.vPickDateStartSubscription;
            }
            catch (Exception ex)
            {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
            }
            finally
            {
            }
        }

        /// <summary>
        /// This is called when the data picker button for DateEndSubscription is clicked on vEdit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Edit_DatePick_DateEndSubscription_Click(object sender, EventArgs e)
        {
            try
            {
                // Set so that the DatePicker view returns to the Edit view
                HelpDestination = (int)eView.vEdit;

                // Set the date on the DatePicker View
                if (string.IsNullOrEmpty(txt_Edit_DateEndSubscription.Text))
                {
                    cal_DateEndSubscription.SelectedDate = DateTime.Today;
                    cal_DateEndSubscription.VisibleDate = DateTime.Today;
                }
                else
                {
                    cal_DateEndSubscription.SelectedDate = DateTime.Parse(txt_Edit_DateEndSubscription.Text);
                    cal_DateEndSubscription.VisibleDate = DateTime.Parse(txt_Edit_DateEndSubscription.Text);
                }

                // Display the DatePicker View for DateEndSubscription
                mvForm.ActiveViewIndex = (int)eView.vPickDateEndSubscription;
            }
            catch (Exception ex)
            {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
            }
            finally
            {
            }
        }

        /// <summary>
        /// This is called when the data picker button for DateStartDownload is clicked on vEdit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Edit_DatePick_DateStartDownload_Click(object sender, EventArgs e)
        {
            try
            {
                // Set so that the DatePicker view returns to the Edit view
                HelpDestination = (int)eView.vEdit;

                // Set the date on the DatePicker View
                if (string.IsNullOrEmpty(txt_Edit_DateStartDownload.Text))
                {
                    cal_DateStartDownload.SelectedDate = DateTime.Today;
                    cal_DateStartDownload.VisibleDate = DateTime.Today;
                }
                else
                {
                    cal_DateStartDownload.SelectedDate = DateTime.Parse(txt_Edit_DateStartDownload.Text);
                    cal_DateStartDownload.VisibleDate = DateTime.Parse(txt_Edit_DateStartDownload.Text);
                }

                // Display the DatePicker View for DateStartDownload
                mvForm.ActiveViewIndex = (int)eView.vPickDateStartDownload;
            }
            catch (Exception ex)
            {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
            }
            finally
            {
            }
        }

        /// <summary>
        /// This is called when the data picker button for DateEndDownload is clicked on vEdit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Edit_DatePick_DateEndDownload_Click(object sender, EventArgs e)
        {
            try
            {
                // Set so that the DatePicker view returns to the Edit view
                HelpDestination = (int)eView.vEdit;

                // Set the date on the DatePicker View
                if (string.IsNullOrEmpty(txt_Edit_DateEndDownload.Text))
                {
                    cal_DateEndDownload.SelectedDate = DateTime.Today;
                    cal_DateEndDownload.VisibleDate = DateTime.Today;
                }
                else
                {
                    cal_DateEndDownload.SelectedDate = DateTime.Parse(txt_Edit_DateEndDownload.Text);
                    cal_DateEndDownload.VisibleDate = DateTime.Parse(txt_Edit_DateEndDownload.Text);
                }

                // Display the DatePicker View for DateEndDownload
                mvForm.ActiveViewIndex = (int)eView.vPickDateEndDownload;
            }
            catch (Exception ex)
            {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
            }
            finally
            {
            }
        }

    /// <summary>
    /// This is called when the Delete button is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_Delete_Click(object sender, EventArgs e)
    {
        BL.ProductBL oProduct = null;
        try
        {
            if (Page.IsValid)
            {
                // Load the Product object from the database
                oProduct = new BL.ProductBL();
                oProduct.LoadViaId(ObjectId);

                // Was the Product loaded?
                if (oProduct.IsLoaded())
                {
                    // Validate the Product object
                    List<abcUtils.ErrorDetail> oErrorDetails = new List<abcUtils.ErrorDetail>();
                    oProduct.Validate(oErrorDetails);

                    if (oErrorDetails.Count == 0)
                    {
                        // Mark the Product object for deletion
                        oProduct.MarkForDeletion(true);

                        // Save the Product object
                        oProduct.Save();

                        // Display vDeleteDone
                        mvForm.ActiveViewIndex = (int)eView.vDeleteDone;
                    }
                    else
                    {
                        DisplayErrorsDelete(oErrorDetails);
                    }
                }
                else
                {
                    // The Product has been deleted by another user
                    valSumDelete.HeaderText = string.Empty;
                    string sErrMsg = Resources.UserStringsGenerated.Validation_Deleted;
                    cv_Delete_Form.Text = string.Format(sErrMsg, "Product");
                    cv_Delete_Form.IsValid = false;
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
            if (oProduct != null)
            {
                oProduct.Dispose();
            }
        }
    }
    /// <summary>
    /// This is called when the Help button for ProductName is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_ProductName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for ProductName
            mvForm.ActiveViewIndex = (int)eView.vHelpProductName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DownloadFileName is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_DownloadFileName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for DownloadFileName
            mvForm.ActiveViewIndex = (int)eView.vHelpDownloadFileName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Application is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_Application_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for Application
            mvForm.ActiveViewIndex = (int)eView.vHelpApplication;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Version is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_Version_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for Version
            mvForm.ActiveViewIndex = (int)eView.vHelpVersion;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Beta is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_Beta_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for Beta
            mvForm.ActiveViewIndex = (int)eView.vHelpBeta;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartSubscription is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for DateStartSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndSubscription is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for DateEndSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartDownload is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for DateStartDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndDownload is clicked on vNew
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_New_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the New view
            HelpDestination = (int)eView.vNew;

            // Display the Help View for DateEndDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for ProductName is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_ProductName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for ProductName
            mvForm.ActiveViewIndex = (int)eView.vHelpProductName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DownloadFileName is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_DownloadFileName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for DownloadFileName
            mvForm.ActiveViewIndex = (int)eView.vHelpDownloadFileName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Application is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_Application_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for Application
            mvForm.ActiveViewIndex = (int)eView.vHelpApplication;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Version is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_Version_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for Version
            mvForm.ActiveViewIndex = (int)eView.vHelpVersion;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Beta is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_Beta_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for Beta
            mvForm.ActiveViewIndex = (int)eView.vHelpBeta;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartSubscription is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for DateStartSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndSubscription is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for DateEndSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartDownload is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for DateStartDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndDownload is clicked on vReview
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Review_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Review view
            HelpDestination = (int)eView.vReview;

            // Display the Help View for DateEndDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for ProductName is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_ProductName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for ProductName
            mvForm.ActiveViewIndex = (int)eView.vHelpProductName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DownloadFileName is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_DownloadFileName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for DownloadFileName
            mvForm.ActiveViewIndex = (int)eView.vHelpDownloadFileName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Application is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_Application_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for Application
            mvForm.ActiveViewIndex = (int)eView.vHelpApplication;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Version is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_Version_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for Version
            mvForm.ActiveViewIndex = (int)eView.vHelpVersion;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Beta is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_Beta_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for Beta
            mvForm.ActiveViewIndex = (int)eView.vHelpBeta;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartSubscription is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for DateStartSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndSubscription is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for DateEndSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartDownload is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for DateStartDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndDownload is clicked on vEdit
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Edit_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Edit view
            HelpDestination = (int)eView.vEdit;

            // Display the Help View for DateEndDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for ProductName is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_ProductName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for ProductName
            mvForm.ActiveViewIndex = (int)eView.vHelpProductName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DownloadFileName is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_DownloadFileName_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for DownloadFileName
            mvForm.ActiveViewIndex = (int)eView.vHelpDownloadFileName;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Application is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_Application_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for Application
            mvForm.ActiveViewIndex = (int)eView.vHelpApplication;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Version is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_Version_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for Version
            mvForm.ActiveViewIndex = (int)eView.vHelpVersion;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for Beta is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_Beta_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for Beta
            mvForm.ActiveViewIndex = (int)eView.vHelpBeta;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartSubscription is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_DateStartSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for DateStartSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndSubscription is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_DateEndSubscription_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for DateEndSubscription
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndSubscription;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateStartDownload is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_DateStartDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for DateStartDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateStartDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the Help button for DateEndDownload is clicked on vDelete
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_Help_Delete_DateEndDownload_Click(object sender, EventArgs e)
    {
        try
        {
            // Set so that the Help view returns to the Delete view
            HelpDestination = (int)eView.vDelete;

            // Display the Help View for DateEndDownload
            mvForm.ActiveViewIndex = (int)eView.vHelpDateEndDownload;
        }
        catch (Exception ex)
        {
                Utilities.SendExceptionEmail(ex);
                throw (ex);
        }
        finally
        {
        }
    }
    /// <summary>
    /// This is called when the user clicks on the OK button on a Help view
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_Help_Click(object sender, EventArgs e)
    {

        try
        {
            // Display the view that was showing before the Help view was displayed
            mvForm.ActiveViewIndex = HelpDestination;

            // Ensure that all readonly fields are refreshed
            RefreshView(mvForm.ActiveViewIndex);
        }
        catch (Exception ex)
        {
            Utilities.SendExceptionEmail(ex);
            throw (ex);
        }
        finally
        {
        }
    }
}