Example #1
0
 public AppConfig(IResourceManager appSettings)
 {
     this.Env = appSettings.Get("Env", Env.Local);
     this.EnableCdn = appSettings.Get("EnableCdn", false);
     this.CdnPrefix = appSettings.Get("CdnPrefix", "");
     this.AdminUserNames = appSettings.Get("AdminUserNames", new List<string>());
 }
Example #2
0
 public AppConfig(IResourceManager appSettings)
 {
     this.Env            = appSettings.Get("Env", Env.Local);
     this.EnableCdn      = appSettings.Get("EnableCdn", false);
     this.CdnPrefix      = appSettings.Get("CdnPrefix", "");
     this.AdminUserNames = appSettings.Get("AdminUserNames", new List <string>());
 }
Example #3
0
 public AppConfig(IResourceManager appSettings)
 {
     Env = appSettings.Get("Env", Env.Local);
     EnableCdn = appSettings.Get("EnableCdn", false);
     CdnPrefix = appSettings.Get("CdnPrefix", "");
     AdminUserNames = appSettings.Get("AdminUserNames", new List<string>());
     GoogleApiKey = appSettings.Get("GoogleApiKey", "");
 }
Example #4
0
 public AppConfig(IResourceManager appSettings)
 {
     //this.Env = appSettings.Get("Env", Env.Local);
     //this.EnableCdn = appSettings.Get("EnableCdn", false);
     //this.CdnPrefix = appSettings.Get("CdnPrefix", "");
     AdminUserNames = appSettings.Get("AdminUserNames", new List<string>());
     ConnectionString = ConfigUtils.GetConnectionString("DBConn");
     GalleryImagesRoot = appSettings.Get("GalleryImagesRoot", "/GalleryImages");
     UploadDirName = appSettings.Get("UploadDirName", "upload");
 }
Example #5
0
        public AuthConfig(IResourceManager appSettings, string authRealm, string oAuthProvider,
                          string consumerKeyName, string consumerSecretName)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider       = oAuthProvider;
            this.CallbackUrl    = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.ConsumerKey    = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerKeyName));
            this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerSecretName));

            this.RequestTokenUrl = appSettings.Get("oauth.{0}.RequestTokenUrl", authRealm + "oauth/request_token");
            this.AuthorizeUrl    = appSettings.Get("oauth.{0}.AuthorizeUrl", authRealm + "oauth/authorize");
            this.AccessTokenUrl  = appSettings.Get("oauth.{0}.AccessTokenUrl", authRealm + "oauth/access_token");
        }
        public AuthConfig(IResourceManager appSettings, string authRealm, string oAuthProvider,
            string consumerKeyName, string consumerSecretName)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider = oAuthProvider;
            this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.ConsumerKey = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerKeyName));
            this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerSecretName));

            this.RequestTokenUrl = appSettings.Get("oauth.{0}.RequestTokenUrl", authRealm + "oauth/request_token");
            this.AuthorizeUrl = appSettings.Get("oauth.{0}.AuthorizeUrl", authRealm + "oauth/authorize");
            this.AccessTokenUrl = appSettings.Get("oauth.{0}.AccessTokenUrl", authRealm + "oauth/access_token");
        }
        protected virtual KeyValuePair <string, byte[]> ExportData(
            [DataSourceRequest] DataSourceRequest request,
            string searchQueryId,
            ExportFactory.ExportType type,
            string firstLevelName  = null,
            string secondLevelName = null)
        {
            request          = request ?? new DataSourceRequest();
            request.PageSize = 0;

            var result = GetSelectedItems(searchQueryId);

            if (result.IsNullOrEmpty())
            {
                result = GetFindResult(searchQueryId);
            }

            var data = InitGridData(request, result);

            if (data.IsNullOrEmpty())
            {
                throw new WarningException(resource.Get("NoDataFound") ?? "No data found");
            }

            var extension = ExportFactory.GetFileExtensionByType(type);
            var fileName  = $"{(Title.IsNotNullOrEmpty() ? Title : "export")}-{DateTime.Now:d}.{extension}";

            var exporter = ExportFactory.CreateExport(type);
            var blob     = exporter.Export(data, firstLevelName, secondLevelName);

            return(new KeyValuePair <string, byte[]>(fileName, blob));
        }
 protected SearchTableController(
     ILogger logger,
     IMapper mapper,
     IDbContextManager contextManager,
     IResourceManager resource,
     string title               = null,
     bool serverOperation       = true,
     bool savePreviousGridState = false,
     bool autoSearch            = true,
     bool selectable            = true,
     bool groupable             = false,
     string tableClass          = "smallform",
     bool isRequestAjax         = false,
     bool isSortable            = false,
     bool disableSearchButton   = false)
     : base(logger, mapper, contextManager)
 {
     this.resource         = resource;
     SearchText            = resource.Get("Search") ?? "Search";
     Title                 = title;
     SavePreviousGridState = savePreviousGridState;
     AutoSearch            = autoSearch;
     ServerOperation       = serverOperation;
     Selectable            = selectable;
     Groupable             = groupable;
     TableClass            = tableClass;
     IsRequestAjax         = isRequestAjax;
     IsSortable            = isSortable;
     DisableSearchButton   = disableSearchButton;
 }
 /// <summary>Initializes a new instance of the NServiceKit.ServiceInterface.Auth.FacebookAuthProvider class.</summary>
 ///
 /// <param name="appSettings">The application settings.</param>
 public FacebookAuthProvider(IResourceManager appSettings)
     : base(appSettings, Realm, Name, "AppId", "AppSecret")
 {
     this.AppId       = appSettings.GetString("oauth.facebook.AppId");
     this.AppSecret   = appSettings.GetString("oauth.facebook.AppSecret");
     this.Permissions = appSettings.Get("oauth.facebook.Permissions", new string[0]);
 }
 public FacebookAuthProvider(IResourceManager appSettings)
     : base(appSettings, Realm, Name, "AppId", "AppSecret")
 {
     this.AppId = appSettings.GetString("oauth.facebook.AppId");
     this.AppSecret = appSettings.GetString("oauth.facebook.AppSecret");
     this.Permissions = appSettings.Get("oauth.facebook.Permissions", new string[0]);
 }
