private void NewItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { switch (focused_tree_node.GType) { case 2: if (focused_tree_node.Id == 48) { using (var wb_move = new frmWayBillMove()) { wb_move.ShowDialog(); } } if (focused_tree_node.Id == 58) { using (var wb_on = new frmWBWriteOn()) { wb_on.ShowDialog(); } } if (focused_tree_node.Id == 54) { using (var wb_on = new frmWBWriteOff()) { wb_on.ShowDialog(); } } if (focused_tree_node.Id == 104) { using (var wb_inv = new frmWBInventory()) { wb_inv.ShowDialog(); } } break; } RefrechItemBtn.PerformClick(); }
private void StopProcesBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { using (var db = DB.SkladBase()) { var wb_id = 0; switch (focused_tree_node.GType) { case 1: case 3: wb_id = focused_row.WbillId; break; case 6: wb_id = focused_prep_raw_mat_row.WbillId; break; } var wbl = db.WaybillList.FirstOrDefault(w => w.WbillId == wb_id); if (wbl == null) { return; } if (wbl.Checked == 2) { using (var f = new frmWBWriteOn()) { var result = f._db.ExecuteWayBill(wbl.WbillId, null, DBHelper.CurrentUser.KaId).ToList().FirstOrDefault(); f.is_new_record = true; f.doc_id = result.NewDocId; f.TurnDocCheckBox.Checked = true; f.ShowDialog(); } } } RefrechItemBtn.PerformClick(); }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var wbl = DB.SkladBase().WaybillList.FirstOrDefault(w => w.WbillId == focused_wb.WBillId); if (wbl == null) { return; } if (wbl.Checked == 1 && !DB.SkladBase().GetRelDocList(wbl.Id).Any(w => w.DocType == 5) && wbl.WType == 7) { using (var f = new frmWBWriteOn()) { var result = f._db.ExecuteWayBill(wbl.WbillId, 5, DBHelper.CurrentUser.KaId).ToList().FirstOrDefault(); f.doc_id = result.NewDocId; f.TurnDocCheckBox.Checked = true; f.is_new_record = true; f.ShowDialog(); } } RefrechItemBtn.PerformClick(); }
private void CopyItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { switch (focused_tree_node.GType) { case 2: var dr = WbGridView.GetFocusedRow() as GetWayBillListWh_Result; var doc = DB.SkladBase().DocCopy(dr.Id, DBHelper.CurrentUser.KaId).FirstOrDefault(); if (cur_wtype == 5) //Ввведення залишків { using (var wb_in = new frmWBWriteOn(doc.out_wbill_id)) { wb_in.ShowDialog(); } } if (cur_wtype == -5) //Акти списання товару { using (var wb_in = new frmWBWriteOff(doc.out_wbill_id)) { wb_in.ShowDialog(); } } if (cur_wtype == 4) // Накладна переміщення { using (var wb_re_in = new frmWayBillMove(doc.out_wbill_id)) { wb_re_in.ShowDialog(); } } break; } RefrechItemBtn.PerformClick(); }
public static void WBEdit(GetWayBillListWh_Result dr) { int?result = 0; if (dr == null) { return; } using (var db = new BaseEntities()) { try { var wb = db.Database.SqlQuery <WaybillList>("SELECT * from WaybillList WITH (UPDLOCK, NOWAIT) where WbillId = {0}", dr.WBillId).FirstOrDefault(); if (wb == null) { MessageBox.Show(Resources.not_find_wb); return; } if (wb.SessionId != null) { MessageBox.Show(Resources.deadlock); return; } if (wb.Checked == 1) { if (MessageBox.Show(Resources.edit_info, "Відміна проводки", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { result = DBHelper.StornoOrder(db, dr.WBillId.Value); } else { result = 1; } } if (result == 1) { return; } if (dr.WType == 4) { using (var wb_in = new frmWayBillMove(wb.WbillId)) { wb_in.ShowDialog(); } } if (dr.WType == 5) { using (var wb_write_on = new frmWBWriteOn(wb.WbillId)) { wb_write_on.ShowDialog(); } } if (dr.WType == -5) { using (var wb_on = new frmWBWriteOff(wb.WbillId)) { wb_on.ShowDialog(); } } if (dr.WType == 7) { using (var wb_on = new frmWBInventory(wb.WbillId)) { wb_on.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; } } }