Beispiel #1
0
        public static string GetFriendlyName(DojoDbContext _context)
        {
            string userName = "******";

            try
            {
                userName = ClaimsPrincipal.Current.Identity.Name;
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0]       = new SqlParameter("@UserName", SqlDbType.VarChar);
                sqlParams[0].Value = userName;

                userName = _context.Database.SqlQuery <string>("GetUserName @UserName", sqlParams).FirstOrDefault();
                if (string.IsNullOrEmpty(userName))
                {
                    userName = "******";
                }
            }
            catch
            {
            }
            return(userName);
        }
Beispiel #2
0
        //private readonly DojoDbContext _context;

        public static string GetFavoriteIcon(DojoDbContext _context, string url)
        {
            string favoriteIconClass = "fa-heart-o";

            try
            {
                var            userName  = ClaimsPrincipal.Current.Identity.Name;
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0]       = new SqlParameter("@UserName", SqlDbType.VarChar);
                sqlParams[0].Value = userName;

                string page = _context.Database.SqlQuery <string>("GetFavoritePage @UserName", sqlParams).FirstOrDefault();
                if (!string.IsNullOrEmpty(page) && url.ToLower().EndsWith(page.ToLower()))
                {
                    favoriteIconClass = "fa-heart";
                }
            }
            catch
            {
            }
            return(favoriteIconClass);
        }
        public InquiryController(DojoDbContext context)
        {
            _dbContext = context;
            ViewBag.PermissionClass = AuthorizationProvider.IsInquiryEditor() ? "app-grid-edit" : string.Empty;
            ViewBag.ApprovalClass   = AuthorizationProvider.IsAppover() ? "app-grid-approve" : string.Empty;
            ViewBag.EditClass       = AuthorizationProvider.IsInquiryEditor() ? string.Empty : " app-field-readonly";

            // note: the following setting affect MVC serialization. Use Newtonsoft.Json to work around it.

            // if false, it will not get the associated certification and skills when we get the applicants.
            //_dbContext.Configuration.ProxyCreationEnabled = false;

            // Load navigation properties explicitly (avoid serialization trouble)
            //_dbContext.Configuration.LazyLoadingEnabled = false;

            // Because Web API will perform validation, we don't need/want EF to do so
            //_dbContext.Configuration.ValidateOnSaveEnabled = false;

            // We won't use this performance tweak because we don't need
            // the extra performance and, when autodetect is false,
            // we'd have to be careful. We're not being that careful.
            //_dbContext.Configuration.AutoDetectChangesEnabled = false;
        }
Beispiel #4
0
        public GoogleDriveHelper(DojoDbContext dbContext)
        {
            _dbContext = dbContext;

            if (string.IsNullOrEmpty(AirbnbReportFolderId))
            {
                string folderFilter = string.Format("mimeType='{0}' and name = 'Airbnb Reports'", FOLDER_MIME_TYPE);
                var    folders      = GetFileList(folderFilter);
                if (folders.Count > 0)
                {
                    AirbnbReportFolderId = folders[0].Id;
                }
            }

            if (string.IsNullOrEmpty(CompletedFolderId))
            {
                string folderFilter = string.Format("mimeType='{0}' and name = 'Airbnb Historical Data'", FOLDER_MIME_TYPE);
                var    folders      = GetFileList(folderFilter);
                if (folders.Count > 0)
                {
                    CompletedFolderId = folders[0].Id;
                }
            }

            if (string.IsNullOrEmpty(FutureFolderId))
            {
                string folderFilter = string.Format("mimeType='{0}' and name = 'Revenue Forecasts'", FOLDER_MIME_TYPE);
                var    folders      = GetFileList(folderFilter);
                if (folders.Count > 0)
                {
                    FutureFolderId = folders[0].Id;
                }
            }

            DojoLogger.Info(string.Format("report folder={0}, completed folder={1}, future folder={2}",
                                          AirbnbReportFolderId, CompletedFolderId, FutureFolderId));
        }
Beispiel #5
0
 public ExportDbController(DojoDbContext context)
 {
     _dbContext = context;
 }
Beispiel #6
0
 public PropertyService(DojoDbContext dbContext)
 {
     _context = dbContext;
 }
Beispiel #7
0
 public OtherRevenueTableProvider(DojoDbContext dbContext) : base(dbContext)
 {
     _context = dbContext;
 }