Ejemplo n.º 1
0
        //private Order m_order;

        public InventoryItemStockTransactionBuilder(QuiltContext ctx, DateTime utcNow, DateTime localNow)
        {
            m_ctx = ctx;
            //m_order = null;
            m_utcNow   = utcNow;
            m_localNow = localNow;
        }
Ejemplo n.º 2
0
        private static void CreateReturnRequestReasonType(QuiltContext ctx, string returnRequestReasonCode, string name, bool allowRefund, bool allowReplacement, bool active, int sortOrder)
        {
            Console.WriteLine("CreateOrderReturnRequestReasonType {0}", returnRequestReasonCode);

            var dbReturnRequestReason = ctx.ReturnRequestReasons.Where(r => r.ReturnRequestReasonCode == returnRequestReasonCode).SingleOrDefault();

            if (dbReturnRequestReason == null)
            {
                dbReturnRequestReason = new ReturnRequestReason()
                {
                    ReturnRequestReasonCode = returnRequestReasonCode,
                    Name             = name,
                    AllowRefund      = allowRefund,
                    AllowReplacement = allowReplacement,
                    Active           = active,
                    SortOrder        = sortOrder
                };
                _ = ctx.ReturnRequestReasons.Add(dbReturnRequestReason);
            }
            else
            {
                dbReturnRequestReason.Name             = name;
                dbReturnRequestReason.AllowRefund      = allowRefund;
                dbReturnRequestReason.AllowReplacement = allowReplacement;
                dbReturnRequestReason.Active           = active;
                dbReturnRequestReason.SortOrder        = sortOrder;
            }
        }
Ejemplo n.º 3
0
        private static void ExecuteScript(QuiltContext ctx, string script)
        {
            StringBuilder sb    = null;
            var           lines = script.Split('\r', '\n');

            foreach (var rawLine in lines)
            {
                var line = rawLine.Trim();
                if (string.IsNullOrEmpty(line))
                {
                    // Ignore
                }
                else if (line == "GO")
                {
                    if (sb != null)
                    {
                        _  = ctx.Database.ExecuteSqlRaw(sb.ToString());
                        sb = null;
                    }
                }
                else
                {
                    if (sb == null)
                    {
                        sb = new StringBuilder();
                    }
                    _ = sb.AppendLine(line);
                }
            }
            if (sb != null)
            {
                _ = ctx.Database.ExecuteSqlRaw(sb.ToString());
            }
        }
Ejemplo n.º 4
0
        private static void CreateNotificationType(QuiltContext ctx, string notificationTypeCode, string name, string subject, string body, string bodyType)
        {
            Console.WriteLine("CreateNotificationType {0}", notificationTypeCode);

            var dbNotificationType = ctx.NotificationTypes.Where(r => r.NotificationTypeCode == notificationTypeCode).SingleOrDefault();

            if (dbNotificationType == null)
            {
                dbNotificationType = new NotificationType()
                {
                    NotificationTypeCode = notificationTypeCode,
                    Name         = name,
                    Subject      = subject,
                    Body         = body,
                    BodyTypeCode = bodyType
                };
                _ = ctx.NotificationTypes.Add(dbNotificationType);
            }
            else
            {
                dbNotificationType.Name         = name;
                dbNotificationType.Subject      = subject;
                dbNotificationType.Body         = body;
                dbNotificationType.BodyTypeCode = bodyType;
            }
        }
Ejemplo n.º 5
0
        public QuiltContext Create()
        {
            var options = new DbContextOptionsBuilder <QuiltContext>()
                          .UseLoggerFactory(Options.DatabaseLoggingEnabled ? LoggerFactory : null)
                          .UseLazyLoadingProxies()
                          .UseSqlServer(ConnectionString)
                          .Options;

            var ctx = new QuiltContext(options);

            return(ctx);
        }
Ejemplo n.º 6
0
        private static void CreateShippingVendor(QuiltContext ctx, string name)
        {
            var dbShippingVendor = ctx.ShippingVendors.Where(r => r.Name == name).SingleOrDefault();

            if (dbShippingVendor == null)
            {
                dbShippingVendor = new ShippingVendor()
                {
                    Name = name
                };
                _ = ctx.ShippingVendors.Add(dbShippingVendor);
            }
        }