Example #11
0
            public override void OnEndPage(PdfWriter writer, Document document)
            {
                base.OnEndPage(writer, document);

                var pageSize = document.PageSize;

                cb.SetRGBColorFill(100, 100, 100);
                cb.BeginText();
                cb.SetFontAndSize(bf, 8);
                cb.SetTextMatrix(pageSize.GetLeft(40), pageSize.GetBottom(30));
                cb.ShowText($"{resource?.Get("CreateDate")} {printTime.ToString(CultureInfo.CurrentUICulture)}".Trim());
                cb.EndText();

                cb.BeginText();
                cb.SetFontAndSize(bf, 8);

                var text = $"{writer.PageNumber}/";

                cb.ShowTextAligned(
                    PdfContentByte.ALIGN_LEFT,
                    text,
                    pageSize.GetRight(55),
                    pageSize.GetBottom(30),
                    0);
                cb.EndText();

                cb.AddTemplate(template, pageSize.GetRight(55) + bf.GetWidthPoint(text, 8), pageSize.GetBottom(30));
            }
Example #12
0
        protected AuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider = oAuthProvider;
            this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.SessionExpiry = DefaultSessionExpiry;
        }
        public ActionResult <bool> Delete(string id)
        {
            var user = this.httpSessionManager_.GetUserFromRequest(Request);

            var serverResource = resourceManager_.Get(id);

            if (serverResource == null)
            {
                return(NotFound());
            }

            if (!this.authorizationPolicy_.CanDelete(user, serverResource))
            {
                return(Unauthorized());
            }

            return(Ok(resourceManager_.Delete(id)));
        }
