コード例 #1
0
        private void barButtonItemDeleteMedicament_ItemClick(object sender, ItemClickEventArgs e)
        {
            Medicament medicament = bindingSourceMedicament.Current as Medicament;

            if (medicament.IsNull())
            {
                Extensions.Extensions.ObjectNotSelectedForDelete();
                return;
            }

            if (Extensions.Extensions.DeletingAlert(medicament.Name) != DialogResult.Yes)
            {
                return;
            }
            Extensions.Extensions.ShowWaitForm(description: "Hastalık ismi siliniyor...");
            MedicamentSolClient client = Extensions.Extensions.GetMedicamentSolClient();

            MedicamentService.ProcessResult processResult = client.Delete(medicament.Id);
            SplashScreenManager.CloseForm(false);
            Extensions.Extensions.ProcessResultMessage(processResult.Errors, (int)processResult.Result);
            if (processResult.Result == MedicamentService.ExtensionsBLLResult.Success)
            {
                RefreshData(2);
            }
        }
コード例 #2
0
        private void barButtonItemEditMedicament_ItemClick(object sender, ItemClickEventArgs e)
        {
            Medicament medicament = bindingSourceMedicament.Current as Medicament;

            if (medicament.IsNull())
            {
                Extensions.Extensions.ObjectNotSelectedForEdit();
                return;
            }

            XtraFormMedicament xtraFormMedicament = new XtraFormMedicament(medicament);

            xtraFormMedicament.ShowDialog();
            RefreshData(2);
        }
コード例 #3
0
        private void gridControlAllMedicaments_MouseClick(object sender, MouseEventArgs e)
        {
            int[] selectedRows = gridViewAllMedicament.GetSelectedRows();

            int[] ints = prescriptionItems.Select(p => p.MedicamentId).ToArray();

            ints = ints.Where(p => !selectedRows.Contains(p)).ToArray();

            foreach (int i in ints)
            {
                prescriptionItems.Remove(prescriptionItems.FirstOrDefault(p => p.MedicamentId == i));
            }

            foreach (int row in selectedRows)
            {
                Medicament medicament = gridViewAllMedicament.GetRow(row) as Medicament;
                if (medicament != null)
                {
                    if (prescriptionItems.All(p => p.MedicamentId != medicament.Id))
                    {
                        prescriptionItems.Add(new PrescriptionItem
                        {
                            Medicament =
                                new PrescriptionService.Medicament
                            {
                                Id        = medicament.Id,
                                Name      = medicament.Name,
                                IsActive  = medicament.IsActive,
                                UsePerDay = medicament.UsePerDay,
                                Note      = medicament.Note
                            },
                            MedicamentId = medicament.Id,
                            IsActive     = true
                        });
                    }
                }
            }

            bindingSourcePrescriptionItems.DataSource = prescriptionItems;
            gridControlPrescriptionItems.RefreshDataSource();
        }