private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (var wb_in = new frmWayBillOut(-1, null)) { wb_in.ShowDialog(); } }
public static void WBEdit(GetWayBillList_Result dr) { int?result = 0; if (dr == null) { return; } using (var db = new BaseEntities()) { try { var wb = db.WaybillList.FirstOrDefault(f => f.WbillId == dr.WbillId); if (wb == null) { MessageBox.Show(Resources.not_find_wb); return; } if (!(wb.SessionId == null || wb.SessionId == UserSession.SessionId)) { MessageBox.Show(Resources.deadlock); return; } if (wb.Checked == 2) { return; } if (wb.Checked == 1) { if (MessageBox.Show(Resources.edit_info, "Відміна проводки", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { result = DBHelper.StornoOrder(db, dr.WbillId); } else { result = 1; } } if (result == 1) { return; } if (dr.WType == 1 || dr.WType == 16) { using (var wb_in = new frmWayBillIn(dr.WType, wb.WbillId)) { wb_in.ShowDialog(); } } if (dr.WType == -1 || dr.WType == -16 || dr.WType == 2) { using (var wb_out = new frmWayBillOut(dr.WType, wb.WbillId)) { wb_out.ShowDialog(); } } if (dr.WType == 6) // Повернення від кліента { using (var wb_re_in = new frmWBReturnIn(dr.WType, wb.WbillId)) { wb_re_in.ShowDialog(); } } if (dr.WType == -6) //Повернення постачальнику { using (var wb_re_out = new frmWBReturnOut(wb.WbillId)) { wb_re_out.ShowDialog(); } } } catch (EntityCommandExecutionException exception) { var e = exception.InnerException as SqlException; if (e != null) { if (!e.Errors.Cast <SqlError>().Any(error => (error.Number == DeadlockErrorNumber) || (error.Number == LockingErrorNumber) || (error.Number == UpdateConflictErrorNumber))) { MessageBox.Show(e.Message); } else { MessageBox.Show(Resources.deadlock); } } else { MessageBox.Show(exception.Message); } return; } } }