Inheritance: FuelSDK.DataExtensionObject
        public Response ActivateMeta(MetaSearchModel metaSearchModel)
        {
            var response = new Response { Success = true, Warning = false };
            try
            {
                var deRowPost = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente,
                    DataExtensionName = "METASAPPBENEFICIOS",
                };

                deRowPost.ColumnValues.Add("ID", metaSearchModel.Id);
                deRowPost.ColumnValues.Add("ACTIVED", "TRUE");

                try
                {
                    var postResponse = deRowPost.Patch();
                    response.Success = postResponse.Status;
                    response.Message = postResponse.Message;
                    response.Code = postResponse.Code;
                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        public Response UpdateRowsByExtensionName(DataExtensionRowHead dataExtensionRowHead)
        {
            var response = new Response { Success = true, Warning = false };
            try
            {
                var deRowPost = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente,
                    DataExtensionName = dataExtensionRowHead.DataExtensionName,
                };

                foreach (var dataExtensionRow in dataExtensionRowHead.DataExtensionRowList)
                {
                    deRowPost.ColumnValues.Add(dataExtensionRow.Nombre, dataExtensionRow.Valor);
                }

                try
                {
                    var postResponse = deRowPost.Patch();
                    response.Success = postResponse.Status;
                    response.Message = postResponse.Message;
                    response.Code = postResponse.Code;
                    response.Data = postResponse.Results;
                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        public Response GetRow(DataExtensionSearch dataExtensionSearch)
        {
            var response = new Response { Success = true, Warning = false };
            try
            {
                var deRowGet = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente,
                    DataExtensionName = dataExtensionSearch.Nombre,
                    Props = dataExtensionSearch.Columnas,
                    SearchFilter = new SimpleFilterPart { Property = dataExtensionSearch.FilterName, SimpleOperator = SimpleOperators.equals, Value = new[] { dataExtensionSearch.FilterValue } }
                };

                try
                {
                    var getResponse = deRowGet.Get();
                    response.Success = getResponse.Status;
                    response.Message = getResponse.Message;
                    response.Code = getResponse.Code;
                    response.Data = getResponse.Results;
                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        public Response GetMeta(MetaSearchModel metaSearchModel)
        {
            var response = new Response { Success = true, Warning = false };
            var metaModel = new MetaModel();

            try
            {
                var deMetaRowGet = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente,
                    DataExtensionName = "METASAPPBENEFICIOS",
                    Props = new[] { "ID", "NUMERODOCUMENTO", "IMAGEN", "TITLE", "POINT", "ACTIVED", "CONTENT", "HEADCONTENT", "CONTENTDETAIL", "LEGAL", "ICONOPROMO" },
                    SearchFilter = new SimpleFilterPart { Property = "ID", SimpleOperator = SimpleOperators.equals, Value = new[] { metaSearchModel.Id } }
                };

                try
                {
                    var getMetaResponse = deMetaRowGet.Get();
                    response.Success = getMetaResponse.Status;
                    response.Message = getMetaResponse.Message;
                    response.Code = getMetaResponse.Code;

                    if (response.Success)
                    {
                        foreach (ET_DataExtensionRow columnMeta in getMetaResponse.Results)
                        {
                            metaModel.Id = columnMeta.ColumnValues["ID"];
                            metaModel.NumeroDocumento = columnMeta.ColumnValues["NUMERODOCUMENTO"];
                            metaModel.Imagen = columnMeta.ColumnValues["IMAGEN"];
                            metaModel.Title = columnMeta.ColumnValues["TITLE"];
                            metaModel.Point = columnMeta.ColumnValues["POINT"];
                            metaModel.Actived = columnMeta.ColumnValues["ACTIVED"];
                            metaModel.Content = columnMeta.ColumnValues["CONTENT"] + "?Id=" + metaModel.Id;
                            metaModel.HeadContent = columnMeta.ColumnValues["HEADCONTENT"];
                            metaModel.ContentDetail = columnMeta.ColumnValues["CONTENTDETAIL"];
                            metaModel.Legal = columnMeta.ColumnValues["LEGAL"];
                            metaModel.IconoPromo = columnMeta.ColumnValues["ICONOPROMO"];

                            #region CreditCards

                            var deCreditRowGet = new ET_DataExtensionRow
                            {
                                AuthStub = conexion.ETCliente,
                                DataExtensionName = "CREDITCARDSBENEFICIOS",
                                Props = new[] { "ID", "NAME", "URL", "METAID" },
                                SearchFilter = new SimpleFilterPart { Property = "METAID", SimpleOperator = SimpleOperators.equals, Value = new[] { metaModel.Id } }
                            };

                            var getCreditResponse = deCreditRowGet.Get();
                            response.Success = getCreditResponse.Status;
                            response.Message = getCreditResponse.Message;
                            response.Code = getCreditResponse.Code;

                            if (response.Success)
                            {
                                foreach (ET_DataExtensionRow columnCredit in getCreditResponse.Results)
                                {
                                    var creditModel = new CreditCardModel();
                                    creditModel.Id = columnCredit.ColumnValues["ID"];
                                    creditModel.MetaId = metaModel.Id;
                                    creditModel.Name = columnCredit.ColumnValues["NAME"];
                                    creditModel.Url = columnCredit.ColumnValues["URL"];

                                    metaModel.CredictCardList.Add(creditModel);
                                }
                            }
                            else
                            {
                                break;
                            }

                            #endregion

                            #region Targets

                            var deTargetRowGet = new ET_DataExtensionRow
                            {
                                AuthStub = conexion.ETCliente,
                                DataExtensionName = "TARGETSBENEFICIOS",
                                Props = new[] { "ID", "VALUE", "TEXT", "METAID" },
                                SearchFilter = new SimpleFilterPart { Property = "METAID", SimpleOperator = SimpleOperators.equals, Value = new[] { metaModel.Id } }
                            };

                            var getTargetResponse = deTargetRowGet.Get();
                            response.Success = getTargetResponse.Status;
                            response.Message = getTargetResponse.Message;
                            response.Code = getTargetResponse.Code;

                            if (response.Success)
                            {
                                foreach (ET_DataExtensionRow columnTarget in getTargetResponse.Results)
                                {
                                    var targetModel = new TargetModel();
                                    targetModel.Id = columnTarget.ColumnValues["ID"];
                                    targetModel.MetaId = metaModel.Id;
                                    targetModel.Value = columnTarget.ColumnValues["VALUE"];
                                    targetModel.Text = columnTarget.ColumnValues["TEXT"];

                                    metaModel.TargetList.Add(targetModel);
                                }
                            }
                            else
                            {
                                break;
                            }

                            #endregion
                        }

                        response.Data = metaModel;
                    }

                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        public Response GetInfo()
        {
            var response = new Response { Success = true, Warning = false };
            try
            {
                var deRowPost = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente
                };

                try
                {
                    var postResponse = deRowPost.Info();
                    response.Success = postResponse.Status;
                    response.Message = postResponse.Message;
                    response.Code = postResponse.Code;
                    response.Data = postResponse.Results;
                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        public Response GetAllRow(DataExtensionSearch dataExtensionSearch)
        {
            var response = new Response { Success = true, Warning = false };
            try
            {
                var deRowGet = new ET_DataExtensionRow
                {
                    AuthStub = conexion.ETCliente,
                    DataExtensionName = dataExtensionSearch.Nombre,
                    Props = dataExtensionSearch.Columnas
                };

                try
                {
                    var getResponse = deRowGet.Get();
                    response.Success = getResponse.Status;
                    response.Message = getResponse.Message;
                    response.Code = getResponse.Code;
                    response.Data = getResponse.Results;
                }
                catch (Exception exCreate)
                {
                    response.Success = false;
                    response.Message = exCreate.Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return response;
        }
        // ------------------------------------------------------------
        // Name: UpdateConvertedProspects
        // Abstract: Retrieve subscribers from a list
        // ------------------------------------------------------------
        public static void SetPublicationListBooleans()
        {
            Dictionary<string, string> dctNewsletterListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDENewsletterSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctRemindersListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDERemindersSubscribers = new Dictionary<string, string>();

            List<string> alstrValidSubscriberKeys = new List<string>();

            try
            {
                string strSubscriberKey = "";
                string strStatus = "";
                string strDEStatus = "";
                int intUpdateRecordCount = 0;
                int intResults = 0;
                string x;

                // Data
                DateTime dtmCreatedDate = DateTime.Now;


                // Newsletter Publication List
                // Get subscriber dates
                ET_List_Subscriber getListSub = new ET_List_Subscriber();
                getListSub.AuthStub = m_etcTDClient;
                getListSub.Props = new string[] { "SubscriberKey", "Status", "CreatedDate" };
                getListSub.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "2726" } };
                GetReturn getLSResponse = getListSub.Get();
                Console.WriteLine("Get Status: " + getLSResponse.Status.ToString());
                Console.WriteLine("Message: " + getLSResponse.Message.ToString());
                Console.WriteLine("Code: " + getLSResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getLSResponse.Results.Length);
                intResults = getLSResponse.Results.Length;

                // Get all subscriber keys associated with active subscribers
                while (getLSResponse.MoreResults == true || intResults > 0)
                {
                    foreach (ET_List_Subscriber sub in getLSResponse.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctNewsletterListSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added Subscriber: " + sub.SubscriberKey + " Status: " + strStatus);

                    }

                    getLSResponse = getListSub.GetMoreResults();
                    intResults = getLSResponse.Results.Length;
                }

                Console.WriteLine("Retrieved Newsletter List Subscription Status");

                // Get all customers and their 'NewsletterPublicationList' field from CustomerBaseDatabase
                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGetNewsletter = new ET_DataExtensionRow();
                deRowGetNewsletter.AuthStub = m_etcTDClientShared;
                deRowGetNewsletter.DataExtensionName = "CustomerDatabase";
                deRowGetNewsletter.Props = new string[] { "SubscriberKey", "NewsletterPublicationList" };
                GetReturn grRowNewsletter = deRowGetNewsletter.Get();
                Console.WriteLine("Get Status: " + grRowNewsletter.Status.ToString());
                Console.WriteLine("Message: " + grRowNewsletter.Message.ToString());
                Console.WriteLine("Code: " + grRowNewsletter.Code.ToString());
                Console.WriteLine("Results Length: " + grRowNewsletter.Results.Length);
                intResults = grRowNewsletter.Results.Length;

                while (grRowNewsletter.MoreResults == true || intResults > 0)
                {
                    foreach (ET_DataExtensionRow column in grRowNewsletter.Results)
                    {
                        strSubscriberKey = column.ColumnValues["SubscriberKey"];
                        strStatus = column.ColumnValues["NewsletterPublicationList"];

                        if (dctNewsletterListSubscribers.TryGetValue(strSubscriberKey, out x) == true)
                        {
                            dctDENewsletterSubscribers.Add(strSubscriberKey, strStatus);
                            Console.WriteLine("Added NPL customer: " + strSubscriberKey);
                        }

                    }

                    grRowNewsletter = deRowGetNewsletter.GetMoreResults();
                    intResults = grRowNewsletter.Results.Length;
                }

                // Update statuses
                ET_DataExtensionRow deRowPatchNewsletter = null;
                foreach (KeyValuePair<string, string> entry in dctDENewsletterSubscribers)
                {
                    strSubscriberKey = entry.Key;
                    strDEStatus = entry.Value;

                    // if our status = active, set to true
                    strStatus = dctNewsletterListSubscribers[strSubscriberKey];
                    if (strStatus.Equals("Active") == true)
                    {
                        strStatus = "True";
                    }
                    else
                    {
                        strStatus = "False";
                    }

                    // Is the status of our subscriber the same on the All Subscribers list as it is on the Data Extension?
                    if (strDEStatus.Equals(strStatus) == false)
                    {
                        intUpdateRecordCount += 1;
                        // No, update the verified email field
                        deRowPatchNewsletter = new ET_DataExtensionRow();
                        deRowPatchNewsletter.AuthStub = m_etcTDClientShared;
                        deRowPatchNewsletter.DataExtensionCustomerKey = "CustomerDBKey";
                        deRowPatchNewsletter.ColumnValues.Add("SubscriberKey", strSubscriberKey);
                        deRowPatchNewsletter.ColumnValues.Add("NewsletterPublicationList", strStatus);
                        PatchReturn patchRowResponse = deRowPatchNewsletter.Patch();
                        Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                        Console.WriteLine("Count: " + intUpdateRecordCount.ToString());
                        Console.WriteLine("Changed newsletter boolean for subscriber: " + strSubscriberKey + " from " + strDEStatus + " to " + strStatus);
                    }
                }
                
                Console.WriteLine("Completed Newsletter Boolean Update");

                // Reminders Publication List
                // Get subscriber dates
                ET_List_Subscriber getListSubReminders = new ET_List_Subscriber();
                getListSubReminders.AuthStub = m_etcTDClient;
                getListSubReminders.Props = new string[] { "SubscriberKey", "Status", "CreatedDate" };
                getListSubReminders.SearchFilter = new SimpleFilterPart() { Property = "ListID", SimpleOperator = SimpleOperators.equals, Value = new string[] { "2727" } };
                GetReturn getLSResponseReminders = getListSubReminders.Get();
                Console.WriteLine("Get Status: " + getLSResponseReminders.Status.ToString());
                Console.WriteLine("Message: " + getLSResponseReminders.Message.ToString());
                Console.WriteLine("Code: " + getLSResponseReminders.Code.ToString());
                Console.WriteLine("Results Length: " + getLSResponseReminders.Results.Length);
                intResults = getLSResponseReminders.Results.Length;

                // Get all subscriber keys associated with active subscribers
                while (getLSResponseReminders.MoreResults == true || intResults > 0)
                {
                    foreach (ET_List_Subscriber sub in getLSResponseReminders.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctRemindersListSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added Subscriber: " + sub.SubscriberKey + " Status: " + strStatus);

                    }

                    getLSResponseReminders = getListSubReminders.GetMoreResults();
                    intResults = getLSResponseReminders.Results.Length;
                }

                Console.WriteLine("Retrieved Reminders List Subscription Status");

                // Get all customers and their 'ReminderssPublicationList' field from CustomerBaseDatabase
                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGetReminders = new ET_DataExtensionRow();
                deRowGetReminders.AuthStub = m_etcTDClientShared;
                deRowGetReminders.DataExtensionName = "CustomerDatabase";
                deRowGetReminders.Props = new string[] { "SubscriberKey", "RemindersPublicationList" };
                GetReturn grRowReminders = deRowGetReminders.Get();
                Console.WriteLine("Get Status: " + grRowReminders.Status.ToString());
                Console.WriteLine("Message: " + grRowReminders.Message.ToString());
                Console.WriteLine("Code: " + grRowReminders.Code.ToString());
                Console.WriteLine("Results Length: " + grRowReminders.Results.Length);
                intResults = grRowReminders.Results.Length;

                while (grRowReminders.MoreResults == true || intResults > 0)
                {
                    foreach (ET_DataExtensionRow column in grRowReminders.Results)
                    {
                        strSubscriberKey = column.ColumnValues["SubscriberKey"];
                        strStatus = column.ColumnValues["RemindersPublicationList"];

                        if (dctRemindersListSubscribers.TryGetValue(strSubscriberKey, out x) == true)
                        {
                            dctDERemindersSubscribers.Add(strSubscriberKey, strStatus);
                            Console.WriteLine("Added RPL customer: " + strSubscriberKey);
                        }

                    }

                    grRowReminders = deRowGetReminders.GetMoreResults();
                    intResults = grRowReminders.Results.Length;
                }

                intUpdateRecordCount = 0;

                // Update statuses
                ET_DataExtensionRow deRowPatchReminders = null;
                foreach (KeyValuePair<string, string> entry in dctDERemindersSubscribers)
                {
                    strSubscriberKey = entry.Key;
                    strDEStatus = entry.Value;


                    // if our status = active, set to true
                    strStatus = dctRemindersListSubscribers[strSubscriberKey];
                    if (strStatus.Equals("Active") == true)
                    {
                        strStatus = "True";
                    }
                    else
                    {
                        strStatus = "False";
                    }

                    // Is the status of our subscriber the same on the All Subscribers list as it is on the Data Extension?
                    if (strDEStatus.Equals(strStatus) == false)
                    {
                        intUpdateRecordCount += 1;
                        // No, update the verified email field
                        deRowPatchReminders = new ET_DataExtensionRow();
                        deRowPatchReminders.AuthStub = m_etcTDClientShared;
                        deRowPatchReminders.DataExtensionCustomerKey = "CustomerDBKey";
                        deRowPatchReminders.ColumnValues.Add("SubscriberKey", strSubscriberKey);
                        deRowPatchReminders.ColumnValues.Add("RemindersPublicationList", strStatus);
                        PatchReturn patchRowResponse = deRowPatchReminders.Patch();
                        Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                        Console.WriteLine("Count: " + intUpdateRecordCount.ToString());
                        Console.WriteLine("Changed reminders boolean for subscriber: " + strSubscriberKey + " from " + strDEStatus + " to " + strStatus);
                    }
                }

                Console.WriteLine("Completed Reminders Boolean Update");
            }
            catch (Exception excError)
            {
                // Display Error
                Console.WriteLine("Error: " + excError.ToString());
            }
        }
        // ------------------------------------------------------------
        // Name: UpdateConvertedProspects
        // Abstract: Retrieve subscribers from a list
        // ------------------------------------------------------------
        public static void SetVerifiedEmailStatus()
        {
            Dictionary<string, string> dctAllSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDataExtensionSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctNewsletterListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDENewsletterSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctRemindersListSubscribers = new Dictionary<string, string>();
            Dictionary<string, string> dctDERemindersSubscribers = new Dictionary<string, string>();

            List<string> alstrValidSubscriberKeys = new List<string>();

            try
            {
                string strSubscriberKey = "";
                string strEmail = "";
                string strCustomerNumber = "";
                string strStatus = "";
                string strDEStatus = "";
                int intUpdateRecordCount = 0;
                // Data
                DateTime dtmCreatedDate = DateTime.Now;

                
                // Get subscriber dates
                ET_Subscriber getSub = new ET_Subscriber();
                getSub.AuthStub = m_etcTDClientShared;
                getSub.Props = new string[] { "SubscriberKey", "EmailAddress", "Status", "CreatedDate" };
                GetReturn getResponse = getSub.Get();
                
                Console.WriteLine("Get Status: " + getResponse.Status.ToString());
                Console.WriteLine("Message: " + getResponse.Message.ToString());
                Console.WriteLine("Code: " + getResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getResponse.Results.Length);
                int intResults = getResponse.Results.Length;

                // Get all subscriber keys associated with active subscribers
                while (getResponse.MoreResults == true || intResults > 0)
                {
                    foreach (ET_Subscriber sub in getResponse.Results)
                    {
                        strStatus = sub.Status.ToString();
                        dctAllSubscribers.Add(sub.SubscriberKey, strStatus);
                        Console.WriteLine("Added EmailAddress: " + sub.EmailAddress + " Status: " + strStatus);
                        
                    }

                    getResponse = getSub.GetMoreResults();
                    intResults = getResponse.Results.Length;
                }
                

                // Get all customers and their 'VerifiedEmail' field from CustomerBaseDatabase
                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGet = new ET_DataExtensionRow();
                deRowGet.AuthStub = m_etcTDClientShared;
                deRowGet.DataExtensionName = "CustomerDatabase";
                deRowGet.Props = new string[] { "SubscriberKey", "VerifiedEmail" };
                GetReturn grRow = deRowGet.Get();
                Console.WriteLine("Get Status: " + grRow.Status.ToString());
                Console.WriteLine("Message: " + grRow.Message.ToString());
                Console.WriteLine("Code: " + grRow.Code.ToString());
                Console.WriteLine("Results Length: " + grRow.Results.Length);
                intResults = grRow.Results.Length;
                string x;
                while (grRow.MoreResults == true || intResults > 0)
                {
                    foreach (ET_DataExtensionRow column in grRow.Results)
                    {
                        strSubscriberKey = column.ColumnValues["SubscriberKey"];
                        strStatus = column.ColumnValues["VerifiedEmail"];

                        if (dctAllSubscribers.TryGetValue(strSubscriberKey, out x) == true)
                        {
                            dctDataExtensionSubscribers.Add(strSubscriberKey, strStatus);
                            Console.WriteLine("Added customer: " + strSubscriberKey);
                        }

                    }

                    grRow = deRowGet.GetMoreResults();
                    intResults = grRow.Results.Length;
                }            

                // Update statuses
                ET_DataExtensionRow deRowPatch = null;
                foreach (KeyValuePair<string, string> entry in dctDataExtensionSubscribers)
                {
                    strSubscriberKey = entry.Key;
                    strDEStatus = entry.Value;

                    // if our status = active, set to true
                    strStatus = dctAllSubscribers[strSubscriberKey];
                    if (strStatus.Equals("Active") == true)
                    {
                        strStatus = "True";
                    }
                    else
                    {
                        strStatus = "False";
                    }

                    // Is the status of our subscriber the same on the All Subscribers list as it is on the Data Extension?
                    if (strDEStatus.Equals(strStatus) == false)
                    {
                        intUpdateRecordCount += 1;
                        // No, update the verified email field
                        deRowPatch = new ET_DataExtensionRow();
                        deRowPatch.AuthStub = m_etcTDClientShared;
                        deRowPatch.DataExtensionCustomerKey = "CustomerDBKey";
                        deRowPatch.ColumnValues.Add("SubscriberKey", strSubscriberKey);
                        deRowPatch.ColumnValues.Add("VerifiedEmail", strStatus);
                        PatchReturn patchRowResponse = deRowPatch.Patch();
                        Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                        Console.WriteLine("Count: " + intUpdateRecordCount.ToString());
                    }
                }

                Console.WriteLine("Done editing email statuses!");
   
            }
            catch (Exception excError)
            {
                // Display Error
                Console.WriteLine("Error: " + excError.ToString());
            }
        }
        static void TestET_DataExtension()
        {
            ET_Client myclient = new ET_Client();

            string NameOfTestDataExtension = "CSharpCreatedDE";

            Console.WriteLine("--- Testing DataExtension ---");
            Console.WriteLine("\n Get all of the DataExtensions in an Account");
            ET_DataExtension getAllDataExtension = new ET_DataExtension();
            getAllDataExtension.AuthStub = myclient;
            getAllDataExtension.Props = new string[] { "CustomerKey", "Name" };
            GetReturn grAllDataExtension = getAllDataExtension.Get();

            Console.WriteLine("Get Status: " + grAllDataExtension.Status.ToString());
            Console.WriteLine("Message: " + grAllDataExtension.Message.ToString());
            Console.WriteLine("Code: " + grAllDataExtension.Code.ToString());
            Console.WriteLine("Results Length: " + grAllDataExtension.Results.Length);

            while (grAllDataExtension.MoreResults)
            {
                Console.WriteLine("\n Continue Retrieve All DataExtension with GetMoreResults");
                grAllDataExtension = getAllDataExtension.GetMoreResults();
                Console.WriteLine("Get Status: " + grAllDataExtension.Status.ToString());
                Console.WriteLine("Message: " + grAllDataExtension.Message.ToString());
                Console.WriteLine("Code: " + grAllDataExtension.Code.ToString());
                Console.WriteLine("Results Length: " + grAllDataExtension.Results.Length);
            }



            Console.WriteLine("\n Create DataExtension");
            ET_DataExtension postDataExtension = new ET_DataExtension();
            postDataExtension.AuthStub = myclient;
            postDataExtension.Name = NameOfTestDataExtension;
            postDataExtension.CustomerKey = NameOfTestDataExtension;
            ET_DataExtensionColumn nameColumn = new ET_DataExtensionColumn() { Name = "Name", FieldType = DataExtensionFieldType.Text, IsPrimaryKey = true, MaxLength = 100, IsRequired = true };
            ET_DataExtensionColumn otherColumn = new ET_DataExtensionColumn() { Name = "OtherColumn", FieldType = DataExtensionFieldType.Text };
            postDataExtension.Columns = new ET_DataExtensionColumn[] { nameColumn, otherColumn };
            PostReturn postResponse = postDataExtension.Post();
            Console.WriteLine("Post Status: " + postResponse.Status.ToString());
            Console.WriteLine("Message: " + postResponse.Message.ToString());
            Console.WriteLine("Code: " + postResponse.Code.ToString());
            Console.WriteLine("Results Length: " + postResponse.Results.Length);

            if (postResponse.Status)
            {
                Console.WriteLine("\n Update DE to add new field");
                ET_DataExtension patchDataExtension = new ET_DataExtension();
                patchDataExtension.AuthStub = myclient;
                patchDataExtension.CustomerKey = NameOfTestDataExtension;
                ET_DataExtensionColumn addedField = new ET_DataExtensionColumn() { Name = "AddedField", FieldType = DataExtensionFieldType.Text };
                patchDataExtension.Columns = new ET_DataExtensionColumn[] { addedField };
                FuelSDK.PatchReturn patchFR = patchDataExtension.Patch();
                Console.WriteLine("Patch Status: " + patchFR.Status.ToString());
                Console.WriteLine("Message: " + patchFR.Message.ToString());
                Console.WriteLine("Code: " + patchFR.Code.ToString());
                Console.WriteLine("Results Length: " + patchFR.Results.Length);

                Console.WriteLine("\n Retrieve All Columns for a data extension");
                ET_DataExtensionColumn getColumn = new ET_DataExtensionColumn();
                getColumn.AuthStub = myclient;
                getColumn.Props = new string[] { "Name", "FieldType" };
                getColumn.SearchFilter = new SimpleFilterPart() { Property = "DataExtension.CustomerKey", SimpleOperator = SimpleOperators.equals, Value = new string[] { NameOfTestDataExtension } };
                GetReturn getColumnResponse = getColumn.Get();
                Console.WriteLine("Get Status: " + getColumnResponse.Status.ToString());
                Console.WriteLine("Message: " + getColumnResponse.Message.ToString());
                Console.WriteLine("Code: " + getColumnResponse.Code.ToString());
                Console.WriteLine("Results Length: " + getColumnResponse.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionColumn column in getColumnResponse.Results)
                    {
                        Console.WriteLine("-- Name: " + column.Name + "  Type: " + column.FieldType.ToString());
                    }
                }

                Console.WriteLine("\n Add a row to a data extension (using CustomerKey)");
                ET_DataExtensionRow deRowPost = new ET_DataExtensionRow();
                deRowPost.AuthStub = myclient;
                deRowPost.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowPost.ColumnValues.Add("Name", "Example Name");
                deRowPost.ColumnValues.Add("OtherColumn", "Different Example Text");
                PostReturn prRowResponse = deRowPost.Post();
                Console.WriteLine("Post Status: " + prRowResponse.Status.ToString());
                Console.WriteLine("Message: " + prRowResponse.Message.ToString());
                Console.WriteLine("Code: " + prRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + prRowResponse.Results.Length);

                Console.WriteLine("\n Add a row to a data extension (using Name)");
                ET_DataExtensionRow deRowPost2 = new ET_DataExtensionRow();
                deRowPost2.AuthStub = myclient;
                deRowPost2.DataExtensionName = NameOfTestDataExtension;
                deRowPost2.ColumnValues.Add("Name", "Example Name3");
                deRowPost2.ColumnValues.Add("OtherColumn", "Different Example Text");
                PostReturn prRowResponse2 = deRowPost2.Post();
                Console.WriteLine("Post Status: " + prRowResponse2.Status.ToString());
                Console.WriteLine("Message: " + prRowResponse2.Message.ToString());
                Console.WriteLine("Code: " + prRowResponse2.Code.ToString());
                Console.WriteLine("Results Length: " + prRowResponse2.Results.Length);

                Console.WriteLine("\n Retrieve All Rows from DataExtension");
                ET_DataExtensionRow deRowGet = new ET_DataExtensionRow();
                deRowGet.AuthStub = myclient;
                deRowGet.DataExtensionName = NameOfTestDataExtension;
                deRowGet.Props = new string[] { "Name", "OtherColumn" };
                GetReturn grRow = deRowGet.Get();
                Console.WriteLine("Post Status: " + grRow.Status.ToString());
                Console.WriteLine("Message: " + grRow.Message.ToString());
                Console.WriteLine("Code: " + grRow.Code.ToString());
                Console.WriteLine("Results Length: " + grRow.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionRow column in grRow.Results)
                    {
                        Console.WriteLine("--Name: " + column.ColumnValues["Name"] + " - OtherColumn: " + column.ColumnValues["OtherColumn"]);
                    }
                }

                Console.WriteLine("\n Update a row in  a data extension");
                ET_DataExtensionRow deRowPatch = new ET_DataExtensionRow();
                deRowPatch.AuthStub = myclient;
                deRowPatch.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowPatch.ColumnValues.Add("Name", "Example Name");
                deRowPatch.ColumnValues.Add("OtherColumn", "New Value for First Column");
                PatchReturn patchRowResponse = deRowPatch.Patch();
                Console.WriteLine("Post Status: " + patchRowResponse.Status.ToString());
                Console.WriteLine("Message: " + patchRowResponse.Message.ToString());
                Console.WriteLine("Code: " + patchRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + patchRowResponse.Results.Length);

                Console.WriteLine("\n Retrieve only updated row");
                ET_DataExtensionRow deRowGetSingle = new ET_DataExtensionRow();
                deRowGetSingle.AuthStub = myclient;
                deRowGetSingle.DataExtensionName = NameOfTestDataExtension;
                deRowGetSingle.Props = new string[] { "Name", "OtherColumn" };
                deRowGetSingle.SearchFilter = new SimpleFilterPart() { Property = "Name", SimpleOperator = SimpleOperators.equals, Value = new string[] { "Example Name" } };
                GetReturn grSingleRow = deRowGetSingle.Get();
                Console.WriteLine("Post Status: " + grSingleRow.Status.ToString());
                Console.WriteLine("Message: " + grSingleRow.Message.ToString());
                Console.WriteLine("Code: " + grSingleRow.Code.ToString());
                Console.WriteLine("Results Length: " + grSingleRow.Results.Length);

                if (getColumnResponse.Status)
                {
                    foreach (ET_DataExtensionRow column in grSingleRow.Results)
                    {
                        Console.WriteLine("--Name: " + column.ColumnValues["Name"] + " - OtherColumn: " + column.ColumnValues["OtherColumn"]);
                    }
                }

                Console.WriteLine("\n Delete a row from a data extension)");
                ET_DataExtensionRow deRowDelete = new ET_DataExtensionRow();
                deRowDelete.AuthStub = myclient;
                deRowDelete.DataExtensionCustomerKey = NameOfTestDataExtension;
                deRowDelete.ColumnValues.Add("Name", "Example Name");
                DeleteReturn drRowResponse = deRowDelete.Delete();
                Console.WriteLine("Post Status: " + drRowResponse.Status.ToString());
                Console.WriteLine("Message: " + drRowResponse.Message.ToString());
                Console.WriteLine("Code: " + drRowResponse.Code.ToString());
                Console.WriteLine("Results Length: " + drRowResponse.Results.Length);


                Console.WriteLine("\n Delete DataExtension");
                ET_DataExtension delDataExtension = new ET_DataExtension();
                delDataExtension.CustomerKey = NameOfTestDataExtension;
                delDataExtension.AuthStub = myclient;
                DeleteReturn deleteResponse = delDataExtension.Delete();
                Console.WriteLine("Delete Status: " + deleteResponse.Status.ToString());
                Console.WriteLine("Message: " + deleteResponse.Message.ToString());
                Console.WriteLine("Code: " + deleteResponse.Code.ToString());
                Console.WriteLine("Results Length: " + deleteResponse.Results.Length);

                Console.WriteLine("\n Info DataExtension");
                ET_DataExtension DataExtensionInfo = new ET_DataExtension();
                DataExtensionInfo.AuthStub = myclient;
                InfoReturn info = DataExtensionInfo.Info();
                Console.WriteLine("Info Status: " + info.Status.ToString());
                Console.WriteLine("Message: " + info.Message.ToString());
                Console.WriteLine("Code: " + info.Code.ToString());
                Console.WriteLine("Results Length: " + info.Results.Length);
                foreach (ET_PropertyDefinition def in info.Results)
                {
                    Console.WriteLine("--Name: " + def.Name + ", IsRetrievable: " + def.IsRetrievable.ToString());
                }
            }
        }