/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPreview_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(gridLookUpEditProduct.Text)) { gridLookUpEditProduct.Properties.Appearance.BorderColor = System.Drawing.Color.Red; XtraMessageBox.Show("Vui lòng chọn Mặt hàng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); gridLookUpEditProduct.Focus(); } else if (string.IsNullOrEmpty(txtQuantity.Text)) { txtQuantity.Properties.Appearance.BorderColor = System.Drawing.Color.Red; XtraMessageBox.Show("Vui lòng nhập vào số lượng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtQuantity.Focus(); } else if (!_inventoryService.CheckQuantity(gridLookUpEditProduct.EditValue.ToString(), Convert.ToInt32(txtQuantity.Text))) { txtQuantity.Properties.Appearance.BorderColor = System.Drawing.Color.Red; XtraMessageBox.Show("Số lượng xuất không được lớn hơn số lượng hàng tồn còn trong kho!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtQuantity.Focus(); } else if (Convert.ToInt32(txtQuantity.Text) <= 0) { txtQuantity.Properties.Appearance.BorderColor = System.Drawing.Color.Red; XtraMessageBox.Show("Nhập số lượng phù hợp!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtQuantity.Focus(); } else { if (txtQuantity.Properties.Appearance.BorderColor == System.Drawing.Color.Red) { txtQuantity.Properties.BorderStyle = BorderStyles.HotFlat; } var list = new ArrayList(); CreateOrder(); foreach (var cart in _order.Carts) { list.Add(cart); } gridControlStockExport.DataSource = list; _arrayList = list; _total = _order.TotalOrder.ToString(CultureInfo.InvariantCulture); _employeeId = txtEmployeeID.Text; _employeeName = txtPepole.Text; _reason = txtRequired.Text; _address = txtAddress.Text; ResetProductControls(); EnabledButtonSaveAndPrint(true); txtBarcode.ResetText(); txtBarcode.Focus(); } }