public ActionResult Open(int?id, int?detailID)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Report report = this.reportRepository.GetEntityIndexes <Report>(User.Identity.GetUserId(), HomeSession.GetGlobalFromDate(this.HttpContext), HomeSession.GetGlobalToDate(this.HttpContext)).Where(w => w.ReportUniqueID == id).FirstOrDefault();

            if (report == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            //BEGIN: Cho nay: sau nay can phai bo di, vi lam nhu the nay khong hay ho gi ca. Thay vao do, se thua ke tu base controller -> de lay userid, locationid, location official name
            var Db = new ApplicationDbContext();

            string aspUserID = User.Identity.GetUserId();
            int    userID    = Db.Users.Where(w => w.Id == aspUserID).FirstOrDefault().UserID;


            int locationID = this.moduleRepository.GetLocationID(userID);
            //BEGIN: Cho nay: sau nay can phai bo di, vi lam nhu the nay khong hay ho gi ca. Thay vao do, se thua ke tu base controller -> de lay userid, locationid, location official name



            PrintViewModel printViewModel = new PrintViewModel()
            {
                Id = id, DetailID = detailID, PrintOptionID = report.PrintOptionID, LocationID = locationID, ReportPath = report.ReportURL
            };

            return(View(viewName: "Open", model: printViewModel));
        }
Exemple #2
0
        /// <summary>
        /// Remove all Materials that were not just deserialized.
        /// </summary>
        /// <param name="printViewModel"></param>
        private void RemoveNonDeserializedMaterials(PrintViewModel printViewModel)
        {
            //List of Materials that need to be removed.
            //Materials need to be removed if they are a part of the Print but were not just deserialized.
            List <MaterialViewModel> nonDeserializedMaterialViewModelsList = new List <MaterialViewModel>();

            //Check all Materials and mark appropriate ones for removal.
            foreach (MaterialViewModel existingMaterialViewModel in printViewModel.MaterialViewModelList)
            {
                //Check if the existing Material is a deserialized Material.
                bool wasDeserialized = false;
                foreach (MaterialViewModel deserializedMaterialViewModel in _deserializedMaterialViewModelsList)
                {
                    if (existingMaterialViewModel.Name == deserializedMaterialViewModel.Name)
                    {
                        wasDeserialized = true;
                        break;
                    }
                }

                //If existing Material was not a deserialized Material, then mark it for removal.
                if (wasDeserialized == false)
                {
                    nonDeserializedMaterialViewModelsList.Add(existingMaterialViewModel);
                }
            }

            //Remove all non-deserialized Materials.
            foreach (MaterialViewModel nonDeserializedMaterial in nonDeserializedMaterialViewModelsList)
            {
                printViewModel.RemoveMaterial(nonDeserializedMaterial.Name);
            }
        }
Exemple #3
0
        public void ExecuteCommand(string cmd, object param)
        {
            switch (cmd)
            {
            case WindowsCmdConsts.PrintWnd_Show:
                Dispatcher.Invoke(new Action(delegate
                {
                    var data = new PrintViewModel();
                    Owner    = (Window)ServiceProvider.PluginManager.SelectedWindow;
                    data.LoadPrinterSettings();
                    DataContext = data;
                    Show();
                    Activate();
                    Focus();
                }));
                break;

            case WindowsCmdConsts.PrintWnd_Hide:
                Hide();
                break;

            case CmdConsts.All_Close:
                Dispatcher.Invoke(new Action(delegate
                {
                    Hide();
                    Close();
                }));
                break;
            }
        }
Exemple #4
0
        public ActionResult GetPrintMessage(string Input, string Region, bool IsPolicyID)
        {
            this.vm = new PrintViewModel();
            if (string.IsNullOrEmpty(Input) || !ModelState.IsValid)
            {
                return(View(vm));
            }

            vm.EddKey = Input;
            Mapper.MapPrintKeyToDataModel(vm, this.logDataModel);
            string PrintMessage = this.CreatePrintMessage();

            //var formattedData = new { PrintMessage = PrintMessage.Replace("|", "|\n") };
            //var formattedData = new { PrintMessage = XElement.Parse(PrintMessage).ToString() };
            try
            {
                var formattedData = new { PrintMessage = XDocument.Parse(PrintMessage).ToString() };
                return(Json(formattedData));
            }
            catch (System.Xml.XmlException ex)
            {
                var formattedData = new { PrintMessage = PrintMessage.Replace("|", "|\n") };
                return(Json(formattedData));
            }
            //return Json(formattedData);
        }
