/// <summary>
 /// Sets the RowKey in the format (REVERSETICKS_AUTHOROID_TITLE).
 /// </summary>
 /// <param name="authorOID">The oid of the author (GUID of the user object), to be saved in RowKey.</param>
 /// <param name="title">The title to be saved in RowKey.</param>
 private void SetRowKey(string authorOID, string title)
 {
     RowKey = string.Format("{0}_{1}_{2}",
                            RowKey?.Substring(0, 19) ?? (DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks).ToString("d19"),
                            RowKey?.Substring(20, 36) ?? authorOID,
                            title);
 }
Exemple #2
0
 private void ConfigureKeys()
 {
     if (string.IsNullOrWhiteSpace(RowKey))
     {
         throw new System.Exception($"User requires a name.");
     }
     PartitionKey = RowKey.Substring(0, 1).ToUpperInvariant();
 }
Exemple #3
0
 public string GetConversationId()
 {
     if (RowKey.Length < ConversationIdPrefix.Length)
     {
         throw new ArgumentException($"Invalid row key for conversation Id {RowKey}");
     }
     return(RowKey.Substring(ConversationIdPrefix.Length));
 }
Exemple #4
0
 public Model.Site.MonthIndex GetSiteEntity()
 {
     return(new Model.Site.MonthIndex
     {
         FirstPostId = this.FirstPostId,
         MonthsPosts = this.MonthsPosts,
         YearMonth = this.RowKey.Substring(0, 4) + "-" + RowKey.Substring(4, 2)
     });
 }
Exemple #5
0
        public BuyerRequestModel(string companyID, string title, string category, string description, int quantity, DateTime dateExpire, string photoUrl)
        {
            DatePosted = DateTime.UtcNow;

            RowKey = Guid.NewGuid().ToString();

            CompanyID          = companyID;
            RequestTitle       = title;
            Category           = category;
            RequestDescription = description;
            Quantity           = quantity;
            DateExpire         = dateExpire;
            PhotoUrl           = photoUrl;

            PartitionKey = RowKey.Substring(0, 1);
        }
Exemple #6
0
        public ProductModel(string name, string description, string photourl, string companyid)
        {
            RowKey = Guid.NewGuid().ToString();

            ProductName = name;
            Description = description;
            PhotoUrl    = photourl;
            IsApproved  = false;
            CompanyID   = companyid;

            BrandName = string.Empty;

            PartitionKey = RowKey.Substring(0, 1);

            FeaturedProductWeight = 0;
        }