示例#1
0
 public override void ExecuteNewCommand()
 {
     SelectedOrder = new ORDR_SpecialOrder();
     SelectedSpecialOrderDetails = null;
     FormTitle = "Nuevo Pedido Especial";
     ShowDialog(new SpecialOrderView(), this, ResizeMode.CanResize);
 }
示例#2
0
        private void Sync(ORDR_SpecialOrder currentOrder)
        {
            if (!WebApiClient.IsAvailableConnection)
            {
                return;
            }

            // UPLOAD REPORT FILE
            currentOrder.FileName = currentOrder.ReportFileName;

            var pathFie = System.IO.Path.Combine(Config.ReportPath, currentOrder.ReportFileName);

            //if (!WebApiClient.Upload(Config.WhsCode, Path.Combine(Config.ReportPath, pathFie))) return;


            //// Sync Customer Product pircure.
            //if (currentOrder.ATC1_Attachments.Any())
            //{

            //    currentOrder.ATC1_Attachments.Where(f => File.Exists(f.FileName))
            //        .ToList().ForEach(attch => WebApiClient.Upload(Config.WhsCode, attch.FileName));
            //}

            var order = WebApiClient.AddSpecialOrder(currentOrder).Result;

            // update model from .
            currentOrder = SpecialOrdersHelper.GetOrder(currentOrder.IdSpecialOrder);

            currentOrder.UpdateModelPropertiesFrom(order.Model);
            order.UpdateEntityVersion();
        }
示例#3
0
        private void GetSelectedArticle(OITM_Articles article)
        {
            IsModalVisible = false;

            if (SelectedOrder == null)
            {
                SelectedOrder = new ORDR_SpecialOrder();
            }

            if (SelectedOrder != null)
            {
                var detail = new RDR1_SpecialOrderDetail()
                {
                    ItemCode      = article.ItemCode,
                    Price         = articleChooserViewModel.ProductPriceDecimal,
                    Quantity      = articleChooserViewModel.Quantity,
                    LineTotal     = articleChooserViewModel.TotalPriceToDecimal,
                    OITM_Articles = article
                };
                SelectedOrder.RDR1_SpecialOrderDetail.Add(detail);
                articleChooserViewModel.CleanFields();
                DetailsCollection.Add(detail);
                RaisePropertyChanged("DetailsCollection");
                RefreshPriceTotal();
                if (OnSelectedArticle != null)
                {
                    OnSelectedArticle();
                }
            }
        }
示例#4
0
        public static ObservableCollection <OITM_Articles> GetSpecialOrdersProducts(ORDR_SpecialOrder specialOrder)
        {
            lock (Extensions.Locker)
            {
                var db = ContextFactory.GetDBContext();

                IQueryable <OITM_Articles> products = db.OITM_Articles;

                if (specialOrder == null || (specialOrder.Style == null && specialOrder.Cake == null && specialOrder.Especiality == null))
                {
                    return(new ObservableCollection <OITM_Articles>());
                }

                if (specialOrder.Style != null)
                {
                    products = products.Where(p => p.U_estilo == specialOrder.Style.Code);
                }

                if (specialOrder.Cake != null)
                {
                    products = products.Where(p => p.U_torta == specialOrder.Cake.Code);
                }

                if (specialOrder.Especiality != null)
                {
                    products = products.Where(p => p.U_Especialidad == specialOrder.Especiality.Code);
                }

                var prods = products.ToList();

                //prods.ForEach(p=> p.ChangeEntityState(EntityState.Unchanged));

                return(new ObservableCollection <OITM_Articles>(prods));
            }
        }