Ejemplo n.º 7
0
        private void CreateProjectSnapshot(QuiltContext ctx, Project dbProject, long designSnapshotId, MProject_ProjectSpecification data, DateTime utcNow)
        {
            var dbArtifact = new Artifact()
            {
                ArtifactTypeCode      = data.ProjectArtifactTypeCode,      // ArtifactTypes.Kit
                ArtifactValueTypeCode = data.ProjectArtifactValueTypeCode, // ArtifactValueTypes.Json
                Value = data.ProjectArtifactValue
            };

            _ = ctx.Artifacts.Add(dbArtifact);

            var dbProjectSnapshot = new ProjectSnapshot()
            {
                Project = dbProject,
                ProjectSnapshotSequence = dbProject.CurrentProjectSnapshotSequence,
                Name              = dbProject.Name,
                DesignSnapshotId  = designSnapshotId,
                Artifact          = dbArtifact,
                CreateDateTimeUtc = utcNow,
                UpdateDateTimeUtc = utcNow,
            };

            _ = ctx.ProjectSnapshots.Add(dbProjectSnapshot);

            foreach (var component in data.Components)
            {
                var mInventoryItem      = InventoryMicroService.GetEntry(component.Sku);
                var consumableReference = CreateConsumableReference.FromInventoryItemId(mInventoryItem.InventoryItemId);

                var dbProjectSnapshotComponent = dbProjectSnapshot.ProjectSnapshotComponents.Where(r =>
                                                                                                   r.ConsumableReference == consumableReference &&
                                                                                                   r.UnitOfMeasureCodeNavigation == ctx.UnitOfMeasure(component.UnitOfMeasureCode)).SingleOrDefault();

                if (dbProjectSnapshotComponent != null)
                {
                    dbProjectSnapshotComponent.Quantity += component.Quantity;
                }
                else
                {
                    dbProjectSnapshotComponent = new ProjectSnapshotComponent()
                    {
                        ProjectSnapshot = dbProjectSnapshot,
                        ProjectSnapshotComponentSequence = dbProjectSnapshot.ProjectSnapshotComponents.Count + 1,
                        ConsumableReference = consumableReference,
                        UnitOfMeasureCode   = component.UnitOfMeasureCode,
                        Quantity            = component.Quantity,
                    };
                    _ = ctx.ProjectSnapshotComponents.Add(dbProjectSnapshotComponent);
                }
            }
        }
Ejemplo n.º 8
0
        //protected void BeginFunction(string className, string functionName, params object[] args)
        //{
        //    Logger.LogBeginFunction(className, functionName, args);
        //}

        //protected async Task CreateNotificationAsync(QuiltContext ctx, string userId, string notificationTypeCode, long? orderId)
        //{
        //    long? topicId;
        //    if (orderId.HasValue)
        //    {
        //        var topicReference = CreateTopicReference.FromOrderId(orderId.Value);
        //        topicId = await CommunicationMicroService.AllocateTopicAsync(topicReference, null);
        //    }
        //    else
        //    {
        //        topicId = null;
        //    }

        //    var participantReference = CreateParticipantReference.FromUserId(userId);
        //    var participantId = await CommunicationMicroService.AllocateParticipantAsync(participantReference).ConfigureAwait(false);

        //    var dbNotification = new Notification()
        //    {
        //        ParticipantId = participantId,
        //        NotificationTypeCode = notificationTypeCode,
        //        TopicId = topicId,
        //        CreateDateTimeUtc = Locale.GetUtcNow()
        //    };
        //    _ = ctx.Notifications.Add(dbNotification);

        //    OnNotificationCreated(ctx, dbNotification);
        //}

        protected void CreateOperationExceptionAlert(QuiltContext ctx, Exception ex, long?topicId = null, long?emailRequestId = null)
        {
            var description = "Operation Exception - " + GetType().Name;

            var dbAlert = new Alert()
            {
                AlertTypeCode     = AlertTypeCodes.OperationException,
                CreateDateTimeUtc = Locale.GetUtcNow(),
                Description       = description,
                Exception         = ex.GetDetail(),
                TopicId           = topicId,
                EmailRequestId    = emailRequestId
            };

            _ = ctx.Alerts.Add(dbAlert);

            OnAlertCreated(ctx, dbAlert);
        }
