Example #1
0
 private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     using (var wb_make = new frmWBDeboning(null))
     {
         wb_make.ShowDialog();
     }
 }
        private void DeboningMatBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (focused_wh_mat == null)
            {
                return;
            }

            var rec       = DB.SkladBase().MatRecipe.FirstOrDefault(w => w.MatId == focused_wh_mat.MatId && w.RType == 2);
            var wh_remain = WhRemainGridView.GetFocusedRow() as MatRemainByWh_Result;

            if (rec != null)
            {
                using (var f = new frmWBDeboning()
                {
                    rec_id = rec.RecId, source_wid = wh_remain.WId
                })
                {
                    f.ShowDialog();
                }

                RefreshWhBtn.PerformClick();
            }
            else
            {
                MessageBox.Show("Не можливо виконати овалку, не знайдено рецепт!");
            }
        }
Example #3
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();
        }
Example #4
0
        private void CopyItemBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (focused_tree_node.GType)
            {
            case 1:
                var doc = DB.SkladBase().DocCopy(focused_row.Id, DBHelper.CurrentUser.KaId).FirstOrDefault();
                using (var wb_in = new frmWBManufacture(doc.out_wbill_id))
                {
                    wb_in.is_new_record = true;
                    wb_in.ShowDialog();
                }
                break;

            case 3:
                var doc2 = DB.SkladBase().DocCopy(focused_row.Id, DBHelper.CurrentUser.KaId).FirstOrDefault();
                using (var wb_in = new frmWBDeboning(doc2.out_wbill_id))
                {
                    wb_in.is_new_record = true;
                    wb_in.ShowDialog();
                }
                break;

            case 4:
                var new_pp = DB.SkladBase().DocCopy(pp_focused_row.Id, DBHelper.CurrentUser.KaId).FirstOrDefault();
                using (var wb_in = new frmProductionPlans(new_pp.out_doc_id))
                {
                    wb_in.is_new_record = true;
                    wb_in.ShowDialog();
                }

                break;

            case 5:
                var pc_copy = DB.SkladBase().DocCopy(pc_focused_row.Id, DBHelper.CurrentUser.KaId).FirstOrDefault();

                using (var pc = new frmPlannedCalculation(pc_copy.out_doc_id))
                {
                    pc.is_new_record = true;
                    pc.ShowDialog();
                }
                break;
            }

            RefrechItemBtn.PerformClick();
        }
Example #5
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;
                }
            }
        }