Example #1
0
        protected override void ExecuteCommand()
        {
            OpenFileDialog openDialog = FileIOUtil.OpenFile("File ảnh|*.bmp;*.jpg;*.jpeg;*.png", "", "Chọn ảnh hóa đơn!");
            var            result     = openDialog.ShowDialog();

            try
            {
                switch (result)
                {
                case DialogResult.OK:
                    var file = openDialog.FileName;
                    AWIPViewModel.InvoiceImageURL = file;
                    AWIPViewModel.Invalidate("InvoiceImageURL");
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                App.Current.ShowApplicationMessageBox(e.Message,
                                                      HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default,
                                                      HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Error,
                                                      OwnerWindow.MainScreen,
                                                      "Lỗi!");
                return;
            }

            return;
        }
Example #2
0
        protected override void ExecuteCommand()
        {
            base.ExecuteCommand();

            warehouseDataGrid = DataTransfer[0] as DataGrid;

            var mesResult = App.Current.ShowApplicationMessageBox("Bạn có chắc xóa thuốc này khỏi danh sách?",
                                                                  HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.YesNo,
                                                                  HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Question,
                                                                  OwnerWindow.MainScreen,
                                                                  "Thông báo!");

            if (mesResult == HPSolutionCCDevPackage.netFramework.AnubisMessgaeResult.ResultYes)
            {
                AWIPViewModel.LstWarehouseImportDetail.RemoveAt(warehouseDataGrid.SelectedIndex);
                AWIPViewModel.UpdateTotalPriceAndNewPrice();

                return;
            }

            return;
        }
Example #3
0
        protected override void ExecuteCommand()
        {
            base.ExecuteCommand();

            dataGrid = DataTransfer[0] as DataGrid;

            try
            {
                StringBuilder error = new StringBuilder();
                if (AWIPViewModel.SelectedMedicine == null)
                {
                    error.Append("Chưa chọn thuốc!").AppendLine();
                }
                if (AWIPViewModel.MedicinePrice < 0)
                {
                    error.Append("Giá thuốc không hợp lệ!").AppendLine();
                }
                if (AWIPViewModel.MedicineQuantity <= 0)
                {
                    error.Append("Số lượng thuốc không hợp lệ!").AppendLine();
                }

                if (error.Length > 0)
                {
                    throw new Exception(error.ToString());
                }

                MSW_WHMP_WarehouseImportDetailOV item;
                if ((item = AWIPViewModel.LstWarehouseImportDetail.Where(o => o.MedicineID == AWIPViewModel.SelectedMedicine.MedicineID).FirstOrDefault()) == null)
                {
                    item                  = new MSW_WHMP_WarehouseImportDetailOV();
                    item.MedicineID       = AWIPViewModel.SelectedMedicine.MedicineID;
                    item.MedicineName     = AWIPViewModel.SelectedMedicine.MedicineName;
                    item.MedicineUnitName = AWIPViewModel.SelectedMedicine.tblMedicineUnit.MedicineUnitName;
                    item.Quantity         = AWIPViewModel.MedicineQuantity;
                    item.UnitPrice        = AWIPViewModel.MedicinePrice;
                    item.TotalPrice       = (decimal)item.Quantity * item.UnitPrice;

                    AWIPViewModel.LstWarehouseImportDetail.Add(item);
                }
                else
                {
                    item.UnitPrice  = AWIPViewModel.MedicinePrice;
                    item.Quantity  += AWIPViewModel.MedicineQuantity;
                    item.TotalPrice = (decimal)item.Quantity * item.UnitPrice;
                    dataGrid.Items.Refresh();
                }

                AWIPViewModel.UpdateTotalPriceAndNewPrice();
            }
            catch (Exception e)
            {
                App.Current.ShowApplicationMessageBox(e.Message,
                                                      HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default,
                                                      HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Error,
                                                      OwnerWindow.MainScreen,
                                                      "Lỗi!");
                return;
            }
            finally
            {
                AWIPViewModel.ButtonCommandOV.IsAddImportDetailButtonRunning = false;
            }
            return;
        }