public void RemoveApproved() { if (SelectedDonHangChinhThuc == null) { return; } var dialog = IoC.Get <DialogViewModel>(); dialog.Question = "Xóa đơn hàng đã chọn?"; dialog.DisplayName = ""; var result = _windowManager.ShowDialog(dialog); if (result != true) { return; } DonHangChinhThucList.Remove(SelectedDonHangChinhThuc); }
public void CapNhatDonHang() { var dialog = IoC.Get <DialogViewModel>(); dialog.Question = "Cập nhật các đơn hàng này?"; dialog.DisplayName = ""; var result = _windowManager.ShowDialog(dialog); if (result != true) { return; } var removeList = new List <DonHangChinhThuc> (); foreach (var donHang in DonHangChinhThucList) { var tmp = new DonHangDTO { MaDonHang = donHang.MaDonHang, LienHeNguoiBan = donHang.LienHeNguoiBan, DiaDiemGiao = donHang.DiaDiemGiaoHang, DiaDiemNhan = donHang.DiaDiemNhanHang, GhiChu = donHang.GhiChu, KhuVuc = donHang.TenKhuVuc.ToString( ), LoaiDonHang = donHang.TenLoaiDonHang.ToString( ), MaNhanVienGiao = donHang.MaNhanVienGiao, MaNhanVienNhan = donHang.MaNhanVienNhan, NgayDatHang = donHang.NgayDatHang, TenNguoiMua = donHang.TenNguoiMua, TenNguoiBan = donHang.TenNguoiBan, TienThuHo = donHang.TienThuHo, TrangThai = donHang.TenTrangThai.ToString( ), SDTNguoiBan = donHang.SdtNguoiBan, SDTNguoiMua = donHang.SdtNguoiMua, TongThanhTien = donHang.TongThanhTien, NgayGiaoHang = donHang.NgayGiaoHang, NgayNhanHang = donHang.NgayNhanHang, PhiVanChuyen = donHang.PhiVanChuyen, PhiPhatSinh = donHang.PhiPhatSinh }; try { var mail = new MailMessage("*****@*****.**", "*****@*****.**", "[Đơn hàng đã xác nhận]" + donHang.MaDonHang, $"{donHang.MaDonHang}|{donHang.TenLoaiDonHang}|{donHang.TenKhuVuc}|{donHang.NgayDatHang}|{donHang.NgayNhanHang}|{donHang.NgayGiaoHang}|{donHang.TenTrangThai}|{donHang.MaNhanVienNhan}|{donHang.MaNhanVienGiao}|{donHang.TenNguoiBan}|{donHang.LienHeNguoiBan}|{donHang.SdtNguoiBan}|{donHang.DiaDiemNhanHang}|{donHang.TenNguoiMua}|{donHang.SdtNguoiMua}|{donHang.DiaDiemGiaoHang}|{donHang.TienThuHo}|{donHang.PhiVanChuyen}|{donHang.PhiPhatSinh}|{donHang.TongThanhTien}"); var smtp = new SmtpClient() { Host = "smtp.gmail.com", Port = 587, Credentials = new NetworkCredential("*****@*****.**", "binhdinhex769799"), EnableSsl = true }; smtp.Send(mail); DonHangBUS.ThemDonHang(tmp); removeList.Add(donHang); } catch (Exception e) { if (e is SmtpException) { var error = IoC.Get <ErrorViewModel> ( ); error.ErrorName = "Có vấn đề về mạng"; error.DisplayName = "Lỗi"; _windowManager.ShowDialog(error); } else { var error = IoC.Get <ErrorViewModel>(); error.ErrorName = e.Message; error.DisplayName = "Lỗi"; _windowManager.ShowDialog(error); } } } _baseMaDonHangChinhThuc = DonHangBUS.GenerateNewMaDonHang( ); foreach (var donHang in removeList) { DonHangChinhThucList.Remove(donHang); } }