示例#1
0
        public static dtoContainerQuota Create(dtoContainerQuota fatherQuota, long usedSize = 0)
        {
            dtoContainerQuota dto = new dtoContainerQuota();

            dto.InitializeFromFather(fatherQuota, usedSize);
            return(dto);
        }
示例#2
0
        public void InitializeFromFather(dtoContainerQuota fatherQuota, long usedSize = 0)
        {
            _Overflow       = fatherQuota.Overflow;
            _UploadOverflow = fatherQuota.UploadOverflow;
            DiskSize        = fatherQuota.DiskSize;
            UsedSize        = usedSize;

            _AvailableSize = fatherQuota.AvailableSize - fatherQuota.UsedSize + usedSize;
            if (_AvailableSize < 0)
            {
                _AvailableSize = 0;
            }
            if (fatherQuota.IsRepository)
            {
                _MaxAvailableSize = (fatherQuota.AllowOverrideQuota) ? fatherQuota.MaxAvailableSize : fatherQuota.AvailableSize;
            }
            else
            {
                _MaxAvailableSize = fatherQuota.MaxAvailableSize;
            }

            _MaxUploadFileSize = fatherQuota.MaxUploadFileSize;
        }