Ejemplo n.º 9
0
        private static void CreateTestPricingScheduleEntry(QuiltContext ctx, PricingSchedule dbPricingSchedule, string unitOfMeasure, decimal price)
        {
            var dbPricingScheduleEntry = dbPricingSchedule.PricingScheduleEntries.Where(r => r.UnitOfMeasureCode == unitOfMeasure).SingleOrDefault();

            if (dbPricingScheduleEntry == null)
            {
                dbPricingScheduleEntry = new PricingScheduleEntry()
                {
                    PricingSchedule   = dbPricingSchedule,
                    UnitOfMeasureCode = unitOfMeasure,
                    Price             = price
                };
                _ = ctx.PricingScheduleEntries.Add(dbPricingScheduleEntry);
            }
            else
            {
                dbPricingScheduleEntry.Price = price;
            }
        }
Ejemplo n.º 10
0
        private static void CreateLogEntryType(QuiltContext ctx, string logEntryTypeCode, string name)
        {
            Console.WriteLine("CreateLogEntryType {0}", logEntryTypeCode);

            var dbLogEntryType = ctx.LogEntryTypes.Where(r => r.LogEntryTypeCode == logEntryTypeCode).SingleOrDefault();

            if (dbLogEntryType == null)
            {
                dbLogEntryType = new LogEntryType()
                {
                    LogEntryTypeCode = logEntryTypeCode,
                    Name             = name
                };
                _ = ctx.LogEntryTypes.Add(dbLogEntryType);
            }
            else
            {
                dbLogEntryType.Name = name;
            }
        }
Ejemplo n.º 11
0
        private static void CreateTagCategory(QuiltContext ctx, string tagCategoryCode, string name)
        {
            Console.WriteLine("CreateTagCategory {0}", tagCategoryCode);

            var dbTagCategory = ctx.TagCategories.Where(r => r.TagCategoryCode == tagCategoryCode).SingleOrDefault();

            if (dbTagCategory == null)
            {
                dbTagCategory = new TagCategory()
                {
                    TagCategoryCode = tagCategoryCode,
                    Name            = name
                };
                _ = ctx.TagCategories.Add(dbTagCategory);
            }
            else
            {
                dbTagCategory.Name = name;
            }
        }
Ejemplo n.º 12
0
        private static void CreateShippingVendor(QuiltContext ctx, string shippingVendorId, string name)
        {
            Console.WriteLine("CreateShippingVendor {0}", shippingVendorId);

            var dbShippingVendor = ctx.ShippingVendors.Where(r => r.ShippingVendorId == shippingVendorId).SingleOrDefault();

            if (dbShippingVendor == null)
            {
                dbShippingVendor = new ShippingVendor()
                {
                    ShippingVendorId = shippingVendorId,
                    Name             = name
                };
                _ = ctx.ShippingVendors.Add(dbShippingVendor);
            }
            else
            {
                dbShippingVendor.Name = name;
            }
        }
Ejemplo n.º 13
0
        private static void CreateProjectType(QuiltContext ctx, string projectTypeCode, string name)
        {
            Console.WriteLine("CreateProjectType {0}", projectTypeCode);

            var dbProjectType = ctx.ProjectTypes.Where(r => r.ProjectTypeCode == projectTypeCode).SingleOrDefault();

            if (dbProjectType == null)
            {
                dbProjectType = new ProjectType()
                {
                    ProjectTypeCode = projectTypeCode,
                    Name            = name
                };
                _ = ctx.ProjectTypes.Add(dbProjectType);
            }
            else
            {
                dbProjectType.Name = name;
            }
        }
Ejemplo n.º 14
0
        private static void CreateShipmentStatusType(QuiltContext ctx, string shipmentStatusType, string name)
        {
            Console.WriteLine("CreateShipmentStatusType {0}", shipmentStatusType);

            var dbShipmentStatusType = ctx.ShipmentStatusTypes.Where(r => r.ShipmentStatusCode == shipmentStatusType).SingleOrDefault();

            if (dbShipmentStatusType == null)
            {
                dbShipmentStatusType = new ShipmentStatusType()
                {
                    ShipmentStatusCode = shipmentStatusType,
                    Name = name
                };
                _ = ctx.ShipmentStatusTypes.Add(dbShipmentStatusType);
            }
            else
            {
                dbShipmentStatusType.Name = name;
            }
        }
Ejemplo n.º 15
0
        private static void CreateUnitOfMeasure(QuiltContext ctx, string unitOfMeasureCode, string name)
        {
            Console.WriteLine("CreateUnitOfMeasure {0}", unitOfMeasureCode);

            var dbUnitOfMeasure = ctx.UnitOfMeasures.Where(r => r.UnitOfMeasureCode == unitOfMeasureCode).SingleOrDefault();

            if (dbUnitOfMeasure == null)
            {
                dbUnitOfMeasure = new UnitOfMeasure()
                {
                    UnitOfMeasureCode = unitOfMeasureCode,
                    Name = name
                };
                _ = ctx.UnitOfMeasures.Add(dbUnitOfMeasure);
            }
            else
            {
                dbUnitOfMeasure.Name = name;
            }
        }
