private void ImportOderClick() { string OrderListPath = @"Order/order_2020_05_16_09_52_57.csv"; string MemberListPath = @"MemberList/方氏果乾會員.csv"; #if (DEBUG) OrderListPath = Path.Combine(PathFunction.GetExecuteLevelPath(System.Environment.CurrentDirectory, 2), @"DummyFile\order_2020_05_16_09_52_57.csv"); MemberListPath = Path.Combine(PathFunction.GetExecuteLevelPath(System.Environment.CurrentDirectory, 2), @"DummyFile\mm.csv"); #endif FileProcessing.CsvTrans2Json <BaseTitle>(OrderListPath, out loadOrderViewList); FileProcessing.CsvTrans2Json <MemberListTitle>(MemberListPath, out List <MemberListTitle> MemberList); OrderViewList.Clear(); //整理格式 loadOrderViewList.ForEach(Order => { MemberList.ForEach(s => { if (Order.CustomerName == s.RealName && Order.CustomerEmail == s.Email) { Order.Membership = "V"; } }); Order.OwnerName = "方氏果乾"; Order.OwnerNumber = "F00001"; if (Order.DateCreate != null) { CultureInfo CultureInfoDateCulture = new CultureInfo("ja-JP"); //日期文化格式 DateTime d = DateTime.ParseExact(Order.DateCreate, "yyyy-MM-dd hh:mm:ss", CultureInfoDateCulture); Order.DateCreate = d.ToString("yyyy/MM/dd"); } }); //篩選統計欄位 for (int i = 0; i < loadOrderViewList.Count; i++) { bool IsValidOrderNumber = true; loadOrderViewList[i].OrderNumber.ToList().ForEach(ch => { if (!char.IsDigit(ch) && !char.IsLetter(ch))//是否为数字//是否为字母 { IsValidOrderNumber = false; } }); if (!IsValidOrderNumber) { loadOrderViewList.Remove(loadOrderViewList[i]); i--; } else { OrderViewList.Add(new OrderView(loadOrderViewList[i])); } } }
/// <summary> /// 刷新顯示表 /// </summary> private void RefreashDataViewList() { OrderViewList.Clear(); loadOrderViewList.ForEach(s => { if (this.membership) { if (s.Membership == "V" && s.DateCreate.Contains(this.orderDate) && s.OrderNumber.Contains(this.orderNumber) && s.CustomerName.Contains(this.customerName) && s.DateCreate.Contains(this.orderDate)) { OrderViewList.Add(new OrderView(s)); } } else { if (s.DateCreate.Contains(this.orderDate) && s.OrderNumber.Contains(this.orderNumber) && s.CustomerName.Contains(this.customerName) && s.DateCreate.Contains(this.orderDate)) { OrderViewList.Add(new OrderView(s)); } } }); }