Ejemplo n.º 1
0
        private string ForamtFileSearch(OwnerayoutFileType dojoType, string mimeType)
        {
            string filenameFilter   = (dojoType == OwnerayoutFileType.Future ? "-airbnb_pending.csv" : "-airbnb.csv");
            string beginOfLastMonth = DateTime.Today.AddMonths(-1).ToString("yyyy-MM-01T12:00:00");

            return(string.Format("name contains '{0}' and mimeType='{1}' and createdTime > '{2}'", filenameFilter, mimeType, beginOfLastMonth));
        }
Ejemplo n.º 2
0
        public List <SelectListItem> GetAirbnbReportFiles(OwnerayoutFileType type, DateTime reportDate)
        {
            List <SelectListItem> selectList = new List <SelectListItem>();

            try
            {
                string searchFilter = FormatFolderFileSearch(type, reportDate);
                DojoLogger.Info(string.Format("search filter={0}", searchFilter));
                var files = GetFileList(searchFilter);
                foreach (var file in files)
                {
                    selectList.Add(new SelectListItem
                    {
                        Text  = file.Name,
                        Value = file.Name + ";" + file.Id
                    });
                }

                return(selectList.OrderBy(x => x.Text).ToList());
            }
            catch (Exception ex)
            {
                DojoLogger.Error(ex.Message);
                throw;
            }
        }
Ejemplo n.º 3
0
        private string FormatFolderFileSearch(OwnerayoutFileType dojoType, DateTime reportDate)
        {
            // get the folder Id for the reportDate
            string parentId   = string.Empty;
            string folderName = (dojoType == OwnerayoutFileType.Future ?
                                 string.Format("Future Transactions - {0}", reportDate.ToString("MMMMM d yyyy")) :
                                 reportDate.ToString("MMMMM d yyyy"));    // e.g. April 5 2017
            string folderFilter = string.Format("mimeType='{0}' and name='{1}'", FOLDER_MIME_TYPE, folderName);
            var    folders      = GetFileList(folderFilter);

            if (folders.Count > 0)
            {
                parentId = folders[0].Id;
            }

            // search query for reportDate files
            string filenameFilter = (dojoType == OwnerayoutFileType.Future ? "-airbnb_pending.csv" : "-airbnb.csv");

            return(string.Format("'{0}' in parents and name contains '{1}'", parentId, filenameFilter));
        }
Ejemplo n.º 4
0
        public List <SelectListItem> GetAirbnbReportFolders(OwnerayoutFileType type)
        {
            List <SelectListItem> selectList = new List <SelectListItem>();

            try
            {
                string searchFilter = FormatFolderSearch(type);
                var    folders      = GetFileList(searchFilter);
                foreach (var folder in folders)
                {
                    selectList.Add(new SelectListItem
                    {
                        Text  = folder.Name,
                        Value = folder.Id
                    });
                }
                return(selectList.OrderBy(x => x.Text).ToList());
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        private string FormatFolderSearch(OwnerayoutFileType dojoType)
        {
            string parentId = (dojoType == OwnerayoutFileType.Future ? FutureFolderId : CompletedFolderId);

            return(string.Format("'{0}' in parents and mimeType='{1}'", parentId, FOLDER_MIME_TYPE));
        }