Ejemplo n.º 16
0
        private static void CreateInventoryItemType(QuiltContext ctx, string inventoryItemTypeCode, string name)
        {
            Console.WriteLine("CreateInventoryItemType {0}", inventoryItemTypeCode);

            var dbInventoryItemType = ctx.InventoryItemTypes.Where(r => r.InventoryItemTypeCode == inventoryItemTypeCode).SingleOrDefault();

            if (dbInventoryItemType == null)
            {
                dbInventoryItemType = new InventoryItemType()
                {
                    InventoryItemTypeCode = inventoryItemTypeCode,
                    Name = name
                };
                _ = ctx.InventoryItemTypes.Add(dbInventoryItemType);
            }
            else
            {
                dbInventoryItemType.Name = name;
            }
        }
Ejemplo n.º 17
0
        private static void CreateReturnStatusType(QuiltContext ctx, string orderReturnStatusType, string name)
        {
            Console.WriteLine("CreateOrderReturnStatusType {0}", orderReturnStatusType);

            var dbReturnStatusType = ctx.ReturnStatusTypes.Where(r => r.ReturnStatusCode == orderReturnStatusType).SingleOrDefault();

            if (dbReturnStatusType == null)
            {
                dbReturnStatusType = new ReturnStatusType()
                {
                    ReturnStatusCode = orderReturnStatusType,
                    Name             = name
                };
                _ = ctx.ReturnStatusTypes.Add(dbReturnStatusType);
            }
            else
            {
                dbReturnStatusType.Name = name;
            }
        }
Ejemplo n.º 18
0
        private static void CreateAccountingYearStatusType(QuiltContext ctx, string AccountingYearStatusType, string name)
        {
            Console.WriteLine("CreateAccountingYearStatusType {0}", AccountingYearStatusType);

            var dbAccountingYearStatusType = ctx.AccountingYearStatusTypes.Where(r => r.AccountingYearStatusCode == AccountingYearStatusType).SingleOrDefault();

            if (dbAccountingYearStatusType == null)
            {
                dbAccountingYearStatusType = new AccountingYearStatusType()
                {
                    AccountingYearStatusCode = AccountingYearStatusType,
                    Name = name
                };
                _ = ctx.AccountingYearStatusTypes.Add(dbAccountingYearStatusType);
            }
            else
            {
                dbAccountingYearStatusType.Name = name;
            }
        }
Ejemplo n.º 19
0
        private static void CreateArtifactValueType(QuiltContext ctx, string artifactValueTypeCode, string name)
        {
            Console.WriteLine("CreateArtifactValueType {0}", artifactValueTypeCode);

            var dbArtifactValueType = ctx.ArtifactValueTypes.Where(r => r.ArtifactValueTypeCode == artifactValueTypeCode).SingleOrDefault();

            if (dbArtifactValueType == null)
            {
                dbArtifactValueType = new ArtifactValueType()
                {
                    ArtifactValueTypeCode = artifactValueTypeCode,
                    Name = name
                };
                _ = ctx.ArtifactValueTypes.Add(dbArtifactValueType);
            }
            else
            {
                dbArtifactValueType.Name = name;
            }
        }
Ejemplo n.º 20
0
        private static void CreateState(QuiltContext ctx, string stateCode, string name, string countryCode)
        {
            var dbState = ctx.States.Where(r => r.StateCode == stateCode).SingleOrDefault();

            if (dbState == null)
            {
                dbState = new State()
                {
                    StateCode   = stateCode,
                    Name        = name,
                    CountryCode = countryCode
                };
                _ = ctx.States.Add(dbState);
            }
            else
            {
                dbState.Name        = name;
                dbState.CountryCode = countryCode;
            }
        }
Ejemplo n.º 21
0
        private static void CreateOrderTransactionType(QuiltContext ctx, string orderTransactionTypeCode, string name)
        {
            Console.WriteLine("CreateOrderTransactionType {0}", orderTransactionTypeCode);

            var dbOrderTransactionType = ctx.OrderTransactionTypes.Where(r => r.OrderTransactionTypeCode == orderTransactionTypeCode).SingleOrDefault();

            if (dbOrderTransactionType == null)
            {
                dbOrderTransactionType = new OrderTransactionType()
                {
                    OrderTransactionTypeCode = orderTransactionTypeCode,
                    Name = name
                };
                _ = ctx.OrderTransactionTypes.Add(dbOrderTransactionType);
            }
            else
            {
                dbOrderTransactionType.Name = name;
            }
        }