示例#5
0
        public static Task <Synchro <ORDR_SpecialOrder> > AddSpecialOrder(ORDR_SpecialOrder order)
        {
            //order.FileName = order.ReportFileName;
            //var path = string.Format("api/SpecialOrder?filename={0}",order.ReportFileName);

            //PutAsync<ORDR_SpecialOrder, bool>("api/SpecialOrder", order);

            return(PostAsync <ORDR_SpecialOrder, Synchro <ORDR_SpecialOrder> >("api/SpecialOrder", order));
        }
        public static void DeleteOrder(ORDR_SpecialOrder selectedOrder)
        {
            lock (Extensions.Locker)
            {
                var db = ContextFactory.GetDBContext();

                if (db.Entry(selectedOrder).State != EntityState.Added)
                {
                    db.ORDR_SpecialOrder.Remove(selectedOrder);
                }
            }
        }
 public static void AddOrder(ORDR_SpecialOrder selectedOrder)
 {
     lock (Extensions.Locker)
     {
         if (selectedOrder.IdSpecialOrder == 0)
         {
             ContextFactory.GetDBContext().ORDR_SpecialOrder.Add(selectedOrder);
         }
         else
         {
             selectedOrder.ChangeEntityState(EntityState.Modified);
         }
     }
 }
示例#8
0
        private string MoveFileToLocal(string path, ORDR_SpecialOrder order)
        {
            try
            {
                var extension  = Path.GetExtension(path);
                var targetPath = Path.Combine(Config.ReportPath, order.WhsCode + '_' + Guid.NewGuid() + extension);

                File.Copy(path, targetPath);

                return(targetPath);
            }
            finally
            {
            }
        }
示例#9
0
        public static void BuildSpecialOrderPdf(ORDR_SpecialOrder order, ICommand savePdfCommand)
        {
            //var control = new SpecialOrderReport(savePdfCommand);

            //control.rViewer.LocalReport.ReportPath =
            //    ApplicationPath.GetFullPath(@"Views\UserControls\SpecialOrderDocument.rdlc");

            //var dataManager = new ReportDataSourceManager(order);

            //dataManager.GetAllDataSources().ForEach(data => control.rViewer.LocalReport.DataSources.Add(data));

            //control.rViewer.ZoomPercent = 100;
            //control.rViewer.RefreshReport();

            //var dialog = new WindowContentView();
            //dialog.ContentView.Children.Add(control);

            //if (this.CloseAction == null)
            //    this.CloseAction = new Action(() => dialog.Close());
        }
示例#10
0
        public static void SaveSpecialOrderToFile(ORDR_SpecialOrder specialORder, string fullFilePath)
        {
            var dataManager = new ReportDataSourceManager(specialORder);

            //ReportViewer viewer = new ReportViewer();

            //viewer.ProcessingMode = ProcessingMode.Local;
            //viewer.LocalReport.Refresh();
            //viewer.LocalReport.ReportPath = ApplicationPath.GetFullPath(@"Views\UserControls\SpecialOrderDocument.rdlc");


            //dataManager.GetAllDataSources().ForEach(data => viewer.LocalReport.DataSources.Add(data));

            //Warning[] warnings;
            string[] streamIds;
            string   mimeType  = string.Empty;
            string   encoding  = string.Empty;
            string   extension = string.Empty;
            DataSet  dsGrpSum,
                     dsActPlan,
                     dsProfitDetails,
                     dsProfitSum,
                     dsSumHeader,
                     dsDetailsHeader,
                     dsBudCom = null;

            //byte[] bytes = viewer.LocalReport.Render(
            //    "PDF", null, out mimeType, out encoding, out extension,
            //    out streamIds, out warnings);
            //byte[] bytes = viewer.LocalReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
            //Now that you have all the bytes representing the PDF report, buffer it and send it to the client.

            var path = ApplicationPath.GetFullPath(fullFilePath);

            using (FileStream fs = new FileStream(path, FileMode.Create))
            {
                //fs.Write(bytes, 0, bytes.Length);
            }
        }
示例#11
0
 public ReportDataSourceManager(ORDR_SpecialOrder specialORder)
 {
     // DataSourceCache = BuilDataSource(specialORder);
 }