Exemplo n.º 1
0
        public UploadLimitations(AConnection oDB, ASafeLog oLog)
        {
            m_oLimits = new SortedDictionary <string, OneUploadLimitation>();
            Global    = new OneUploadLimitation();

            m_oDB  = oDB;
            m_oLog = oLog.Safe();
        }         // constructor
Exemplo n.º 2
0
        }         // constructor

        public void Load()
        {
            m_oLimits.Clear();

            m_oDB.ForEachRowSafe(
                (sr, bRowsetStart) => {
                string sControllerName = sr["ControllerName"];

                if (string.IsNullOrWhiteSpace(sControllerName))
                {
                    Global.Init(sr["FileSizeLimit"], sr["AcceptedFiles"]);
                }
                else
                {
                    int?nFileSize         = sr["FileSizeLimit"];
                    string sAcceptedFiles = sr["AcceptedFiles"];
                    string sKey           = sControllerName + "/" + sr["ActionName"];

                    m_oLimits[sKey] = new OneUploadLimitation(
                        nFileSize ?? Global.FileSize,
                        string.IsNullOrWhiteSpace(sAcceptedFiles) ? Global.AcceptedFiles : sAcceptedFiles
                        );
                }                         // if

                return(ActionResult.Continue);
            },
                "LoadUploadLimitations",
                CommandSpecies.StoredProcedure
                );

            m_oLog.Debug("Upload limitations configuration - begin:");
            m_oLog.Debug("Global: {0}", Global);

            foreach (var pair in m_oLimits)
            {
                m_oLog.Debug("{0}: {1}", pair.Key, pair.Value);
            }

            m_oLog.Debug("Upload limitations configuration - end.");

            if (OnLoad != null)
            {
                OnLoad(this);
            }
        }         // Load