private WebsiteContentActions actions2; //added by gene
 public AdminController()
 {
     db           = new lipatdbEntities();
     service      = new AdminService(db);
     ExcelActions = new ExcelActions();
     actions2     = new WebsiteContentActions();
 }
        //FILE DOWNLOAD

        public void DownloadCuttingInstuctions(int productionId)
        {
            var repo      = new ProductionRespository(Properties.Settings.Default.ManufacturingConStr);
            var prod      = repo.GetProductionForExcel(productionId);
            var prodexcel = ExcelActions.ProductionToFormatForExcel(prod);
            var sheet     = ExcelActions.CuttingInstruction(prodexcel);
            var fileName  = prod.Date.ToString("MM.dd");

            FileDownload(sheet, fileName);
        }
        public ActionResult ConvertCTToItems(ProductionForCT production)
        {
            if (production.LastLotNumber < LotNumberIndex())
            {
                AddLotNumbers(production);
            }
            var prodItems = ExcelActions.ConvertProductoinToCTs(production);

            if (prodItems.CuttingInstructions.Count() > 0)
            {
                Session["prodItems"] = prodItems;
                prodItems.CuttingInstructions.ForEach(ct => { if (string.IsNullOrEmpty(ct.Marker.MarkerSizeText))
                                                              {
                                                                  GetMarkerText(ct.Marker);
                                                              }
                                                      });
                var errors = ExcelActions.GetErrors();
                return(Json(new { prodItems = new { prodItems.Date, CuttingInstructions = prodItems.CuttingInstructions.Select(ct =>
                        {
                            return new
                            {
                                ct.Marker,
                                ct.LotNumber,
                                Details = ct.Details.Select(d =>
                                {
                                    return new
                                    {
                                        d.ColorMaterial,
                                        Items = d.Items.Select(i =>
                                        {
                                            return new
                                            {
                                                i.Id,
                                                i.ItemId,
                                                i.Quantity,
                                                Item = new
                                                {
                                                    i.Item.SKU
                                                },
                                                i.Packaging
                                            };
                                        })
                                    };
                                }),
                            };
                        }) }, errors }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var errors = ExcelActions.GetErrors();
                return(Json(new { prodItems = 0, errors }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult NewProduction(HttpPostedFileBase cuttingTicket)
        {
            Session["file"] = cuttingTicket;
            var dT         = ExcelActions.ConvertXSLXtoDataTable(cuttingTicket);
            var production = ExcelActions.ConvertCtToProduction(dT);

            production = AddLotNumbers(production);
            var errors = ExcelActions.GetErrors();

            Session["Production"] = production;
            return(Json(new { production, errors }, JsonRequestBehavior.AllowGet));
        }
        private Action <Object> ActionWithAnimation(Action <object> action, DependencyObject d)
        {
            return(a =>
            {
                action(null);

                var control = (Control)d;

                if (ExcelActions.GetPaintFlash(d))
                {
                    colorator.FlashColor(control, ExcelActions.GetColorFlash(d).Color);
                }
            });
        }
Ejemplo n.º 6
0
 private void bt_Click(object sender, RoutedEventArgs e)
 {
     ExcelActions.SetColorFlash(dgDatos, Brushes.Yellow);
 }
        public ExcelActionsCommandInfo GenerateCommands(DependencyObject d)
        {
            ICommand commandCopyAll = new RelayCommands(ActionWithAnimation(a => allCopier.Copy(d, ExcelActions.GetContainsHeader(d)), d), a => allCopier.CanCopy(d));
            ICommand commandCopy    = new RelayCommands(ActionWithAnimation(a => selectedCopier.Copy(d, ExcelActions.GetContainsHeader(d)), d), a => selectedCopier.CanCopy(d));
            ICommand pasteCommand   = new RelayCommands(ActionWithAnimation(a => itemsSourceInserts.Insert(d,
                                                                                                           Clipboard.GetText(),
                                                                                                           ExcelActions.GetShowErrorMessages(d),
                                                                                                           ExcelActions.GetCancelWithErrors(d)), d),
                                                        a => Clipboard.ContainsText());

            var result = new ExcelActionsCommandInfo {
                CopyAllCommmand = commandCopyAll, CopyCommand = commandCopy, PasteCommand = pasteCommand
            };

            return(result);
        }