Exemple #5
0
        private void fastBarcodes_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                FastObjectListView fastBarcodes = sender as FastObjectListView;
                if (fastBarcodes.SelectedObject != null)
                {
                    BarcodeDTO barcodeDTO = fastBarcodes.SelectedObject as BarcodeDTO;
                    if (barcodeDTO != null)
                    {
                        if (true)
                        {
                            WebapiGettsa webapiGettsa = new WebapiGettsa(barcodeDTO.Label);
                            webapiGettsa.ShowDialog(); webapiGettsa.Dispose();
                        }
                        else
                        {
                            PrintViewModel printViewModel = new PrintViewModel();
                            printViewModel.ReportPath = "SearchBarcode";
                            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("Barcode", barcodeDTO.Code));

                            SsrsViewer ssrsViewer = new SsrsViewer(printViewModel);
                            ssrsViewer.Show();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Exemple #6
0
        /// <summary>
        /// Writes this program's user input into XML.
        /// </summary>
        /// <param name="printerViewModel"></param>
        /// <param name="printViewModel"></param>
        /// <param name="gCodeManagerViewModel"></param>
        /// <returns></returns>
        public string SerializeModiPrint(PrinterViewModel printerViewModel, PrintViewModel printViewModel, GCodeManagerViewModel gCodeManagerViewModel)
        {
            using (base._stringWriter = new StringWriter())
            {
                using (base._xmlWriter = XmlWriter.Create(base._stringWriter, base._xmlWriterSettings))
                {
                    //Outmost element should be "ModiPrint".
                    base._xmlWriter.WriteStartElement("ModiPrint");

                    //GCode.
                    _gCodeManagerXMLSerializerModel.SerializeGCodeManager(base._xmlWriter, _gCodeManagerViewModel);

                    //Printer.
                    //It's very important to set the Printer before the Print, or else a lot of Printer equipment will not be found to set the Print.
                    _printerXMLSerializerModel.SerializePrinter(base._xmlWriter, _printerViewModel);

                    //Print.
                    _printXMLSerializerModel.SerializePrint(base._xmlWriter, _printViewModel);

                    //End outmost element "ModiPrint".
                    base._xmlWriter.WriteEndElement();
                }

                return(base._stringWriter.ToString());
            }
        }
Exemple #7
0
        /// <summary>
        /// Deserialize a Material.
        /// </summary>
        /// <param name="xmlReader"></param>
        /// <param name="printViewModel"></param>
        private void LoadMaterial(XmlReader xmlReader, PrintViewModel printViewModel)
        {
            //Name of the new Material.
            string materialName = xmlReader.GetAttribute("Name");

            //Reference of the new Material that will be deserialized.
            MaterialViewModel newMaterial = null;

            //See if there is a matching Material.
            bool matchingMaterial = false;

            foreach (MaterialViewModel materialViewModel in printViewModel.MaterialViewModelList)
            {
                if (materialViewModel.Name == materialName)
                {
                    matchingMaterial = true;
                    newMaterial      = materialViewModel;
                }
            }

            //If there is no matching Material, then create a new Material.
            if (matchingMaterial == false)
            {
                newMaterial = printViewModel.AddMaterial(materialName);
            }

            //Loads the new material with properties from XML and remembers the newly deserialized Material.
            if (newMaterial != null)
            {
                _materialXMLDeserializerModel.DeserializerMaterial(xmlReader, newMaterial);
                _deserializedMaterialViewModelsList.Add(newMaterial);
            }
        }
Exemple #8
0
        public MainViewModel()
        {
            // Add available pages
            //PageViewModels.Add(new HomeViewModel());
            //PageViewModels.Add(new PinSelectViewModel());

            // Set starting page
            if (StartupProperties.Action == null)
            {
                CurrentPageViewModel = new HomeViewModel();//PageViewModels[0];
            }
            else
            {
                switch (StartupProperties.Action)
                {
                case StartupProperties.Actions.PINSelect:
                    CurrentPageViewModel = new PinSelectViewModel();
                    break;

                case StartupProperties.Actions.PrintCard:
                    CurrentPageViewModel = new PrintViewModel();
                    break;

                default: break;
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// Reads Print properties from XML and sets a Print with said properties.
        /// </summary>
        /// <param name="xmlReader"></param>
        /// <param name="materialViewModel"></param>
        public void DeserializePrint(XmlReader xmlReader, PrintViewModel printViewModel)
        {
            //Read through each element of the XML string and populate each property of the Print.
            while (xmlReader.Read())
            {
                //Skip through newlines (this program's XML Writer uses newlines).
                if ((xmlReader.Name != "\n") && (!String.IsNullOrWhiteSpace(xmlReader.Name)))
                {
                    //End method if the end of "Print" element is reached.
                    if ((xmlReader.Name == "Print") && (xmlReader.NodeType == XmlNodeType.EndElement))
                    {
                        //Remove all Print elements that were not just deserialized.
                        RemoveNonDeserializedMaterials(printViewModel);
                        return;
                    }

                    //Deserialize and populate each property of the Print.
                    switch (xmlReader.Name)
                    {
                    case "Material":
                        LoadMaterial(xmlReader, printViewModel);
                        break;

                    case "MaterialsCreatedCount":
                        printViewModel.MaterialsCreatedCount = xmlReader.ReadElementContentAsInt();
                        break;

                    default:
                        base.ReportErrorUnrecognizedElement(xmlReader);
                        break;
                    }
                }
            }
        }
Exemple #10
0
        // GET: /<controller>/
        public IActionResult Index(string klantId)
        {
            var model = new PrintViewModel();

            model.Adressen = new List <AddressViewModel>();

            model.Klanten = User.IsInRole("Administrator") ? _userManager.Users.ToList() : _userManager.Users.Where(x => x.OndernemerId == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList();

            ViewBag.Envelopes = _envelopeRepository.GetEnvelopesByOndernemerId(User.FindFirstValue(ClaimTypes.NameIdentifier))
                                .OrderBy(c => c.Naam)
                                .ToList()
                                .Select(c => new SelectListItem()
            {
                Text  = c.Naam,
                Value = c.Id.ToString()
            })
                                .ToList();

            if (!string.IsNullOrEmpty(klantId))
            {
                model.Adressen = _mapper.Map <List <AddressViewModel> >(_addressRepository.GetAddressesByKlantId(klantId));
                foreach (var address in model.Adressen)
                {
                    address.Land = _mapper.Map <CountryViewModel>(_countryRepository.GetById(address.LandId));
                }
                return(View(model));
            }
            return(View(model));
        }
Exemple #11
0
        protected override PrintViewModel InitPrintViewModel(int?id)
        {
            PrintViewModel printViewModel = base.InitPrintViewModel(id);

            printViewModel.ReportPath = "/ProjectManagers/PurchaseOrderSheet";
            return(printViewModel);
        }
Exemple #12
0
        public ActionResult Print1Page(int?id)
        {
            PrintViewModel printViewModel = base.InitPrintViewModel(id);

            printViewModel.ReportPath = "/ProjectManagers/PurchaseOrderSheet1Page";
            return(View("Print", printViewModel));
        }
Exemple #13
0
        public ActionResult GetPrintIORowsFromPolicyNumber(string Input, string Region)
        {
            this.vm = new PrintViewModel();

            vm.ExceedRegion.CurrentRegion = Region;
            vm.PolicyNumber = Input;
            vm.PolicyID     = this.GetPolicyIDFromPolicyNumber();
            if (!string.IsNullOrEmpty(vm.PolicyID))
            {
                List <PrintIORow> printIORow = this.CreatePrintIORows();
                if (printIORow != null && printIORow.Count > 0)
                {
                    var formattedData = new { PrintRows = printIORow };
                    return(Json(formattedData));
                }
                else
                {
                    return(this.DataNotFound("No Data found for this Policy Number."));
                }
            }
            else
            {
                return(this.DataNotFound("No Data found for this Policy Number."));
            }
        }
Exemple #14
0
        public ActionResult GetPrintMessageColAndTab()
        {
            this.vm   = new PrintViewModel();
            vm.EddKey = this.logDataModel.EddKey;
            this.GetLOBCode();

            if (string.Equals(vm.MasterCompanyNbr, "02"))
            {
                return(this.DataNotFound("Unable to find mapping for IB Policy."));
            }
            List <string> splitePrintMessage = this.CreatePrintMessage().Split('|').ToList();

            this.GetPolarisIds();
            List <DataRow> polarisData = this.GetPolirisData();
            string         printMessageWithTableColumn = string.Empty;

            splitePrintMessage.ForEach(
                message =>
            {
                string strPrintMessageRow = string.Format("<span class='printMessage'>{0}</span>", message);
                polarisData.ForEach(dr =>
                {
                    if (message.Contains(dr.Field <string>("POLARIS_ID")))
                    {
                        strPrintMessageRow += string.Format("<span class='eddTabCol'><span class='eddTable'>{0}</span><span class='eddColumn'>{1}</span></span>", dr.Field <string>("TABLE_NAME").Trim(), dr.Field <string>("COLUMN_NAME").Trim());
                    }
                });
                printMessageWithTableColumn += "<span class='eddRow'><span class='eddMTC'>" + strPrintMessageRow + "</span></span>";
            });

            var formattedData = new { PrintMessage = printMessageWithTableColumn };

            return(Json(formattedData));
        }
Exemple #15
0
        public void ExecuteCommand(string cmd, object param)
        {
            switch (cmd)
            {
            case WindowsCmdConsts.PrintWnd_Show:
                Dispatcher.Invoke(new Action(delegate
                {
                    DataContext = new PrintViewModel();
                    Show();
                    Activate();
                    Focus();
                }));
                break;

            case WindowsCmdConsts.PrintWnd_Hide:
                Hide();
                break;

            case CmdConsts.All_Close:
                Dispatcher.Invoke(new Action(delegate
                {
                    Hide();
                    Close();
                }));
                break;
            }
        }
        public ActionResult PrintOffer(string OfferID)
        {
            var customerViewModel = _context.CustomerModel.ToList();
            var offerViewModel    = _context.OfferModel.Where(o => Convert.ToString(o.Offer_ID).Contains(OfferID)).ToList();

            var viewModel = new PrintViewModel()
            {
                OfferModels    = offerViewModel,
                CustomerModels = customerViewModel
            };

            List <OfferModel> Offer        = new List <OfferModel>();
            List <OfferModel> OfferDetails = _context.OfferModel.Where(o => Convert.ToString(o.Offer_ID).Contains(OfferID)).ToList();

            foreach (var i in OfferDetails)
            {
                OfferModel offerModel = new OfferModel();
                offerModel.End_Date     = i.End_Date;
                offerModel.ForeignKey1_ = i.ForeignKey1_;
                offerModel.Offer_ID     = i.Offer_ID;
                offerModel.Offer_Price  = i.Offer_Price;
                offerModel.Offer_Title  = i.Offer_Title;
                offerModel.Start_date   = i.Start_date;

                Offer.Add(offerModel);
            }

            Print_APIController Print_Api = new Print_APIController(_hostEnvironment);

            return(File(Print_Api.Print(Offer), "application/pdf"));
        }
        public object BindPrinters(PrintViewModel bindModel)
        {
            LogUtil.Info(string.Format("关联打印设备,输入参数:{0}", JsonUtil.Serialize(bindModel)));

            SingleInstance <PrinterService> .Instance.BindPrinters(bindModel);

            return(OK());
        }
        public GCodeManagerViewModel(GCodeFileManagerModel GCodeFileManagerModel, GCodeConverterModel GCodeConverterModel, PrintViewModel PrintViewModel)
        {
            _gCodeFileManagerModel = GCodeFileManagerModel;
            _gCodeConverterModel   = GCodeConverterModel;
            _printViewModel        = PrintViewModel;

            _gCodeConverterModel.ParametersModel.LineConverted += new GCodeConverterLineConvertedEventHandler(UpdateGCodeConverterStatus);
        }
Exemple #19
0
        protected override PrintViewModel InitPrintViewModel()
        {
            PrintViewModel printViewModel = base.InitPrintViewModel();

            printViewModel.ReportPath = "GoodsReceiptSheet";
            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("GoodsReceiptID", this.goodsReceiptViewModel.GoodsReceiptID.ToString()));
            return(printViewModel);
        }
Exemple #20
0
        protected override PrintViewModel InitPrintViewModel()
        {
            PrintViewModel printViewModel = base.InitPrintViewModel();

            printViewModel.ReportPath = "PickupSheet";
            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("PickupID", this.pickupViewModel.PickupID.ToString()));
            return(printViewModel);
        }
Exemple #21
0
 /// <summary>
 /// Maps the Print rating query to data model.
 /// </summary>
 /// <param name="vm">The vm.</param>
 /// <param name="logDataModel">The log data model.</param>
 internal static void MapPrintRatingQueryToDataModel(PrintViewModel vm, LogDataModel dataModel)
 {
     dataModel.SqlQuery = vm.SqlQuery;
     dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "Region", dataModel.Region);
     dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "LOBCODE", dataModel.LOBCD);
     dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "IOCHAR", dataModel.EddKey.Split('-')[1]);
     dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "PolarisIds", dataModel.PolarisIds);
 }
