private async void mnuEdit_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var tafsil = await AdjectiveDescriptionBussines.GetAsync(guid); if (tafsil == null) { frmNotification.PublicInfo.ShowMessage("شرح انتخاب شده معتبر نمی باشد"); return; } var frm = new frmDescMain(guid); if (frm.ShowDialog(this) == DialogResult.OK) { await LoadDataAsync(txtSearch.Text); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void mnuDelete_Click(object sender, EventArgs e) { var res = new ReturnedSaveFuncInfo(); try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var hazine = await AdjectiveDescriptionBussines.GetAsync(guid); if (hazine == null) { return; } if (MessageBox.Show(this, $@"آیا از حذف شرح آماده اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } res.AddReturnedValue(await hazine.RemoveAsync()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } finally { if (!res.HasError) { await LoadDataAsync(txtSearch.Text); } } }