Ejemplo n.º 1
0
        public static LineCustomerViewModel InsertLineCustomer(string customerId, string customerName)
        {
            LineCustomerRepository LineCustomer_repo = new LineCustomerRepository();

            LineCustomer_repo.InsertCustomer(customerId, customerName);
            return(new LineCustomerViewModel()
            {
                LineCustomerID = customerId, Name = customerName
            });
        }
Ejemplo n.º 2
0
        public static bool SearchLineCustomer(string customerId, string customerName, ref LineCustomerViewModel lineCustomer)
        {
            LineCustomerRepository LineCustomer_repo = new LineCustomerRepository();
            var checkCustomer = LineCustomer_repo.SearchLineCustomer(customerId);

            if (checkCustomer != null)
            {
                lineCustomer = checkCustomer;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static string SetMsgFormat(int groupOrderId, ref string groupId)
        {
            LineGroupRepository        lineGroup_repo    = new LineGroupRepository();
            LineCustomerRepository     lineCustomer_repo = new LineCustomerRepository();
            SendMessageViewModel       messageInfo       = lineGroup_repo.GetMessageInfoByGroupOrderId(groupOrderId);
            List <NameAndQtyViewModel> customers         = lineCustomer_repo.GetCustomersByGroupOrderId(groupOrderId);
            string message = $"!!!成團成功!!!\n活動:{messageInfo.Title}\n商品名稱:{messageInfo.ProductName}\n";

            groupId = messageInfo.LineGroupId;
            foreach (var customer in customers.GroupBy(info => info.Name)
                     .Select(group => new
            {
                Name = group.Key,
                Count = customers.Where(x => x.Name == group.Key).Sum(x => x.Quantity)
            }))
            {
                message += $"@{customer.Name} : {customer.Count} 組\n";
            }

            return(message);
        }