Example #14
0
        /// <summary>Initializes a new instance of the NServiceKit.ServiceInterface.Auth.OAuthProvider class.</summary>
        ///
        /// <param name="appSettings">       The application settings.</param>
        /// <param name="authRealm">         The authentication realm.</param>
        /// <param name="oAuthProvider">     The authentication provider.</param>
        /// <param name="consumerKeyName">   Name of the consumer key.</param>
        /// <param name="consumerSecretName">Name of the consumer secret.</param>
        public OAuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider,
                             string consumerKeyName, string consumerSecretName)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider = oAuthProvider;
            this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
            this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.ConsumerKey = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerKeyName));
            this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerSecretName));

            this.RequestTokenUrl = appSettings.Get("oauth.{0}.RequestTokenUrl".Fmt(oAuthProvider), authRealm + "oauth/request_token");
            this.AuthorizeUrl = appSettings.Get("oauth.{0}.AuthorizeUrl".Fmt(oAuthProvider), authRealm + "oauth/authorize");
            this.AccessTokenUrl = appSettings.Get("oauth.{0}.AccessTokenUrl".Fmt(oAuthProvider), authRealm + "oauth/access_token");

            this.OAuthUtils = new OAuthAuthorizer(this);
            this.AuthHttpGateway = new AuthHttpGateway();
        }
Example #15
0
        protected AuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider      = oAuthProvider;
            this.CallbackUrl   = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.RedirectUrl   = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
            this.SessionExpiry = DefaultSessionExpiry;
        }
Example #16
0
        public OAuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider,
                             string consumerKeyName, string consumerSecretName)
        {
            this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);

            this.Provider       = oAuthProvider;
            this.RedirectUrl    = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
            this.CallbackUrl    = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
            this.ConsumerKey    = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerKeyName));
            this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerSecretName));

            this.RequestTokenUrl = appSettings.Get("oauth.{0}.RequestTokenUrl", authRealm + "oauth/request_token");
            this.AuthorizeUrl    = appSettings.Get("oauth.{0}.AuthorizeUrl", authRealm + "oauth/authorize");
            this.AccessTokenUrl  = appSettings.Get("oauth.{0}.AccessTokenUrl", authRealm + "oauth/access_token");

            this.OAuthUtils      = new OAuthAuthorizer(this);
            this.AuthHttpGateway = new AuthHttpGateway();
        }
Example #17
0
 public TResource Read()
 {
     _lock.EnterReadLock();
     try
     {
         return(_resourceManager.Get());
     }
     finally
     {
         _lock.ExitReadLock();
     }
 }
Example #18
0
        protected AuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider)
        {
            // Enhancement per https://github.com/ServiceStack/ServiceStack/issues/741
            this.AuthRealm = appSettings != null?appSettings.Get("OAuthRealm", authRealm) : authRealm;

            this.Provider = oAuthProvider;
            if (appSettings != null)
            {
                this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
                this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
            }
            this.SessionExpiry = DefaultSessionExpiry;
        }
Example #19
0
        protected AuthProvider(IResourceManager appSettings, string authRealm, string oAuthProvider)
        {
            // Enhancement per https://github.com/ServiceStack/ServiceStack/issues/741
            this.AuthRealm = appSettings != null ? appSettings.Get("OAuthRealm", authRealm) : authRealm;

            this.Provider = oAuthProvider;
            if (appSettings != null)
            {
                this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
                this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
            }
            this.SessionExpiry = DefaultSessionExpiry;
        }
Example #20
0
        public AppConfig(IResourceManager resources)
        {
            RootDirectory = resources.GetString("RootDirectory");
            PhotoDirectory = resources.GetString("PhotoDirectory");
            MetaFilesDirectory = resources.GetString("MetaFilesDirectory");
            PrintOutDirectory = resources.GetString("PrintOutDirectory");
            ReportConnection = resources.GetString("ReportConnection");

            MailFrom = resources.GetString("MailFrom");
            MailServerUrl = resources.GetString("MailServerUrl");
            MailServerUser = resources.GetString("MailServerUser");
            MailServerPassword = resources.GetString("MailServerPassword");
            MailServerPort= resources.Get<int>("MailServerPort",587);
            MailServerEnableSsl= resources.Get<bool>("MailServerEnableSsl",true);

            GymName = resources.Get<string> ("GymName", "GymName");
            MensajeAsunto = resources.Get<string> ("MensajeAsunto", GymName);

            LongitudFactura=resources.Get<int>("LongitudFactura",9);

            string dow = resources.Get<string>("DiaDeCierre", "SABADO").ToUpper();

            switch(dow){
            case "1":
            case "LUNES":
                DiaDeCierre= DayOfWeek.Monday;
                break;
            case "2":
            case "MARTES":
                DiaDeCierre= DayOfWeek.Tuesday;
                break;
            case "3":
            case "MIERCOLES":
                DiaDeCierre= DayOfWeek.Wednesday;
                break;
            case "4":
            case "JUEVES":
                DiaDeCierre= DayOfWeek.Thursday;
                break;
            case "5":
            case "VIERNES":
                DiaDeCierre= DayOfWeek.Friday;
                break;
            case "6":
            case "SABADO":
                DiaDeCierre= DayOfWeek.Saturday;
                break;
            case "0":
            case "7":
            case "DOMINGO":
                DiaDeCierre= DayOfWeek.Sunday;
                break;
            default:
                DiaDeCierre= DayOfWeek.Saturday;
                break;
            }
        }