Ejemplo n.º 22
0
        //protected void EndFunction()
        //{
        //    Logger.LogEndFunction();
        //}

        //protected void LogException(Exception ex)
        //{
        //    Logger.LogException(ex);
        //}

        //protected void LogResult(object result)
        //{
        //    Logger.LogResult(result);
        //}

        protected void OnAlertCreated(QuiltContext ctx, Alert dbAlert)
        {
            // Do not generate an email request if the alert involves an email request.
            //
            if (dbAlert.EmailRequestId != null)
            {
                return;
            }

            var dbAlertType = ctx.AlertTypes.Find(dbAlert.AlertTypeCode);

            var formatter = new AlertEmailFormatter(dbAlertType.Name);

            var dbEmailRequest = new EmailRequest()
            {
                EmailRequestStatusCode = EmailRequestStatusCodes.Posted,
                SenderEmail            = Constants.DoNotReplyEmail,
                SenderEmailName        = Constants.DoNotReplyEmailName,
                RecipientEmail         = Constants.AdminMailEmail,
                RecipientEmailName     = Constants.AdminMailEmailName,
                RecipientParticipantId = null,
                Subject                       = formatter.GetSubject(),
                BodyText                      = formatter.GetText(),
                BodyHtml                      = formatter.GetHtml(),
                BodyTypeCode                  = EmailBodyTypes.Alert,
                CreateDateTimeUtc             = Locale.GetUtcNow(),
                EmailRequestStatusDateTimeUtc = Locale.GetUtcNow(),
            };

            _ = ctx.EmailRequests.Add(dbEmailRequest);

            var dbAlertEmailRequest = new AlertEmailRequest()
            {
                Alert        = dbAlert,
                EmailRequest = dbEmailRequest,
            };

            _ = ctx.AlertEmailRequests.Add(dbAlertEmailRequest);
        }
Ejemplo n.º 23
0
        public static string GetOrderNumber(this QuiltContext ctx, DateTime utcNow)
        {
            var dbOrderNumber = ctx.OrderNumbers.Where(r => r.OrderDateUtc == utcNow.Date).SingleOrDefault();

            if (dbOrderNumber == null)
            {
                dbOrderNumber = new OrderNumber()
                {
                    OrderDateUtc = utcNow.Date,
                    Number       = 1
                };
                _ = ctx.OrderNumbers.Add(dbOrderNumber);
            }
            else
            {
                dbOrderNumber.Number += 1;
            }

            var orderNumber = string.Format("{0:00}-{1:000}-{2:0000}", utcNow.Year - 2000, utcNow.DayOfYear, dbOrderNumber.Number);

            return(orderNumber);
        }
Ejemplo n.º 24
0
        private static void CreateLedgerAccount(QuiltContext ctx, int ledgerAccountNumber, string name, string debitCreditCode)
        {
            Console.WriteLine("CreateLedgerAccountType {0}", ledgerAccountNumber);

            var dbLedgerAccount = ctx.LedgerAccounts.Where(r => r.LedgerAccountNumber == ledgerAccountNumber).SingleOrDefault();

            if (dbLedgerAccount == null)
            {
                dbLedgerAccount = new LedgerAccount()
                {
                    LedgerAccountNumber = ledgerAccountNumber,
                    Name            = name,
                    DebitCreditCode = debitCreditCode
                };
                _ = ctx.LedgerAccounts.Add(dbLedgerAccount);
            }
            else
            {
                dbLedgerAccount.Name            = name;
                dbLedgerAccount.DebitCreditCode = debitCreditCode;
            }
        }
