Beispiel #1
0
        private void NewItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (focused_tree_node == null)
            {
                return;
            }

            switch (focused_tree_node.GType.Value)
            {
            case 1:
                using (var wb_make = new frmWBManufacture(null))
                {
                    wb_make.ShowDialog();
                }
                break;

            case 3:
                using (var wb_make = new frmWBDeboning(null))
                {
                    wb_make.ShowDialog();
                }
                break;

            case 4:
                using (var wb_pp = new frmProductionPlans(null))
                {
                    wb_pp.ShowDialog();
                }
                break;

            case 5:
                using (var wb_pc = new frmPlannedCalculation())
                {
                    wb_pc.ShowDialog();
                }
                break;

            case 6:
                using (var wb_make = new frmPreparationRawMaterials(null))
                {
                    wb_make.ShowDialog();
                }
                break;
            }

            RefrechItemBtn.PerformClick();
        }
Beispiel #2
0
        public static void WBEdit(int WType, int WbillId)
        {
            int?result = 0;

            /*  if (dr == null)
             * {
             *    return;
             * }*/

            using (var db = new BaseEntities())
            {
                try
                {
                    var wb = db.WaybillList.FirstOrDefault(f => f.WbillId == WbillId);

                    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, WbillId);
                        }
                        else
                        {
                            result = 1;
                        }
                    }

                    if (result == 1)
                    {
                        return;
                    }


                    if (WType == -20)
                    {
                        using (var wb_make = new frmWBManufacture(WbillId))
                        {
                            wb_make.ShowDialog();
                        }
                    }

                    if (WType == -22)
                    {
                        using (var wb_make = new frmWBDeboning(WbillId))
                        {
                            wb_make.ShowDialog();
                        }
                    }

                    if (WType == -24)
                    {
                        using (var wb_make = new frmPreparationRawMaterials(WbillId))
                        {
                            wb_make.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;
                }
            }
        }