Example #21
0
 protected OAuth2Provider(IResourceManager appSettings, string realm, string provider)
 {
     this.Provider = provider;
     this.AuthRealm = appSettings.Get("OAuthRealm", realm);
     this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(provider));
     this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(provider));
     this.ConsumerKey = appSettings.GetString("oauth.{0}.{1}".Fmt(provider, "ConsumerKey"));
     this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(provider, "ConsumerSecret"));
     string scopes = appSettings.GetString("oauth.{0}.Scopes".Fmt(provider)) ?? string.Empty;
     this.Scopes = scopes.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
     this.RequestTokenUrl = appSettings.GetString("oauth.{0}.RequestTokenUrl".Fmt(provider));
     this.AuthorizeUrl = appSettings.GetString("oauth.{0}.AuthorizeUrl".Fmt(provider));
     this.AccessTokenUrl = appSettings.GetString("oauth.{0}.AccessTokenUrl".Fmt(provider));
     this.UserProfileUrl = appSettings.GetString("oauth.{0}.UserProfileUrl".Fmt(provider));
 }
Example #22
0
        protected override byte[] Export <T>(IEnumerable <T> table, IEnumerable <KeyValuePair <PropertyInfo, TableOptionsAttribute> > tableColumns)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("<html>");
            stringBuilder.AppendLine("<head><meta charset='UTF-8'></head>");
            var createDateTitle = resource?.Get("CreateDate");

            if (createDateTitle.IsNotNullOrEmpty())
            {
                stringBuilder.AppendLine($"<h3>{createDateTitle} {DateTime.Now}</h3>");
            }

            stringBuilder.AppendLine("<table>");
            stringBuilder.AppendLine("<thead>");
            stringBuilder.AppendLine("<tr>");

            foreach (var column in tableColumns.Select(item => item.Value))
            {
                stringBuilder.AppendLine("<th>");
                stringBuilder.Append(column.Title);
                stringBuilder.AppendLine("</th>");
            }

            stringBuilder.AppendLine("</thead>");
            stringBuilder.AppendLine("<tbody>");

            foreach (var obj in table)
            {
                stringBuilder.AppendLine("<tr>");

                foreach (var tableColumn in tableColumns)
                {
                    var val = tableColumn.Key.GetPropertyValue(obj, tableColumn.Value);
                    stringBuilder.AppendLine("<td>");
                    stringBuilder.Append(val);
                    stringBuilder.AppendLine("</td>");
                }

                stringBuilder.AppendLine("</tr>");
            }

            stringBuilder.AppendLine("</tbody>");
            stringBuilder.AppendLine("</table>");
            stringBuilder.AppendLine("</html>");

            return(Encoding.UTF8.GetBytes(stringBuilder.ToString()));
        }
Example #23
0
        protected OAuth2Provider(IResourceManager appSettings, string realm, string provider)
        {
            this.Provider       = provider;
            this.AuthRealm      = appSettings.Get("OAuthRealm", realm);
            this.RedirectUrl    = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(provider));
            this.CallbackUrl    = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(provider));
            this.ConsumerKey    = appSettings.GetString("oauth.{0}.{1}".Fmt(provider, "ConsumerKey"));
            this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(provider, "ConsumerSecret"));
            string scopes = appSettings.GetString("oauth.{0}.Scopes".Fmt(provider)) ?? string.Empty;

            this.Scopes          = scopes.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            this.RequestTokenUrl = appSettings.GetString("oauth.{0}.RequestTokenUrl".Fmt(provider));
            this.AuthorizeUrl    = appSettings.GetString("oauth.{0}.AuthorizeUrl".Fmt(provider));
            this.AccessTokenUrl  = appSettings.GetString("oauth.{0}.AccessTokenUrl".Fmt(provider));
            this.UserProfileUrl  = appSettings.GetString("oauth.{0}.UserProfileUrl".Fmt(provider));
        }
