protected bool StartImport()
        {
            bool started = false;

            // IMPORT UPLOADED FILE
            if (FileUpload.Checked)
            {
                if (ValidateUploadFile())
                {
                    string fileName = DataFile.FileName;
                    // check if its zipped file, save it at server
                    if (fileName.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase) ||
                        fileName.EndsWith(".txt", StringComparison.InvariantCultureIgnoreCase) ||
                        fileName.EndsWith(".csv", StringComparison.InvariantCultureIgnoreCase))
                    {
                        string saveFilePath = fileName.StartsWith("PRODUCTS_", StringComparison.InvariantCultureIgnoreCase) ? fileName : "PRODUCTS_" + fileName;
                        saveFilePath = Server.MapPath(Path.Combine("~/App_Data/DataExchange/Upload/", saveFilePath));

                        HttpPostedFile file       = Request.Files[0];
                        int            fileLength = file.ContentLength;
                        Byte[]         buffer     = new byte[fileLength];
                        file.InputStream.Read(buffer, 0, fileLength);
                        File.WriteAllBytes(saveFilePath, buffer);

                        if (File.Exists(saveFilePath))
                        {
                            ProductImportOptions importOptions = GetImportOptions();
                            importOptions.DeleteSourceFile = true;
                            ProductImportManager.Instance.BeginImportAsync(saveFilePath, importOptions);

                            Timer1.Enabled        = true;
                            ProgressLabel.Text    = "Started import process.";
                            SelectedFileName.Text = string.Empty;
                            started = true;
                        }
                    }
                }
                else
                {
                    DataFileValidator.IsValid = false;
                }
            }
            else
            {
                string fileName = SelectedFileName.Text;
                // ITS COMPRESSED ZIP FILE, UNPACK AND VALIDATE CSV FILE
                string importFilePath = Server.MapPath("~/App_Data/DataExchange/Upload/" + fileName);
                if (File.Exists(importFilePath))
                {
                    ProductImportOptions importOptions = GetImportOptions();
                    ProductImportManager.Instance.BeginImportAsync(importFilePath, importOptions);

                    Timer1.Enabled     = true;
                    ProgressLabel.Text = "Started import process.";
                    started            = true;
                }
            }

            return(started);
        }
        private ProductImportOptions GetImportOptions()
        {
            ProductImportOptions importOptions = new ProductImportOptions();

            // SELECTED IMPORT MODE
            importOptions.ImportMode = ImportMode.UpdateImport;
            switch (SelectedImportMode.SelectedValue)
            {
            case "Insert":
                importOptions.ImportMode = ImportMode.ImportOnly;
                break;

            case "Update":
                importOptions.ImportMode = ImportMode.UpdateOnly;
                break;
            }

            importOptions.TextDelimiter = ',';
            importOptions.TextQualifier = '"';
            switch (TextDelimiter.SelectedValue)
            {
            case ",": importOptions.TextDelimiter = ','; break;

            case ";": importOptions.TextDelimiter = ';'; break;

            case "|": importOptions.TextDelimiter = '|'; break;

            case "": importOptions.TextDelimiter = '\t'; break;
            }

            switch (TextQualifier.SelectedValue)
            {
            case "'": importOptions.TextQualifier = '\''; break;

            case """:
            case "\"": importOptions.TextQualifier = '"'; break;
            }

            // MATCH FIELDS, CategoryUpdateMode, AND AddToCustomCategories, selected categories
            switch (importOptions.ImportMode)
            {
            case ImportMode.ImportOnly:
                if (InsertMatchMode.SelectedIndex == 0)
                {
                    importOptions.SelectedMatchFields = new string[0];
                }
                else
                {
                    importOptions.SelectedMatchFields = GetSelectedMatchFields(InsertMatchFields).ToArray();
                }

                importOptions.AddToCustomCategories = CategoryAddMode.SelectedValue == "1";

                importOptions.SelectedCategories = GetSelectedCategories(InsertCategories).ToArray();
                break;

            case ImportMode.UpdateOnly:
                if (UpdateMatchMode.SelectedIndex == 0)
                {
                    importOptions.SelectedMatchFields = new string[] { "ProductId" }
                }
                ;
                else
                {
                    importOptions.SelectedMatchFields = GetSelectedMatchFields(UpdateMatchFields).ToArray();
                }

                importOptions.CategoryUpdateMode = GetSelectedCategoryUpdateMode(UpdateCategoryUpdateMode);
                importOptions.SelectedCategories = GetSelectedCategories(UpdateCategories).ToArray();
                break;

            case ImportMode.UpdateImport:
                if (MixMatchMode.SelectedIndex == 0)
                {
                    importOptions.SelectedMatchFields = new string[] { "ProductId" }
                }
                ;
                else
                {
                    importOptions.SelectedMatchFields = GetSelectedMatchFields(MixMatchFields).ToArray();
                }

                importOptions.AddToCustomCategories = MixCategoryInsertMode.SelectedValue == "1";
                importOptions.CategoryUpdateMode    = GetSelectedCategoryUpdateMode(MixCategoryUpdateMode);
                importOptions.SelectedCategories    = GetSelectedCategories(MixCategories).ToArray();
                break;
            }

            return(importOptions);
        }