private void RestoreParameters()
    {
        // Validate parameters
        if (!QueryHelper.ValidateHash("hash"))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: Invalid query hash.");
        }
        Hashtable parameters = WindowHelper.GetItem(QueryHelper.GetString("pid", null)) as Hashtable;

        if (parameters == null)
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are missing, the session might have been lost.");
        }

        // Restore parameters
        mEntityModelName = ValidationHelper.GetString(parameters["EntityModelName"], null);
        mSourceMappingHiddenFieldClientId = ValidationHelper.GetString(parameters["MappingHiddenFieldClientId"], null);
        mSourceMappingPanelClientId       = ValidationHelper.GetString(parameters["MappingPanelClientId"], null);

        // Restore mapping
        string content = ValidationHelper.GetString(parameters["Mapping"], null);

        if (String.IsNullOrEmpty(content))
        {
            mSourceMapping = new Mapping();
        }
        else
        {
            MappingSerializer serializer = new MappingSerializer();
            mSourceMapping = serializer.DeserializeMapping(content);
        }

        // Restore credentials
        content = ValidationHelper.GetString(parameters["Credentials"], null);
        if (String.IsNullOrEmpty(content))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are corrupted.");
        }
        mCredentials = OrganizationCredentials.Deserialize(EncryptionHelper.DecryptData(content).TrimEnd('\0'));
    }
 private void InitializeControls()
 {
     try
     {
         string content = Value as string;
         if (!String.IsNullOrEmpty(content))
         {
             MappingSerializer serializer = new MappingSerializer();
             Mapping           mapping    = serializer.DeserializeMapping(content);
             MappingControl.Mapping = mapping;
             MappingControl.Enabled = Enabled;
         }
         if (Enabled)
         {
             string credentials = GetCredentials();
             if (!String.IsNullOrEmpty(credentials))
             {
                 InitializeEditButton();
             }
             else
             {
                 MessageLabel.InnerHtml = GetString("sf.credentialsrequiredformapping");
                 MessageLabel.Attributes.Add("class", "Red");
                 MessageLabel.Visible      = true;
                 EditMappingButton.Visible = false;
             }
         }
         else
         {
             EditMappingButton.Visible = false;
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
 private void InitializeControls()
 {
     try
     {
         string content = Value as string;
         if (!String.IsNullOrEmpty(content))
         {
             MappingSerializer serializer = new MappingSerializer();
             Mapping mapping = serializer.DeserializeMapping(content);
             MappingControl.Mapping = mapping;
             MappingControl.Enabled = Enabled;
         }
         if (Enabled)
         {
             string credentials = GetCredentials();
             if (!String.IsNullOrEmpty(credentials))
             {
                 InitializeEditButton();
             }
             else
             {
                 MessageLabel.InnerHtml = GetString("sf.credentialsrequiredformapping");
                 MessageLabel.Attributes.Add("class", "Red");
                 MessageLabel.Visible = true;
                 EditMappingButton.Visible = false;
             }
         }
         else
         {
             EditMappingButton.Visible = false;
         }
     }
     catch (Exception exception)
     {
         HandleError(exception);
     }
 }
    private void RestoreParameters()
    {
        // Validate parameters
        if (!QueryHelper.ValidateHash("hash"))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: Invalid query hash.");
        }
        Hashtable parameters = WindowHelper.GetItem(QueryHelper.GetString("pid", null)) as Hashtable;
        if (parameters == null)
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are missing, the session might have been lost.");
        }

        // Restore parameters
        mEntityModelName = ValidationHelper.GetString(parameters["EntityModelName"], null);
        mSourceMappingHiddenFieldClientId = ValidationHelper.GetString(parameters["MappingHiddenFieldClientId"], null);
        mSourceMappingPanelClientId = ValidationHelper.GetString(parameters["MappingPanelClientId"], null);

        // Restore mapping
        string content = ValidationHelper.GetString(parameters["Mapping"], null);
        if (String.IsNullOrEmpty(content))
        {
            mSourceMapping = new Mapping();
        }
        else
        {
            MappingSerializer serializer = new MappingSerializer();
            mSourceMapping = serializer.DeserializeMapping(content);
        }

        // Restore credentials
        content = ValidationHelper.GetString(parameters["Credentials"], null);
        if (String.IsNullOrEmpty(content))
        {
            throw new Exception("[SalesForceMappingEditorPage.RestoreParameters]: The dialog page parameters are corrupted.");
        }
        mCredentials = OrganizationCredentials.Deserialize(EncryptionHelper.DecryptData(content).TrimEnd('\0'));
    }