Example #1
0
 public void AmendExportDetail()
 {
     if (CreateBoxChecks())
     {
         return;
     }
     if (CurrentExportDetail == null)
     {
         MessageBox.Show("Please Select an Item.");
         return;
     }
     using (var ctx = new MNIBDBDataContext())
     {
         var rd = ctx.ExportDetails.FirstOrDefault(x => x.ExportDetailId == CurrentExportDetail.ExportDetailId);
         if (rd == null)
         {
             MessageBox.Show("Item No Yet Saved!");
             return;
         }
         rd = ctx.ExportDetails.FirstOrDefault(x => x.ExportDetailId == CurrentExportDetail.ExportDetailId);
         UpdateExportDetail(rd);
         OnPropertyChanged(nameof(TotalBoxWeight));
         CurrentExportDetail.Weight = Weight - Box.Weight;
         ctx.SubmitChanges();
         Print(rd);
     }
     ResetAfterEditorAdd();
 }
Example #2
0
        private bool CreateExport(MNIBDBDataContext ctx)
        {
            if (TotalWeight == 0)
            {
                MessageBox.Show("Please Enter Total Weight");
                return(false);
            }
            if (SetExport(ctx))
            {
                return(true);
            }

            Export = new Export()
            {
                ExportDate         = ExportDate,
                SourceTransaction  = SourceTransaction,
                ProductNumber      = Product.ProductId,
                ProductDescription = Product.ProductDescription,
                TotalWeight        = TotalWeight
            };
            ctx.Exports.InsertOnSubmit(Export);
            ctx.SubmitChanges();

            return(true);
        }
Example #3
0
        private bool CreateExport(MNIBDBDataContext ctx)
        {
            if (TotalWeight == 0)
            {
                MessageBox.Show("Please Enter Total Weight");
                return(false);
            }
            if (SourceTransaction == "Sales Order" && (CurrentHarvester == null && string.IsNullOrEmpty(Barcode)))
            {
                MessageBox.Show("Please Enter Current Harvester");
                return(false);
            }
            if (SourceTransaction != "Sales Order" && string.IsNullOrEmpty(Barcode))
            {
                MessageBox.Show("Please Enter Barcode");
                return(false);
            }
            if (SetExport(ctx))
            {
                return(true);
            }

            Export = new Export()
            {
                ExportDate        = ExportDate,
                SourceTransaction = SourceTransaction,
                TotalWeight       = TotalWeight
            };
            ctx.Exports.InsertOnSubmit(Export);
            ctx.SubmitChanges();

            return(true);
        }
Example #4
0
        public void CreateExportDetail()
        {
            if (SourceTransaction == "Sales Order" && (CurrentHarvester == null && string.IsNullOrEmpty(Barcode)))
            {
                MessageBox.Show("Please Enter Current Harvester Or Barcode if already received.");
                return;
            }
            if (SourceTransaction != "Sales Order" && string.IsNullOrEmpty(Barcode))
            {
                MessageBox.Show("Please Enter Barcode");
                return;
            }
            if (CreateBoxChecks())
            {
                return;
            }
            using (var ctx = new MNIBDBDataContext())
            {
                if (!CreateExport(ctx))
                {
                    return;
                }

                if (CurrentExportDetail == null)
                {
                    var rd = UpdateExportDetail(new ExportDetail());
                    ctx.ExportDetails.InsertOnSubmit(rd);
                    ExportDetails.Insert(0, rd);
                    ctx.SubmitChanges();
                    PrintLarge(rd);
                }
            }
            ResetAfterEditorAdd();
        }
Example #5
0
 public void DeleteLine()
 {
     if (CurrentExportDetail == null)
     {
         MessageBox.Show("Please Select Line to Delete!");
         return;
     }
     using (var ctx = new MNIBDBDataContext())
     {
         var r = ctx.ExportDetails.FirstOrDefault(x => x.ExportDetailId == CurrentExportDetail.ExportDetailId);
         ctx.ExportDetails.DeleteOnSubmit(r);
         ctx.SubmitChanges();
         ExportDetails.Remove(CurrentExportDetail);
         currentExportDetail = null;
         Weight = 0;
         OnPropertyChanged(nameof(Weight));
     }
 }
Example #6
0
        public void CreateExportDetail()
        {
            if (CreateBoxChecks())
            {
                return;
            }
            using (var ctx = new MNIBDBDataContext())
            {
                if (!CreateExport(ctx))
                {
                    return;
                }

                if (CurrentExportDetail == null)
                {
                    var rd = UpdateExportDetail(new ExportDetail());
                    ctx.ExportDetails.InsertOnSubmit(rd);
                    ExportDetails.Insert(0, rd);
                    ctx.SubmitChanges();
                    Print(rd);
                }
            }
            ResetAfterEditorAdd();
        }