Ejemplo n.º 25
0
        protected void OnNotificationCreated(QuiltContext ctx, Notification dbNotification)
        {
            var dbNotificationType = ctx.NotificationTypes.Find(dbNotification.NotificationTypeCode);

            var formatter = new NotificationEmailFormatter(dbNotificationType.Subject);

            var dbParticipant     = ctx.Participants.Where(r => r.ParticipantId == dbNotification.ParticipantId).Single();
            var participantUserId = ParseUserId.FromParticipantReference(dbParticipant.ParticipantReference);
            var dbAspNetUser      = ctx.AspNetUsers.Where(r => r.Id == participantUserId).Single();

            var dbEmailRequest = new EmailRequest()
            {
                EmailRequestStatusCode = EmailRequestStatusCodes.Posted,
                SenderEmail            = Constants.DoNotReplyEmail,
                SenderEmailName        = Constants.DoNotReplyEmailName,
                RecipientEmail         = dbAspNetUser.Email,
                RecipientEmailName     = dbAspNetUser.EmailName(),
                RecipientParticipant   = dbNotification.Participant,
                Subject                       = formatter.GetSubject(),
                BodyText                      = formatter.GetText(),
                BodyHtml                      = formatter.GetHtml(),
                BodyTypeCode                  = EmailBodyTypes.Notification,
                CreateDateTimeUtc             = Locale.GetUtcNow(),
                EmailRequestStatusDateTimeUtc = Locale.GetUtcNow(),
            };

            _ = ctx.EmailRequests.Add(dbEmailRequest);

            var dbNotificationEmailRequest = new NotificationEmailRequest()
            {
                Notification = dbNotification,
                EmailRequest = dbEmailRequest
            };

            _ = ctx.NotificationEmailRequests.Add(dbNotificationEmailRequest);
        }
Ejemplo n.º 26
0
        public static UserProfile GetUserProfile(this QuiltContext ctx, string userId)
        {
            var userProfileAspNetUser = ctx.UserProfileAspNetUsers.Where(r => r.AspNetUserId == userId).SingleOrDefault();

            if (userProfileAspNetUser != null)
            {
                return(userProfileAspNetUser.UserProfile);
            }

            var userProfile = new UserProfile()
            {
                UserProfileReference = userId
            };

            _ = ctx.UserProfiles.Add(userProfile);

            userProfileAspNetUser = new UserProfileAspNetUser()
            {
                AspNetUserId = userId
            };
            userProfile.UserProfileAspNetUser = userProfileAspNetUser;

            return(userProfile);
        }
Ejemplo n.º 27
0
 public ReturnRequestTransactionBuilder(QuiltContext ctx)
 {
     m_ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
 }
Ejemplo n.º 28
0
 public FundableTransactionBuilder(QuiltContext ctx)
 {
     m_ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
 }
Ejemplo n.º 29
0
            public static MCommunication_Message MCommunication_Message(
                QuiltContext ctx,
                Message dbMessage,
                bool canAcknowledge,
                bool includeEmails,
                IList <MCommunication_Message> conversation)
            {
                string email;

                if (TryParseUserId.FromParticipantReference(dbMessage.Participant.ParticipantReference, out string userId))
                {
                    var dbAspNetUser = ctx.AspNetUsers.Where(r => r.Id == userId).Single();
                    email = dbAspNetUser.Email;
                }
                else
                {
                    userId = null;
                    email  = $"{dbMessage.Participant.ParticipantId}@richtodd.com";
                }

                string from;
                string to;

                if (dbMessage.SendReceiveCode == SendReceiveCodes.FromUser)
                {
                    from = email;
                    to   = Constants.AdminMailEmailName;
                }
                else // ToUser
                {
                    from = Constants.AdminMailEmailName;
                    to   = email;
                }

                IList <MCommunication_Email> emails = includeEmails
                    ? dbMessage.MessageEmailRequests.Select(r => MCommunication_Email(r.EmailRequest)).ToList()
                    : null;

                var message = new MCommunication_Message()
                {
                    MessageId                  = dbMessage.MessageId,
                    UserId                     = userId,
                    ConversationId             = dbMessage.ConversationId,
                    From                       = from,
                    To                         = to,
                    Subject                    = dbMessage.Subject,
                    Text                       = dbMessage.Text,
                    SendReceiveCode            = dbMessage.SendReceiveCode,
                    CreateDateTimeUtc          = dbMessage.CreateDateTimeUtc,
                    AcknowledgementDateTimeUtc = dbMessage.AcknowledgementDateTimeUtc,
                    TopicId                    = dbMessage.TopicId,
                    TopicReference             = dbMessage.Topic?.TopicReference,

                    CanAcknowledge = canAcknowledge,

                    Fields       = MCommunication_TopicFields(dbMessage.Topic),
                    Emails       = emails,
                    Conversation = conversation
                };

                return(message);
            }
Ejemplo n.º 30
0
 public static string GetShipmentNumber(this QuiltContext ctx, DateTime utcNow)
 {
     return(ctx.GetOrderNumber(utcNow));
 }