Example #24
0
        public static List <TModel> AddDefaultValue <TModel>(this List <TModel> list, bool chooseType = true)
            where TModel : Nomenclature, new()
        {
            var name = chooseType
                ? Resource?.Get("Choose") ?? "Choose"
                : Resource?.Get("All") ?? "All";

            if (list?.Any(i => i.Name?.Equals(name, StringComparison.InvariantCultureIgnoreCase) == true) == true)
            {
                return(list);
            }

            var item = Activator.CreateInstance <TModel>();

            item.Name = name;
            list?.Insert(0, item);

            return(list);
        }
 public AppConfig(IResourceManager appSettings)
 {
     RedisReadWriteHosts = appSettings.Get("RedisReadWriteHosts", new List<string>());
     UseRedis = appSettings.Get("UseRedis", false);
 }
Example #26
0
        protected override byte[] Export <T>(
            IEnumerable <T> table,
            IEnumerable <KeyValuePair <PropertyInfo, TableOptionsAttribute> > tableColumns)
        {
            using (var p = new ExcelPackage())
            {
                var tableName = "export";
                p.Workbook.Worksheets.Add(tableName);
                var ws = p.Workbook.Worksheets[1];
                ws.Name = tableName;

                var rowIndex = 1;
                var colIndex = 1;

                var keyValuePairs = tableColumns as KeyValuePair <PropertyInfo, TableOptionsAttribute>[] ??
                                    tableColumns.ToArray();
                var headerCell = ws.Cells[rowIndex, colIndex, rowIndex, keyValuePairs.Length];
                headerCell.Merge = true;
                headerCell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                headerCell.Value = $"{resource?.Get("CreateDate")} {DateTime.Now.ToString(CultureInfo.CurrentUICulture)}".Trim();
                rowIndex++;

                foreach (var tableColumn in keyValuePairs.Select(item => item.Value))
                {
                    var cell = ws.Cells[rowIndex, colIndex];

                    cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
                    cell.Style.Fill.BackgroundColor.SetColor(ExportConfiguration.HeaderBackgroundColor);
                    cell.Style.Font.Color.SetColor(ExportConfiguration.HeaderFontColor);

                    cell.Value = tableColumn.Title;
                    colIndex++;
                }

                foreach (var obj in table)
                {
                    colIndex = 1;
                    rowIndex++;

                    foreach (var tableColumn in keyValuePairs)
                    {
                        var val = tableColumn.Key.GetPropertyValue(obj, tableColumn.Value);
                        if (val != null)
                        {
                            var cell = ws.Cells[rowIndex, colIndex];
                            if (val is double || val is short || val is int || val is long)
                            {
                                cell.Value = val;
                            }
                            else
                            {
                                cell.Value = string.Format(
                                    tableColumn.Value.Format.IsNotNullOrEmpty()
                                        ? "{0:" + tableColumn.Value.Format + "}"
                                        : "{0}",
                                    val);
                            }
                        }

                        colIndex++;
                    }
                }

                return(p.GetAsByteArray());
            }
        }
Example #27
0
		public AppConfig(IResourceManager resources)
		{
			Channel= resources.Get<string>("CHANNEL","mail_log_channel");
				
		}
 public static string Info(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.InfoKey, resourceKey));
 }
