public static void Main()
Console.WriteLine("Hello World");--order
import { Component, OnInit, Input, ViewChild, AfterContentInit, AfterViewInit } from '@angular/core';
import { NgbActiveModal, NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';
import { WjInputMask, WjInputDateTime } from 'wijmo/wijmo.angular2.input';
import { Observable, Observer } from 'rxjs';
} from '../../Service/reservation.service';
import { MessengerBoxComponent } from '../../Common/messenger-box/messenger-box.component';
import { Router } from '@angular/router';
import { DatePipe } from '@angular/common';
import { SuccessBoxComponent } from '../../Common/success-box/success-box.component';
import { NgxSpinnerService } from 'ngx-spinner';
selector: 'app-orderroom',
templateUrl: './orderroom.component.html',
styleUrls: ['./orderroom.component.css'],
export class OrderroomComponent implements OnInit, AfterViewInit {
@ViewChild('txtMaSoPhong') private _txtMaSoPhong: WjInputMask;
@ViewChild('txtLoaiPhong') private _txtLoaiPhong: WjInputMask;
@ViewChild('txtGiaPhong') private _txtGiaPhong: WjInputMask;
@ViewChild('txtHoTen') private _txtHoTen: WjInputMask;
@ViewChild('txtPassport') private _txtPassport: WjInputMask;
@ViewChild('InDate') private _InDate: WjInputDateTime;
@ViewChild('OutDate') private _OutDate: WjInputDateTime;
private parameters: any[];
CustomerDetail: CustomerDetail;
public _ActiveModal: NgbActiveModal,
private _ReservationService: ReservationService,
private _Modal: NgbModal,
private _ModalConfig: NgbModalConfig,
private _DatePipe: DatePipe,
private _Spinner: NgxSpinnerService
this._ModalConfig.backdrop = 'static';
this._ModalConfig.keyboard = false;
this.controlGioiTinh = document.getElementById('sex');
this.controlQuocTich = document.getElementById('country');
this.controlGhiChu = document.getElementById('notes');
private F_INIT_FORM_DATA() {
this.parameters = this.PARAM;
this._txtMaSoPhong.value = this.parameters[0].toString();
this._txtLoaiPhong.value = this.parameters[1].toString();
this.CustomerDetail = null;
private F_SET_DATA_FORM() {
this.GetRoomById().subscribe(
this._txtGiaPhong.value = this.ConvertMoney(this.RoomDetail.GiaTienPhong.toString());
this.ConvertDateTime(this.RoomDetail.NgayVao, this._InDate);
this.ConvertDateTime(this.RoomDetail.NgayRaDuKien, this._OutDate);
this.GetCustomer().subscribe(
if (this.CustomerDetail) {
this._txtHoTen.value = this.CustomerDetail.HoTen;
this._txtPassport.value = this.CustomerDetail.Passport;
this.GhiChu = this.CustomerDetail.GhiChu;
this.GioiTinh = this.CustomerDetail.GioiTinh;
this.QuocTich = this.CustomerDetail.QuocTich;
private ConvertDateTime(dt: string, control: WjInputDateTime) {
const date = dt.split(':');
const hours = (date[5] === 'PM') ? 12 + Number(date[3]) : Number(date[3]);
control.value = new Date(Number(date[0]), Number(date[1]), Number(date[2]), hours, Number(date[4]));
private ConvertMoney(money: string): string {
for (let index = money.length; index > 0; index -= 3) {
priceroom = '.' + priceroom;
priceroom = money.substring(index, index - 3) + priceroom;
return priceroom + 'VND';
private GetRoomById(): Observable<boolean> {
if (isNaN(Number(this.parameters[0]))) {
return Observable.create((observe: Observer<boolean>) => {
this._ReservationService.GetRoomById(Number(this.parameters[0])).subscribe(
this.RoomDetail = new RoomDetail();
data.forEach(DataInfo => {
this.RoomDetail.NgayVao = DataInfo.NgayVao;
this.RoomDetail.NgayRaDuKien = DataInfo.NgayRaDuKien;
this.RoomDetail.GiaTienPhong = DataInfo.GiaTienPhong;
const errmes = this._Modal.open(MessengerBoxComponent);
errmes.componentInstance.MessageError = 'Lỗi từ hệ thống xin liên lạc lập trình viên' + '\r\n' + 'xxx@xxxx.com';
this._ActiveModal.close(false);
this._Router.navigate(['']);
private GetCustomer(): Observable<boolean> {
return Observable.create((observe: Observer<boolean>) => {
this._ReservationService.GetCustomer(this._txtMaSoPhong.value).subscribe(
result.forEach(DataInfo => {
this.CustomerDetail = new CustomerDetail();
this.CustomerDetail.HoTen = DataInfo.HoTen;
this.CustomerDetail.Passport = DataInfo.Passport;
this.CustomerDetail.GioiTinh = (DataInfo.GioiTinh === false) ? 'M' : 'F';
this.CustomerDetail.QuocTich = DataInfo.QuocTich;
this.CustomerDetail.GhiChu = DataInfo.GhiChu;
if (this.GioiTinh === 'F') {
if (this.Check_Input()) {
this._txtMaSoPhong.value,
this._DatePipe.transform(this._InDate.value, 'yyyy:MM:dd:hh:mm:a'),
this._DatePipe.transform(this._OutDate.value, 'yyyy:MM:dd:hh:mm:a'),
const param = paraIn.join(String.fromCharCode(6));
this.Update(param).subscribe(
const mess = this._Modal.open(SuccessBoxComponent, {centered: true});
mess.componentInstance.Messbox = 'Cập nhật thành công';
const messerr = this._Modal.open(MessengerBoxComponent, {centered: true});
messerr.componentInstance.Messbox = 'Có lỗi từ hệ thống dữ liệu xin liên lạc lập trình viên' + '\r\n' + 'xxx@xxxx.com';
private Update(param: string): Observable<boolean> {
return Observable.create((observe: Observer<boolean>) => {
this._ReservationService.Update(param)
const errmes = this._Modal.open(MessengerBoxComponent);
errmes.componentInstance.MessageError = 'Lỗi từ hệ thống xin liên lạc lập trình viên' + '\r\n' + 'xxx@xxxx.com';
private Check_Input(): boolean {
if (this._txtMaSoPhong.value === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Thiếu dữ liệu mã số phòng';
this._txtMaSoPhong.focus();
if (this._txtLoaiPhong.value === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Thiếu dữ liệu loại phòng';
this._txtLoaiPhong.focus();
if (this._txtGiaPhong.value === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Thiếu dữ liệu giá phòng';
this._txtGiaPhong.focus();
const nowDate = new Date();
if (this._InDate.value < nowDate) {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu ngày vào bị sai';
if (this._OutDate.value < nowDate || this._OutDate.value < this._InDate.value) {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu ngày ra dự kiến bị sai';
if (this._txtHoTen.value === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu họ tên bị thiếu';
if (this._txtPassport.value === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu CMND/Passport bị thiếu';
this._txtPassport.focus();
if (this.GioiTinh === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu giới tính bị thiếu';
this.controlGioiTinh.focus();
if (this.QuocTich === '') {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Dữ liệu quốc tịch bị thiếu';
this.controlQuocTich.focus();
if (this.GhiChu.length > 200) {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Ghi chú vượt quá số ký tự(200 ký tự)';
this.controlGhiChu.focus();
if (this._txtHoTen.value.length > 50) {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Họ tên vượt quá số ký tự(50 ký tự)';
if (this._txtPassport.value.length > 50) {
const err = this._Modal.open(MessengerBoxComponent);
err.componentInstance.MessageError = 'Passport vượt quá số ký tự cho phép(50 ký tự)';
this._txtPassport.focus();
public NgayVao: string = '',
public NgayRaDuKien: string = '',
public GiaTienPhong: number = 0,
public HoTen: string = '',
public Passport: string = '',
public GioiTinh: string = '',
public QuocTich: string = '',
public GhiChu: string = '',
<div class="body-detail">
<div class="modal-header">
<h4 class="modal-title">Đặt phòng</h4>
<button type="button" class="close" aria-label="Close" (click)="_ActiveModal.close(false)">
<span aria-hidden="true">×</span>
<div class="modal-body" style="height: 370px;">
<div style="float: left">
<wj-input-mask #txtMaSoPhong [isReadOnly]="true"></wj-input-mask>
<wj-input-mask #txtLoaiPhong [isReadOnly]="true"></wj-input-mask>
<wj-input-mask #txtGiaPhong [isReadOnly]="true"></wj-input-mask>
<wj-input-date-time #InDate [format]="'dd/MM/yyyy hh:mm tt'" [timeStep]="1"></wj-input-date-time>
<td>Ngày ra dự kiến:</td>
<wj-input-date-time #OutDate [format]="'dd/MM/yyyy hh:mm tt'" [timeStep]="1"></wj-input-date-time>
<div style="float: right;">
<td style="width: 240px;">
<wj-input-mask #txtHoTen style="width: 240px"></wj-input-mask>
<wj-input-mask #txtPassport style="width: 240px"></wj-input-mask>
<select [(ngModel)]="GioiTinh" id="sex">
<option value="M">Nam</option>
<option value="F">Nữ</option>
<select [(ngModel)]="QuocTich" id="country">
<option value="AUS">Australia</option>
<option value="CMB">Cambodia</option>
<option value="CND">Canada</option>
<option value="Fre">French</option>
<option value="UK">United Kingdom</option>
<option value="US">United States of America</option>
<option value="VN">Vietnam</option>
style="resize: none; overflow-x: hidden; overflow-y: scroll; width: 240px;height: 118px;"
[maxlength]="200" [(ngModel)]="GhiChu"></textarea>
<div class="modal-footer" style="float: left;">
<button type="button" style="margin-left: 250px" class="btn btn-primary" (click)="Update_Click()">Cập nhật</button>
<button type="button" style="margin-left: 150px" class="btn btn-warning" (click)="_ActiveModal.close(false)">Hủy
bdColor="rgba(51,51,51,0.8)"
type="ball-scale-multiple">
<p style="font-size: 20px; color: white">Loading...</p>
::ng-deep .modal-content {