Esempio n. 1
0
        private OrderDto createOrderDto(FormAddOrderObj obj, DateTime systemTime)
        {
            OrderDto dto = new OrderDto();

            dto.idKhachHang  = obj.idKhachHang;
            dto.ngayDat      = obj.ngayDat;
            dto.ngayGiao     = obj.ngayGiao;
            dto.tongCong     = obj.tongCong;
            dto.tongTien     = obj.tongTien;
            dto.vat          = obj.vat;
            dto.phiVanChuyen = obj.phiVanChuyen;
            dto.dienThoai    = obj.phone;
            dto.notes        = obj.notes;
            dto.createTime   = systemTime;
            return(dto);
        }
Esempio n. 2
0
        public LogicResult addOrder(FormAddOrderObj frmObj)
        {
            DateTime systemTime = AppUtils.getServerTime();
            OrderDto orderDto   = createOrderDto(frmObj, systemTime);

            OrderDao orderDao     = new OrderDao();
            String   orderPreffix = "SX" + systemTime.Month + systemTime.Year.ToString().Substring(2, 2);

            int    numberOrder = orderDao.countOrderById(orderPreffix + "%");
            String newOrderId  = orderPreffix + (numberOrder + 1).ToString().PadLeft(4, '0');

            orderDto.id = newOrderId;

            //orderDao.insert(orderDto);


            if (frmObj.listProduct.Count > 0)
            {
                List <DonDatHangSPDto> listSanPham = new List <DonDatHangSPDto>();
                foreach (SubFormProductObj item in frmObj.listProduct)
                {
                    listSanPham.Add(createDonDathangSPDto(item, systemTime));
                }
                new DonDatHangSpDao().insertList(listSanPham);
            }

            if (frmObj.listOtherService.Count > 0)
            {
                List <DichVuDto> listDichVu = new List <DichVuDto>();
                foreach (SubFormOtherServiceObj item in frmObj.listOtherService)
                {
                    listDichVu.Add(createDichVuDto(item, systemTime));
                }
                new DichVuDao().insertList(listDichVu);
            }

            String msg = String.Format(AppUtils.getAppConfig("MSGINFO002"), newOrderId);

            return(new LogicResult(Contanst.MSG_INFO, msg, null));
        }