Example #29
0
        public AppConfig(IResourceManager resources)
        {
            RootDirectory      = resources.GetString("RootDirectory");
            PhotoDirectory     = resources.GetString("PhotoDirectory");
            MetaFilesDirectory = resources.GetString("MetaFilesDirectory");
            PrintOutDirectory  = resources.GetString("PrintOutDirectory");
            ReportConnection   = resources.GetString("ReportConnection");

            MailFrom            = resources.GetString("MailFrom");
            MailServerUrl       = resources.GetString("MailServerUrl");
            MailServerUser      = resources.GetString("MailServerUser");
            MailServerPassword  = resources.GetString("MailServerPassword");
            MailServerPort      = resources.Get <int>("MailServerPort", 587);
            MailServerEnableSsl = resources.Get <bool>("MailServerEnableSsl", true);

            GymName       = resources.Get <string> ("GymName", "GymName");
            MensajeAsunto = resources.Get <string> ("MensajeAsunto", GymName);

            LongitudFactura = resources.Get <int>("LongitudFactura", 9);

            string dow = resources.Get <string>("DiaDeCierre", "SABADO").ToUpper();

            switch (dow)
            {
            case "1":
            case "LUNES":
                DiaDeCierre = DayOfWeek.Monday;
                break;

            case "2":
            case "MARTES":
                DiaDeCierre = DayOfWeek.Tuesday;
                break;

            case "3":
            case "MIERCOLES":
                DiaDeCierre = DayOfWeek.Wednesday;
                break;

            case "4":
            case "JUEVES":
                DiaDeCierre = DayOfWeek.Thursday;
                break;

            case "5":
            case "VIERNES":
                DiaDeCierre = DayOfWeek.Friday;
                break;

            case "6":
            case "SABADO":
                DiaDeCierre = DayOfWeek.Saturday;
                break;

            case "0":
            case "7":
            case "DOMINGO":
                DiaDeCierre = DayOfWeek.Sunday;
                break;

            default:
                DiaDeCierre = DayOfWeek.Saturday;
                break;
            }
        }
 public ExampleConfig(IResourceManager appConfig)
 {
     ConnectionString      = appConfig.GetString("ConnectionString");
     DefaultFibonacciLimit = appConfig.Get("DefaultFibonacciLimit", 10);
 }
 public ExampleConfig(IResourceManager appConfig)
 {
     DefaultFibonacciLimit = appConfig.Get("DefaultFibonacciLimit", 10);
 }
 public AppConfig(IResourceManager appSettings)
 {
     this.BuildMode = appSettings.Get("BuildDatabase", false);
 }
 public static string Field(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.FieldKey, resourceKey));
 }
Example #34
0
 public AppConfig(IResourceManager resources)
 {
     Channel = resources.Get <string>("CHANNEL", "mail_log_channel");
 }
Example #35
0
 public TestConfig(IResourceManager appConfig)
 {
     RedisHostAddress        = appConfig.Get("RedisHostAddress", "localhost:6379");
     RunIntegrationTests     = appConfig.Get("RunIntegrationTests", false);
     IntegrationTestsBaseUrl = appConfig.Get("IntegrationTestsBaseUrl", "http://localhost/RedisWebServices.Host/Public/");
 }
Example #36
0
 public AppConfig(IResourceManager appConfig)
 {
     RedisHostAddress    = appConfig.Get("RedisHostAddress", "localhost:6379");
     RedisDb             = appConfig.Get("RedisDb", 0);
     DefaultRedirectPath = appConfig.Get("DefaultRedirectPath", "Public/Metadata");
 }