Exemple #22
0
        protected virtual PrintViewModel InitPrintViewModel(int?id)
        {
            PrintViewModel printViewModel = new PrintViewModel()
            {
                Id = id != null ? (int)id : 0
            };

            return(printViewModel);
        }
        protected override PrintViewModel InitPrintViewModel()
        {
            PrintViewModel printViewModel = base.InitPrintViewModel();

            printViewModel.ReportPath = "AvailableItems";
            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("LocationID", this.LocationID.ToString()));
            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("LocationCode", this.comboLocationID.Text));
            return(printViewModel);
        }
        public ActionResult Print(int?id)
        {
            PrintViewModel printViewModel = new PrintViewModel()
            {
                Id = id != null ? (int)id : 0
            };

            return(View(printViewModel));
        }
Exemple #25
0
        protected override PrintViewModel InitPrintViewModel()
        {
            PrintViewModel printViewModel = base.InitPrintViewModel();

            printViewModel.ReportPath           = "GoodsIssueSheet";
            printViewModel.ShowPromptAreaButton = true;
            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("GoodsIssueID", this.goodsIssueViewModel.GoodsIssueID.ToString()));
            return(printViewModel);
        }
Exemple #26
0
        public object DoBindPrinter(PrintViewModel bindModel)
        {
            var url   = string.Format("{0}/mcp/sys/bindPrinters", apiurl);
            var parms = string.Format("app_id={0}&access_token={1}&merchant_code={2}&printer_codes={3}",
                                      bindModel.app_id.Trim(), bindModel.access_token.Trim(), bindModel.merchant_code.Trim(), bindModel.printer_codes.Trim());
            var result = NetUtil.ResponseByPost(url, parms);

            ViewBag.Result = result;
            return(View("BindPrinter"));
        }
        public SaveLoadViewModel(GCodeManagerViewModel GCodeManagerViewModel, PrinterViewModel PrinterViewModel, PrintViewModel PrintViewModel, ErrorListViewModel ErrorListViewModel)
        {
            _gCodeManagerViewModel = GCodeManagerViewModel;
            _printerViewModel      = PrinterViewModel;
            _printViewModel        = PrintViewModel;
            _errorListViewModel    = ErrorListViewModel;

            _modiPrintXMLSerializerModel   = new ModiPrintXMLSerializerModel(_gCodeManagerViewModel, _printerViewModel, _printViewModel, _errorListViewModel);
            _modiPrintXMLDeserializerModel = new ModiPrintXMLDeserializerModel(_gCodeManagerViewModel, _printerViewModel, _printerViewModel.GPIOPinListsViewModel, _printViewModel, _errorListViewModel);
        }
