private void BindServiceQuota() { QuotaInfo quota = ES.Services.Servers.GetProviderServiceQuota(provider.ProviderId); if (quota != null) { lblQuotaName.Text = GetSharedLocalizedString(Utils.ModuleName, "Quota." + quota.QuotaName); } else { pnlQuota.Visible = false; } }
public void QuotaEntity_CanSerializeAndDeserialize() { QuotaInfo qi = new QuotaInfo() { QuotaList = new List <Quota> { new Quota { AclId = 1, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5 }, new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 } } }; string s = XmlSerializerHelpersGeneric.ToXML(qi); QuotaInfo r = XmlSerializerHelpersGeneric.FromXML <QuotaInfo>(s); Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId); }
public void QuotaEntity_CanDeserialize() { QuotaInfo qi = new QuotaInfo() { QuotaList = new List <Quota> { new Quota { AclId = 838570243, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5, DateBegin = new DateTime(2009, 03, 31, 08, 07, 59, 180, DateTimeKind.Utc) }, new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 } } }; string s = "<report-quotas> <quota acl-id=\"838570243\" quota-id=\"download-quota\" used=\"0\" limit=\"10\" soft-limit=\"10\"> <date-begin>2009-03-31T10:07:59.180+02:00</date-begin> <date-end>3000-01-01T01:00:00.537+01:00</date-end> </quota></report-quotas>"; QuotaInfo r = XmlSerializerHelpersGeneric.FromXML <QuotaInfo>(s); Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId); Assert.AreEqual(qi.QuotaList.First().DateBegin, r.QuotaList.First().DateBegin); }
/// <summary> /// Return quota information by executing a <c>GetQuotaRoot</c> command passed /// as an argument. /// </summary> /// <param name="gqr"> /// A command for which the Query() has been called. /// </param> /// <param name="info"> /// A structure that receives the returned quota information. /// </param> /// <returns> /// <c>true</c> on success. /// </returns> /// <remarks> /// The quota root name is not always the same as the mailbox name, see /// the description of the return value. /// </remarks> public bool QuotaInfos(ZIMapCommand.GetQuotaRoot gqr, out QuotaInfo info) { info = new QuotaInfo(); if(factory == null || gqr == null) return false; // check result ... if(!gqr.CheckSuccess("")) return false; ZIMapCommand.GetQuotaRoot.Item[] quota = gqr.Quota; if(quota == null || quota.Length == 0) { MonitorInfo("QuotaInfo: nothing found"); return false; } // return results ... MonitorInfo("QuotaInfo: got " + quota.Length + " quota"); foreach(ZIMapCommand.GetQuotaRoot.Item item in quota) { if(item.Resource == "MESSAGE") { info.MessageUsage += item.Usage; info.MessageLimit += item.Limit; } else if(item.Resource == "STORAGE") { info.StorageUsage += item.Usage; info.StorageLimit += item.Limit; } } info.QuotaRoot = (gqr.Roots.Length > 0) ? gqr.Roots[gqr.Roots.Length-1] : ""; return true; }
/// <summary> /// Return quota information for a single Mailbox. /// </summary> /// <param name="mailboxFullName"> /// Must be a full mailbox name. /// </param> /// <param name="info"> /// A structure that receives the returned quota information. /// </param> /// <returns> /// <c>true</c> on success. /// </returns> /// <remarks> /// The quota root name is not always the same as the mailbox name, see /// the description of the return value. /// </remarks> public bool QuotaInfos(string mailboxFullName, out QuotaInfo info) { if(factory == null) mailboxFullName = null; else if(string.IsNullOrEmpty(mailboxFullName)) mailboxFullName = mailboxName; if(mailboxFullName == null) { info = new QuotaInfo(); return false; } ZIMapCommand.GetQuotaRoot gqr = new ZIMapCommand.GetQuotaRoot(factory); if(gqr != null) gqr.Queue(mailboxFullName); return QuotaInfos(gqr, out info); }
public Quota(QuotaInfo quotaInfo) { _quotaInfo = quotaInfo; }