Example #37
0
        protected override byte[] Export <T>(IEnumerable <T> table, IEnumerable <KeyValuePair <PropertyInfo, TableOptionsAttribute> > tableColumns)
        {
            using (var ms = new MemoryStream())
            {
                var workbook = new HSSFWorkbook();
                var sheet    = workbook.CreateSheet();

                var rowIndex = 0;
                var colIndex = 0;
                var colCount = tableColumns.Count();

                var headerRow     = sheet.CreateRow(0);
                var headerRowCell = headerRow.CreateCell(colIndex);
                headerRowCell.SetCellValue($"{resource?.Get("CreateDate")} {DateTime.Now.ToString(CultureInfo.CurrentUICulture)}".Trim());
                sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, colIndex, colCount - 1));

                var style = workbook.CreateCellStyle();
                style.Alignment         = HorizontalAlignment.Right;
                headerRowCell.CellStyle = style;

                var tableHeaderRow = sheet.CreateRow(1);

                // Creating styles
                var headerCellStyle = workbook.CreateCellStyle();

                var palette = workbook.GetCustomPalette();
                palette.SetColorAtIndex(HSSFColor.Lavender.Index, ExportConfiguration.HeaderBackgroundColor.R, ExportConfiguration.HeaderBackgroundColor.G, ExportConfiguration.HeaderBackgroundColor.B);
                headerCellStyle.FillBackgroundColor = HSSFColor.Lavender.Index;
                headerCellStyle.FillPattern         = FillPattern.SolidForeground;

                var doubleCellStyle = workbook.CreateCellStyle();
                doubleCellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00000");

                var intCellStyle = workbook.CreateCellStyle();
                intCellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("0");

                // Creates the header cells
                foreach (var tableColumn in tableColumns.Select(item => item.Value))
                {
                    var headerCell = tableHeaderRow.CreateCell(colIndex);
                    headerCell.SetCellValue(tableColumn.Title);

                    // Add Style to Cell
                    headerCell.CellStyle = headerCellStyle;

                    colIndex++;
                }

                if (table != null)
                {
                    // Writes the cells
                    foreach (var obj in table)
                    {
                        colIndex = 0;
                        rowIndex++;
                        var dataRow = sheet.CreateRow(rowIndex);

                        foreach (var tableColumn in tableColumns)
                        {
                            var val = tableColumn.Key.GetPropertyValue(obj, tableColumn.Value);
                            if (val != null)
                            {
                                var cell = dataRow.CreateCell(colIndex);

                                if (val is double)
                                {
                                    cell.SetCellType(CellType.Numeric);

                                    cell.SetCellValue((double)val);
                                    cell.CellStyle = doubleCellStyle;
                                }
                                else if (val is short || val is int || val is long)
                                {
                                    cell.SetCellType(CellType.Numeric);

                                    cell.SetCellValue(Convert.ToInt64(val));
                                    cell.CellStyle = intCellStyle;
                                }
                                else
                                {
                                    cell.SetCellValue(string.Format(tableColumn.Value.Format.IsNotNullOrEmpty() ? "{0:" + tableColumn.Value.Format + "}" : "{0}", val));
                                }
                            }

                            colIndex++;
                        }
                    }
                }

                // Auto size the columns
                for (var i = 0; i < colCount; i++)
                {
                    sheet.AutoSizeColumn(i);
                }

                // Create the stream
                workbook.Write(ms);

                return(ms.ToArray());
            }
        }
 public static string Alert(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.AlertKey, resourceKey));
 }
 public static string Warning(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.WarningKey, resourceKey));
 }
		public TestConfig(IResourceManager appConfig)
		{
			RedisHostAddress = appConfig.Get("RedisHostAddress", "localhost:6379");
			RunIntegrationTests = appConfig.Get("RunIntegrationTests", false);
			IntegrationTestsBaseUrl = appConfig.Get("IntegrationTestsBaseUrl", "http://localhost/RedisWebServices.Host/Public/");
		}
 public static string Menu(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.MenuKey, resourceKey));
 }
Example #42
0
        public AppConfig(IResourceManager appSettings)
        {
            this.Env = appSettings.Get("Env", Env.Local);

            this.AdminUserNames = appSettings.Get("AdminUserNames", new List <string>());
        }
 public static string Entity(this IResourceManager resourceManager, string resourceKey)
 {
     return(resourceManager.Get(ResourceManagerParameters.EntityKey, resourceKey));
 }
Example #44
0
 public AppConfig(IResourceManager appSettings)
 {
     this.SqlserverConnectionString = appSettings.Get("SQL_CONNECTION_STRING", ConfigUtils.GetConnectionString("appSqlConnection"));
 }
Example #45
0
        /// <summary>Initializes a new instance of the NServiceKit.WebHost.Endpoints.Tests.IntegrationTests.ExampleConfig class.</summary>
        ///
        /// <param name="appConfig">The application configuration.</param>
		public ExampleConfig(IResourceManager appConfig)
		{
			ConnectionString = appConfig.GetString("ConnectionString");
			DefaultFibonacciLimit = appConfig.Get("DefaultFibonacciLimit", 10);
		}
Example #46
0
 public AppConfig(IResourceManager appConfig)
 {
     RedisHostAddress = appConfig.Get("RedisHostAddress", "localhost:6379");
     RedisDb = appConfig.Get("RedisDb", 0);
     DefaultRedirectPath = appConfig.Get("DefaultRedirectPath", "Public/Metadata");
 }