Exemple #28
0
        /// <summary>
        /// Maps the Print polaris I ds to data model.
        /// </summary>
        /// <param name="PrintViewModel">The Print view model.</param>
        /// <param name="logDataModel">The log data model.</param>
        internal static void MapPrintPolarisIDsToDataModel(PrintViewModel vm, LogDataModel dataModel)
        {
            string polarisIds = string.Empty;

            if (vm.PolarisIds != null && vm.PolarisIds.Count > 0)
            {
                vm.PolarisIds.ForEach(x => polarisIds += "'" + x + "',");
                dataModel.PolarisIds = polarisIds.Substring(0, polarisIds.Length - 1);
            }
        }
        public IActionResult Print(int?id)
        {
            PrintViewModel model = new PrintViewModel()
            {
                Invoice = _db.Invoices.Include(a => a.Products).FirstOrDefault(a => a.ID == id),
                Terms   = _db.Terms.ToList(),
            };

            return(View(model));
        }
Exemple #30
0
        //protected virtual PrintViewModel InitPrintViewModel(int? id) { return this.InitPrintViewModel(id, null); }
        protected virtual PrintViewModel InitPrintViewModel(int?id, int?detailID)
        {
            PrintViewModel printViewModel = new PrintViewModel()
            {
                Id = id != null ? (int)id : 0, DetailID = detailID
            };

            //MVC: if (this.TempData["PrintOptionID"] != null)
            //MVC:     printViewModel.PrintOptionID = (int)this.TempData["PrintOptionID"];
            return(printViewModel);
        }