Esempio n. 1
0
        public void Print(BarcodeVolksschiessen barcodeInfo)
        {
            DocumentClass doc      = new DocumentClass();
            const string  path     = @".\Templates\Volksschiessen_2015.lbx";
            string        fullPath = Path.GetFullPath(path);

            if (doc.Open(fullPath))
            {
                IObject barcode = doc.GetObject("barcode");
                barcode.Text = Convert.ToString(barcodeInfo.Barcode);

                IObject shooterName = doc.GetObject("shooterName");
                shooterName.Text = Convert.ToString(barcodeInfo.FirstName + " " + barcodeInfo.LastName);

                IObject dateOfBirth = doc.GetObject("dateOfBirth");
                dateOfBirth.Text = Convert.ToString(barcodeInfo.DateOfBirth != null ? ((DateTime)barcodeInfo.DateOfBirth).ToString("dd.MM.yyyy") : string.Empty);

                IObject groupName = doc.GetObject("GroupName");
                groupName.Text = Convert.ToString(barcodeInfo.Gruppenstich ?? string.Empty);

                IObject isGroup = doc.GetObject("isGruppen");
                isGroup.Text = Convert.ToString(barcodeInfo.Gruppenstich == null ? string.Empty : "x");

                doc.StartPrint("", PrintOptionConstants.bpoDefault);
                doc.PrintOut(1, PrintOptionConstants.bpoDefault);
                doc.EndPrint();
                doc.Close();
            }
            else
            {
                throw new InvalidOperationException(string.Format("Can not open template file '{0}'", fullPath));
            }
        }
Esempio n. 2
0
 private static void setPackages(StringBuilder code, DocumentClass docClass)
 {
     foreach (var indicator in packageIndicators)
     {
         addUsePackagesForFormat(code, indicator, docClass);
     }
 }
    public void Print(BarcodeVolksschiessen barcodeInfo)
    {
      DocumentClass doc = new DocumentClass();
      const string path = @".\Templates\Volksschiessen_2015.lbx";
      string fullPath = Path.GetFullPath(path);
      if (doc.Open(fullPath))
      {
        IObject barcode = doc.GetObject("barcode");
        barcode.Text = Convert.ToString(barcodeInfo.Barcode);

        IObject shooterName = doc.GetObject("shooterName");
        shooterName.Text = Convert.ToString(barcodeInfo.FirstName + " " + barcodeInfo.LastName);

        IObject dateOfBirth = doc.GetObject("dateOfBirth");
        dateOfBirth.Text = Convert.ToString(barcodeInfo.DateOfBirth != null ? ((DateTime)barcodeInfo.DateOfBirth).ToString("dd.MM.yyyy") : string.Empty);

        IObject groupName = doc.GetObject("GroupName");
        groupName.Text = Convert.ToString(barcodeInfo.Gruppenstich ?? string.Empty);

        IObject isGroup = doc.GetObject("isGruppen");
        isGroup.Text = Convert.ToString(barcodeInfo.Gruppenstich == null ? string.Empty : "x");

        doc.StartPrint("", PrintOptionConstants.bpoDefault);
        doc.PrintOut(1, PrintOptionConstants.bpoDefault);
        doc.EndPrint();
        doc.Close();
      }
      else
      {
        throw new InvalidOperationException(string.Format("Can not open template file '{0}'", fullPath));
      }
    }
Esempio n. 4
0
        //------------------------------------------------------------------------------------------------------------------------------------
        // Методы, необходимые для реализации преобразований
        //------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Добавление в документ типа DOC_FOR_COMPLEX_PART или DOC_FOR_TITUL раздела с перемещением в него соответствующих комплектов
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static bool InsertPartition(DocumentClass doc)
        {
            if (doc.Id != "DOC_FOR_COMPLEX_PART" && doc.Id != "DOC_FOR_TITUL")
            {
                return(false);
            }
            //Перемещение основных комплектов в разделы соответствующих марок
            var complects = doc.Childs.Where(child => child.Id == "COMPLECT").ToList();

            foreach (DocumentClass child in complects)
            {
                //Определяем имя раздела для комплекта child
                string partitionName = GetPartitionNameFromComplectName(child.Name);
                //Пытаемся найти раздел в parent (возможно он был создан ранее)
                DocumentClass partition = doc.Childs.FirstOrDefault(c => c.Id == "DOC__MARK" && c.Name == partitionName);
                //Если раздел не найден в parent - создаем его и добавляем в parent
                if (partition == null)
                {
                    partition = new DocumentClass {
                        Id = "DOC__MARK", Name = partitionName
                    };
                    doc.Childs.Add(partition);
                }
                //Перемещаем основной комплект в найденный/созданный раздел
                partition.Add(child);
                doc.Childs.Remove(child);
            }
            return(true);
        }
Esempio n. 5
0
        public void Tests()
        {
            testedClassificator = new RadialNetwork(12, 2);
            Console.WriteLine("Instance crated");
            Assert.IsNotNull(testedClassificator);
            dictionary = new DictionaryFake(100);
            dictionary.Init(null);
            Console.WriteLine("Instance crated");
            Assert.IsNotNull(testedClassificator);
            DocumentClass.AddClass("zero");
            DocumentClass.AddClass("jeden");
            //testedClassificator.Learn(dictionary);
            int counter = 0;
            int total   = 100;

            for (int i = 0; i < total; i++)
            {
                double[] test = GenTestVector();
                Console.WriteLine(test[0] + " " + test[1]);
                int desired = desiredOutput(test);
                int get     = testedClassificator.Classificate(test);
                Console.WriteLine("Spodzienawy wynik: " + desired);
                Console.WriteLine("Otrzymany wynik: " + get);
                if (get == desired)
                {
                    Console.WriteLine("---------------------------------------OK!");
                    counter++;
                }
                Console.WriteLine();
            }
            Console.WriteLine("Skutecznosc rzedu: " + (double)counter / total * 100);
        }
Esempio n. 6
0
        private void RadialNeuralLearn()
        {
            if (learningDocInfo != null && learningDocInfo.SourceDir != Settings.Default.pathLearningDir)
            {
                learningDocInfo = null;
            }

            //ładuje listę kategorii
            DocumentClass.LoadFromFiles(Settings.Default.pathLearningDir, PreprocessingConsts.CategoryFilePattern);

            //stworzenie słownika
            dictionary = DictionaryFactory(Settings.Default.pathSummaryFile);
            //dictionary.LearningData = new List<DocClass.Src.Learning.LearningPair>();

            //stworzenie sieci
            radialNetwork = new RadialNetwork(Settings.Default.numberNeuronsHidden, DocumentClass.CategoriesCount);

            DocumentList dl = PreprocessingUtility.CreateLearningDocumentList(Settings.Default.pathLearningDir, dictionary, (DocumentRepresentationType)Settings.Default.documentRepresentationType, learningDocInfo);

            if (radialNetwork.Learn(dl) == false)
            {
                radialNetwork = null;
                dictionary    = null;
            }
        }
Esempio n. 7
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            string templatePath = TEMPLATE_DIRECTORY;

            // None decoration frame
            if (cmbTemplate.SelectedIndex == 0)
            {
                templatePath += TEMPLATE_SIMPLE;
            }
            // Decoration frame
            else
            {
                templatePath += TEMPLATE_FRAME;
            }

            bpac.DocumentClass doc = new DocumentClass();
            if (doc.Open(templatePath) != false)
            {
                doc.GetObject("objCompany").Text = txtCompany.Text;
                doc.GetObject("objName").Text    = txtName.Text;

                // doc.SetMediaById(doc.Printer.GetMediaId(), true);
                doc.StartPrint("", PrintOptionConstants.bpoDefault);
                doc.PrintOut(1, PrintOptionConstants.bpoDefault);
                doc.EndPrint();
                doc.Close();
            }
            else
            {
                MessageBox.Show("Open() Error: " + doc.ErrorCode);
            }
        }
Esempio n. 8
0
        public static void print(PrintModel print)
        {
            try
            {
                string directory = Directory.GetCurrentDirectory();
                string pfad      = directory + @"\ivy_label.LBX";

                bpac.DocumentClass doc = new DocumentClass();
                doc.Open(pfad);

                doc.GetObject("ArticleID").Text              = print.ArticleID.ToString();
                doc.GetObject("ArticleBCode").Text           = print.ArticleID.ToString();
                doc.GetObject("Manufacturer").Text           = print.Manufacturer.ToString();
                doc.GetObject("ManufacturerPartNumber").Text = print.ManufacturerPartNumber.ToString();
                doc.GetObject("ArticleQR").Text              = print.ArticleID.ToString();
                doc.GetObject("Description").Text            = print.Description.ToString();
                doc.SetPrinter("Brother QL-500", true);
                doc.StartPrint("", PrintOptionConstants.bpoDefault);
                doc.PrintOut(1, PrintOptionConstants.bpoDefault);
                doc.EndPrint();
                doc.Close();
            }catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Metoda wywołuje odpowiednią klasyfikacje na podstawie wybranej opcji.
        /// </summary>
        public void ClassificateProcess()
        {
            classificationResult = new List <string>();
            string categoryName;

            foreach (string path in fileToClassification)
            {
                if (classificationWorker.CancellationPending)
                {
                    return;
                }

                switch ((ClasyficatorType)Settings.Default.clasificatorType)
                {
                case (ClasyficatorType.Bayes):
                    categoryName = BayesClassificate(path);
                    break;

                case (ClasyficatorType.RadialNeural):
                    int result = RadialNeuralClassificate(path);
                    categoryName = DocumentClass.GetClassName(result);
                    break;

                default:
                    throw new NotImplementedException("Nieznany typ klasyfikacji.");
                }

                //zapisanie wyniku klasyfikacji
                classificationResult.Add(categoryName);

                //progress
                classificationWorker.ReportProgress(1, path);
            }
        }
 private void SetOptions(DocumentClass doc)
 {
     doc.SetOptInt(Tidy.TidyOptionId.TidyIndentSpaces,4);
     doc.SetOptValue(Tidy.TidyOptionId.TidyIndentContent,"auto");
     doc.SetOptValue(Tidy.TidyOptionId.TidyIndentAttributes,"yes");
     doc.SetOptValue(Tidy.TidyOptionId.TidyMark,"no");
 }
        public void Print(Bitmap QRCode)
        {
            var _toprint = PrinterErrorCheck(QRLocation);

            if (_toprint == ToPrint.Yes)
            {
                DocumentClass document = new DocumentClass();
                document.Printed += new IPrintEvents_PrintedEventHandler(HandlePrinted);
                document.Open(QRLocation);

                #region Document Object Text
                using (MemoryStream ms = new MemoryStream())
                {
                    QRCode.Save(ms, ImageFormat.Bmp);
                    document.GetObject("QRImage").SetData(0, ms, 4);
                }
                #endregion

                document.StartPrint((QRCode.GetHashCode().ToString() + " Print Job"), PrintOptionConstants.bpoDefault);
                document.PrintOut(1, PrintOptionConstants.bpoDefault);
                int ErrorCode = document.ErrorCode;

                Console.WriteLine("Error Code > " + ErrorCode);

                document.EndPrint();
                document.Close();
            }
            else if (_toprint == ToPrint.Retry)
            {
                restartPrint(QRCode);
            }
        }
Esempio n. 12
0
        public ActionResult CreateCoverLetter(string LoanId, string DocumentClassId, string UserAccountId)
        {
            String message = "Failure";
            Guid   loanId;

            if (Guid.TryParse(LoanId, out loanId))
            {
                DocumentClass documentClass = DocumentClassId == "ReDisclosures" ? DocumentClass.ReDisclosuresMailingCoverLetter : DocumentClass.InitialDisclosuresMailingCoverLetter;

                if (!DocumentsServiceFacade.MailRoomCoverLetterExists(loanId, documentClass))
                {
                    var mailRoomCoverLetter = new MailRoomCoverLetter()
                    {
                        LoanId        = loanId,
                        DocumentClass = documentClass,
                        //UserAccountId = userAccountId
                    };

                    var response = LoanServiceFacade.MailingRoomCoverLetter(mailRoomCoverLetter);
                    message = response != null && response.Saved ? "Success" : "Failure";
                }
            }

            JsonResult jsonData = Json(new
            {
                Succes = message
            }, JsonRequestBehavior.AllowGet);

            return(jsonData);
        }
        private void toolStripButton7_Click(object sender, EventArgs e)
        {
            var re = MessageBox.Show("需要打印列表中的货位条码码?", "提示", MessageBoxButtons.OKCancel);

            if (re == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (!System.IO.File.Exists("resources\\名称.lbx"))
            {
                MessageBox.Show("条码打印模板文件不存在,请增加一个!");
                return;
            }

            bpac.DocumentClass doc = new DocumentClass();

            doc.Open("resources\\名称.lbx");

            foreach (DataGridViewRow i in this.dataGridView1.Rows)
            {
                Business.Models.WareHouseZonePositionModel m = i.DataBoundItem as Business.Models.WareHouseZonePositionModel;
                doc.GetObject("Title").Text = m.WareHouseZoneName + "  " + m.Name;

                doc.SetBarcodeData(0, m.BarCode);
                doc.StartPrint("", PrintOptionConstants.bpoHalfCut);
                doc.PrintOut(1, PrintOptionConstants.bpoHalfCut | PrintOptionConstants.bpoChainPrint);
            }

            doc.EndPrint();
            doc.Close();
        }
Esempio n. 14
0
        /// <summary>
        /// Tworzy dokument na podstawie wcześniej przygotowanego pliku.
        /// </summary>
        /// <param name="fileName">Plik z danymi.</param>
        /// <param name="dictionary">Słownik, na podstawie którego tworzony jest dokument.</param>
        /// <param name="className">Nazwa klasy, do której należy dany dokument lub null, jeśli klasa jest nieznana.</param>
        /// <param name="learningDocInfo">Obiekt zawierający informacje o wszystkich dokumentach uczących.</param>
        public TfIdfDocument(String fileName, Dictionary dictionary, String className, LearningDocInfo learningDocInfo)
            : base(dictionary)
        {
            wordCountList = new WordCountList();
            if (className != null)
            {
                classNo = DocumentClass.GetClassIndex(className);
            }
            //tworze liste wszystkich słów ze wszystkuch dokumentów
            Dictionary <String, WordInfo> allWordsInfo = learningDocInfo.AllWordsInfo;
            double allDocNumber = learningDocInfo.AllDocCount;
            //tworze liste słów w dokumencie
            WordCountList wordsInDoc = new WordCountList(fileName);

            int wordsInDocCount = wordsInDoc.GetAllWordsCount();

            foreach (String word in dictionary)
            {
                if (wordsInDoc[word] != -1)
                {
                    double inclDocCount = allWordsInfo[word].InclDocCount;
                    //double tfIdf = (wordsInDoc[word] / wordsInDocCount) * Math.Log10(allDocNumber/inclDocCount);
                    double tfIdf = PreprocessingUtility.ComputeTfIdf(wordsInDoc[word], wordsInDocCount, allDocNumber, inclDocCount);
                    wordCountList.Add(new WordCountPair(word, tfIdf));
                }
                else
                {
                    wordCountList.Add(new WordCountPair(word, 0));
                }
            }
        }
        private void paymentGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView senderGrid = (DataGridView)sender;

            if (e.ColumnIndex < 0)
            {
                return;
            }

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                DataRowView paymentRowView = (DataRowView)senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningRow.DataBoundItem;

                DataRow paymentRow = paymentRowView.Row;
                DataRow customer   = DocumentClass.GetCustomer(-1);

                if (customer == null)
                {
                    return;
                }

                paymentRow[PaymentImport.IDCUSTOMER_COLUMN]   = customer["idcustomer"];
                paymentRow[PaymentImport.CUSTOMERNAME_COLUMN] = customer["name"];
            }
        }
Esempio n. 16
0
        private void button8_Click(object sender, EventArgs e)
        {
            DocumentClass.LoadFromFiles(folderTextBox.Text, PreprocessingConsts.CategoryFilePattern);
            Console.Write(DocumentClass.ToString());
            CategoryList categoryList = new CategoryList(folderTextBox.Text, PreprocessingConsts.CategoryFilePattern);

            MessageBox.Show("Koniec");
        }
        public void constructor_should_create_empty_usePackages()
        {
            // When
            SUT = new DocumentClass();

            // Then
            Assert.IsEmpty(SUT.UsePackages);
        }
Esempio n. 18
0
 public IDictionary <string, object> GetDocumentProperties(Guid id,
                                                           IEnumerable <SingleObjectResponse> documentObject = null,
                                                           ObjectStore objectStore     = DefaultObjectStore,
                                                           DocumentClass documentClass = DefaultDocumentClass) => (documentObject ?? GetDocumentObject(id, null, null, objectStore, documentClass))
 .SelectMany(o => o.Object.Property)
 .ToDictionary <PropertyType, string, object>
 (
     p => p.propertyId, Utilities.GetPropertyValue
 );
Esempio n. 19
0
        public void SaveSection(int index, string savepath)
        {
            Doc.Sections[index].Range.Select();
            Doc.Sections[index].Range.Copy();
            Document doc = new DocumentClass();

            doc.Range().Paste();
            doc.SaveAs(savepath);
        }
Esempio n. 20
0
        public void setChildElement_should_throw_if_there_is_no_children_set()
        {
            // Given
            var docClass = new DocumentClass();

            // Then
            var ex = Assert.Throws <ArgumentException>(() => SUT.SetChildElement(docClass));

            Assert.AreEqual("No child document supplied to set as child", ex.Message);
        }
Esempio n. 21
0
        public void setChildElement_should_throw_if_two_children_are_supplied()
        {
            // Given
            var docClass = new DocumentClass();

            // Then
            var ex = Assert.Throws <ArgumentException>(() => SUT.SetChildElement(docClass, new Document(), new Document()));

            Assert.AreEqual("More than one child element supplied, not accepted", ex.Message);
        }
Esempio n. 22
0
        public void setChildElement_should_throw_if_suplied_element_isnt_a_documentClass()
        {
            // Given
            var docClass = new DocumentClass();

            // Then
            var ex = Assert.Throws <ArgumentException>(() => SUT.SetChildElement(new TextBody(), new Document()));

            Assert.AreEqual("The supplied element wasn't a Document, only Document is allowed", ex.Message);
        }
Esempio n. 23
0
        private void button14_Click(object sender, EventArgs e)
        {
            DocumentClass.LoadFromFiles(folderTextBox.Text, PreprocessingConsts.CategoryFilePattern);
            CtfIdfDictionary dictionary      = new CtfIdfDictionary(folderTextBox.Text, folderTextBox.Text + "\\" + PreprocessingConsts.SummaryFileName, 1000);
            String           summaryFilePath = Application.StartupPath + "\\Preprocessing\\" + PreprocessingConsts.SummaryFileName;
            LearningDocInfo  learningDocInfo = new LearningDocInfo(folderTextBox.Text, summaryFilePath);

            PreprocessingUtility.CreateLearningDocumentList(folderTextBox.Text, dictionary, DocumentRepresentationType.TfIdf, learningDocInfo);
            MessageBox.Show("Done");
        }
Esempio n. 24
0
        public IList <DocumentClass> Select(DocumentClass data)
        {
            IList <DocumentClass> datos = new List <DocumentClass>();

            datos = GetHsql(data).List <DocumentClass>();
            if (!Factory.IsTransactional)
            {
                Factory.Commit();
            }
            return(datos);
        }
Esempio n. 25
0
        /// <summary>
        /// Update Personal Eventlog
        /// </summary>
        /// <param Document of a member="Document"></param>
        /// <param Message to update into the persaonal log="Message"></param>
        public void UpdatePersonalLog(DocumentClass Document, EventLogManipulation.EventTranslationFirst Message)
        {
            string PersonalLog = Document.EventLog;

            if (!string.IsNullOrEmpty(Document.EventLog))
            {
                using (StreamWriter fstream = File.AppendText(PersonalLog))
                {
                    fstream.WriteLine(Message.ToString() + "," + DateTime.Now.ToString("yy/MM/dd hh:mm"));
                }
            }
        }
        public string CorrectHtmlString(string data)
        {
            DocumentClass tidyDoc = new DocumentClass();

            SetOptions(tidyDoc);
            tidyDoc.ParseString(data);
            tidyDoc.CleanAndRepair();
            tidyDoc.SetOptBool(TidyOptionId.TidyForceOutput,1);
            string result = tidyDoc.SaveString();
            tidyDoc = null;
            return result;
        }
Esempio n. 27
0
        public void setChildElement_should_set_document()
        {
            // Given
            var docClass = new DocumentClass();
            var document = new Document();

            // When
            SUT.SetChildElement(docClass, document);

            // Then
            Assert.AreSame(document, docClass.Document);
        }
Esempio n. 28
0
        static void Main()
        {
            int classNum         = 20;
            TestDocumentList tdl = new TestDocumentList(100, 100);
            RadialNetwork    rn  = new RadialNetwork(50, classNum);

            for (int i = 0; i < classNum; i++)
            {
                DocumentClass.AddClass(i.ToString());
            }
            rn.Learn(tdl);
        }
Esempio n. 29
0
    static void Main(string[] args)
    {
        DocumentClass document = new DocumentClass();
        object        defaultTableBehavior = null, autoFitBehavior = null;
        Table         tbl = document.Content.Tables.Add(document.Content, 2, 2, ref defaultTableBehavior,
                                                        ref autoFitBehavior);

        tbl.Rows[2].Cells[2].Range.InsertAfter("This is a test.");
        tbl.Rows[2].Cells[2].Range.ParagraphFormat.SpaceAfter = 0f;
        tbl.Rows[2].Cells.Height = 50f;
        tbl.Range.Rows[2].Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalBottom;
    }
Esempio n. 30
0
        /// <summary>
        /// 将信件按照指定字段进行排序
        /// </summary>
        protected void DataGrid_Sort(Object Src, DataGridSortCommandEventArgs E)
        {
            SortRule = (SortRule == "Desc")?"Asc":"Desc";
            SortBy   = E.SortExpression;
            DocumentClass doc       = new DocumentClass();
            DataTable     datatable = Tools.ConvertDataReaderToDataTable(doc.GetDocListInClass(Int32.Parse(ClassID), Username, Int32.Parse(DisplayType)));
            DataView      Source    = datatable.DefaultView;

            Source.Sort          = SortBy + " " + SortRule;
            doc                  = null;
            dgDocList.DataSource = Source;
            dgDocList.DataBind();
        }
Esempio n. 31
0
        private static void AddStichLabel(GenericBarcode_20150909 barcodeInfo, DocumentClass doc, int index)
        {
            string label = string.Empty;

            if (barcodeInfo.Participations.Count > index)
            {
                label = barcodeInfo.Participations[index];
            }

            IObject cLabel = doc.GetObject(string.Format("Stich{0}", index));

            cLabel.Text = Convert.ToString(label);
        }
Esempio n. 32
0
 public DocumentConcept GetDefaultConcept(DocumentClass docClass)
 {
     try
     {
         DocumentConcept data = new DocumentConcept();
         data.DocClass = docClass;
         data.Name     = "Default";
         return(Factory.DaoDocumentConcept().Select(data).First());
     }
     catch { return(new DocumentConcept {
             DocConceptID = 401
         }); }                                                     //task by default
 }
Esempio n. 33
0
        public IList <IDictionary <string, object> > RepositorySearchForPolId(IDictionary <string, string> properties,
                                                                              IList <DateRange> dateRanges = null,
                                                                              ObjectStore objectStore      = P8ContentEngine.DefaultObjectStore,
                                                                              DocumentClass documentClass  = P8ContentEngine.DefaultDocumentClass,
                                                                              bool adminOverride           = false)
        {
            var whereClause = string.Concat(properties.Aggregate
                                            (
                                                string.Empty, (current, pt) => string.Concat
                                                (
                                                    current, string.Format
                                                    (
                                                        " AND '{1}' IN dc1.[{0}] ",
                                                        pt.Key,
                                                        pt.Value.Replace("'", "''")
                                                    )
                                                )
                                            ), BuildDateRangeSQL(dateRanges));

            var repositorySearch = new RepositorySearch
            {
                SearchScope = new ObjectStoreScope
                {
                    objectStore = objectStore.GetDescription()
                },
                SearchSQL = string.Format(
                    @"SELECT TOP 500 * FROM {0} dc1 WHERE {1}",
                    documentClass.GetDescription(),
                    Regex.Replace(whereClause, @"^\s+AND\s+?", string.Empty, RegexOptions.IgnoreCase))
            };

            var searchResult = Search(repositorySearch, adminOverride);

            var repositoryResults = new List <IDictionary <string, object> >();

            if (searchResult != null && searchResult.Object != null)
            {
                repositoryResults.AddRange
                (
                    searchResult.Object.Select
                    (
                        o => o.Property.ToDictionary <PropertyType, string, object>
                        (
                            p => p.propertyId, Utilities.GetPropertyValue
                        )
                    )
                );
            }

            return(repositoryResults);
        }
Esempio n. 34
0
 public static TableLookupResult ConstructResult(
     bool isResultDBTable, string tableName, string fieldName, string foreignKeyFieldName,
     bool fieldsExactMatch, Dictionary<string, string> fieldsMap, bool isGeneric, DocumentClass documentClass)
 {
     TableLookupResult newResult = new TableLookupResult();
     newResult.isResultDBTable = isResultDBTable;
     newResult.tableName = tableName;
     newResult.fieldName = fieldName;
     newResult.foreignKeyFieldName = foreignKeyFieldName;
     newResult.fieldsExactMatch = fieldsExactMatch;
     if (!fieldsExactMatch)
         newResult.fieldsMap = fieldsMap;
     newResult.isGeneric = isGeneric;
     if (!isGeneric)
         newResult.docClass = documentClass;
     return newResult;
 }
    public void Print(BarcodeHerbstschiessen barcodeInfo)
    {
      DocumentClass doc = new DocumentClass();
      const string path = @".\Templates\Herbstschiessen.lbx";
      string fullPath = Path.GetFullPath(path);
      if (doc.Open(fullPath))
      {
        IObject barcode = doc.GetObject("barcode");
        barcode.Text = Convert.ToString(barcodeInfo.Barcode);

        IObject shooterName = doc.GetObject("shooterName");
        shooterName.Text = Convert.ToString(barcodeInfo.FirstName + " " + barcodeInfo.LastName);

        IObject dateOfBirth = doc.GetObject("dateOfBirth");
        dateOfBirth.Text = Convert.ToString(barcodeInfo.DateOfBirth != null ? ((DateTime)barcodeInfo.DateOfBirth).ToString("dd.MM.yyyy") : string.Empty);

        IObject groupName = doc.GetObject("GroupName");
        groupName.Text = Convert.ToString(barcodeInfo.Gruppenstich);

        IObject sieUndErName = doc.GetObject("SieUndErName");
        sieUndErName.Text = Convert.ToString(barcodeInfo.SieUndEr);

        IObject isGruppenstich = doc.GetObject("pass_103");
        isGruppenstich.Text = Convert.ToString(barcodeInfo.IsGruppenstich ? "x" : string.Empty);

        IObject isNachwuchsstich = doc.GetObject("pass_104");
        isNachwuchsstich.Text = Convert.ToString(barcodeInfo.IsNachwuchsstich ? "x" : string.Empty);

        IObject isWorschtUndBrot = doc.GetObject("pass_101");
        isWorschtUndBrot.Text = Convert.ToString(barcodeInfo.IsWorschtUndBrot ? "x" : string.Empty);

        IObject isSieUndEr = doc.GetObject("pass_102");
        isSieUndEr.Text = Convert.ToString(barcodeInfo.IsSieUndEr ? "x" : string.Empty);

        doc.StartPrint("", PrintOptionConstants.bpoDefault);
        doc.PrintOut(1, PrintOptionConstants.bpoDefault);
        doc.EndPrint();
        doc.Close();
      }
      else
      {
        throw new InvalidOperationException(string.Format("Can not open template file '{0}'", fullPath));
      }
    }
Esempio n. 36
0
        public void Print(IRegisterDetail item)
        {
            string template = string.Concat(AppDomain.CurrentDomain.BaseDirectory, @"drivers\Simple.lbx");

            string barcode = Coder.Calculate(Convert.ToUInt32(item.Id));
            string name = item.DetailType.Id > 0 ? item.DetailType.Name : item.Name;

            bpac.DocumentClass doc = new DocumentClass();
            if (doc.Open(template))
            {
                doc.GetObject("Code").Text = barcode;
                doc.GetObject("InvNum").Text = item.Register.InvNumber;
                doc.GetObject("Name").Text = string.Format("{0}. {1}", item.Npp, name);

                doc.StartPrint("",  PrintOptionConstants.bpoChainPrint | PrintOptionConstants.bpoAutoCut);
                doc.PrintOut(1, PrintOptionConstants.bpoChainPrint | PrintOptionConstants.bpoAutoCut);
                doc.EndPrint();
                doc.Close();
            }
            else
            {
                throw new Exception("Невозможно открыть шаблон");
            }
        }
      public void Print(GenericBarcode_20150909 barcodeInfo)
      {
          DocumentClass doc = new DocumentClass();
          const string path = @".\Templates\Generic_20150909.lbx";
          string fullPath = Path.GetFullPath(path);
          if (doc.Open(fullPath))
          {
              IObject barcode = doc.GetObject("barcode");
              barcode.Text = Convert.ToString(barcodeInfo.Barcode);

              IObject shooterName = doc.GetObject("shooterName");
              shooterName.Text = Convert.ToString(barcodeInfo.FirstName + " " + barcodeInfo.LastName);

              IObject dateOfBirth = doc.GetObject("dateOfBirth");
              dateOfBirth.Text = Convert.ToString(barcodeInfo.DateOfBirth != null ? ((DateTime)barcodeInfo.DateOfBirth).ToString("dd.MM.yyyy") : string.Empty);

              AddCollectionLabel(barcodeInfo, doc, 0);
              AddCollectionLabel(barcodeInfo, doc, 1);

              AddStichLabel(barcodeInfo, doc, 1);
              AddStichLabel(barcodeInfo, doc, 2);
              AddStichLabel(barcodeInfo, doc, 3);
              AddStichLabel(barcodeInfo, doc, 4);
              AddStichLabel(barcodeInfo, doc, 5);

              doc.StartPrint("", PrintOptionConstants.bpoDefault);
              doc.PrintOut(1, PrintOptionConstants.bpoDefault);
              doc.EndPrint();
              doc.Close();
          }
          else
          {
              throw new InvalidOperationException(string.Format("Can not open template file '{0}'", fullPath));
          }
      }
      private static void AddCollectionLabel(GenericBarcode_20150909 barcodeInfo, DocumentClass doc, int index)
      {
          string collectionType = string.Empty;
          string collectionName = string.Empty;

          if (barcodeInfo.ParticipationTypeToCollectionName.Count > index)
          {
              collectionType = barcodeInfo.ParticipationTypeToCollectionName[index].Item1;
              collectionName = barcodeInfo.ParticipationTypeToCollectionName[index].Item2;
          }

          IObject cType = doc.GetObject(string.Format("CollectionType{0}", index));
          cType.Text = Convert.ToString(collectionType);

          IObject cName = doc.GetObject(string.Format("CollectionName{0}", index));
          cName.Text = Convert.ToString(collectionName);
      }
      private static void AddStichLabel(GenericBarcode_20150909 barcodeInfo, DocumentClass doc, int index)
      {
          string label = string.Empty;
          if (barcodeInfo.Participations.Count > index)
          {
              label = barcodeInfo.Participations[index];
          }

          IObject cLabel = doc.GetObject(string.Format("Stich{0}", index));
          cLabel.Text = Convert.ToString(label);
      }
Esempio n. 40
0
        static void Main(string[] args)
        {
            Console.WriteLine(" ");
            Console.WriteLine("  GBPrintServer 1.1.0");
            Console.WriteLine("  (C) RobbytuProjects 2013");
            Console.WriteLine(" ");

            TcpListener listener = new TcpListener(IPAddress.Any, 8000);
            listener.Start();

            Console.WriteLine("  * Listening for incoming connections on port 8000.");

            while (true)
            {
                try
                {
                    Console.WriteLine(" ");

                    Socket soc = listener.AcceptSocket();
                    Console.WriteLine("  * Accepted incoming connection: {0}", soc.RemoteEndPoint);

                    Stream s = new NetworkStream(soc);
                    StreamReader sr = new StreamReader(s);
                    StreamWriter sw = new StreamWriter(s);

                    Console.WriteLine("  * Reading job information...");

                    bool waitForJob = true;
                    while (waitForJob)
                    {
                        String input = sr.ReadLine();
                        if (input.StartsWith("GET "))
                        {
                            Console.WriteLine("  * Processing job information...");

                            String[] jobParts = input.Split("?".ToCharArray())[1].Split(" ".ToCharArray())[0].Split("&".ToCharArray());
                            IDictionary<string, string> processedParts = new Dictionary<string, string>();

                            foreach (String part in jobParts)
                            {
                                String decodedPart = HttpUtility.UrlDecode(part);
                                processedParts[decodedPart.Split("=".ToCharArray())[0]] = decodedPart.Split("=".ToCharArray())[1];
                            }

                            DocumentClass doc = new DocumentClass();
                            if (doc.Open("\\\\win2k12.ad.local\\Programs\\GBPrintServer\\" + processedParts["label"]) != false)
                            {
                                Console.WriteLine("  * Preparing print job...");

                                foreach (KeyValuePair<string, string> part in processedParts)
                                {
                                    if (part.Key != "label")
                                    {
                                        Console.WriteLine("    -> Setting object value: {0}={1}", part.Key, part.Value);
                                        doc.GetObject(part.Key).Text = part.Value;
                                    }
                                }

                                Console.WriteLine("  * Sending job to printer...");

                                doc.StartPrint("", PrintOptionConstants.bpoNoCut);
                                doc.PrintOut(1, PrintOptionConstants.bpoNoCut);
                                doc.EndPrint();

                                Console.WriteLine("  * Writing response code NOERR...");

                                sw.WriteLine("HTTP/1.1 200 OK");
                                sw.WriteLine("Content-Type: text/html");
                                sw.WriteLine("Content-Length: 3");
                                sw.WriteLine("");
                                sw.Write("noe"); // NO ERROR
                                sw.Flush();

                                Console.WriteLine("  * Closing connection...");

                                soc.Close();
                            }
                            else
                            {
                                Console.WriteLine("    -> E: Could not open label file: are you connected to the Network?");
                                Console.WriteLine("    -> Writing response code ERR...");

                                sw.WriteLine("HTTP/1.1 200 OK");
                                sw.WriteLine("Content-Type: text/html");
                                sw.WriteLine("Content-Length: 3");
                                sw.WriteLine("");
                                sw.Write("err");
                                sw.Flush();

                                Console.WriteLine("  * Closing connection...");

                                soc.Close();
                            }

                            waitForJob = false;
                        }

                        Console.WriteLine(" ");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("    -> Unexpected exception during Connloop.");
                    Console.WriteLine("    -> E: " + e.Message);
                }
            }
        }
Esempio n. 41
0
 public DocumentClass SaveDocumentClass(DocumentClass data)
 {
     try {
     SetService();  return SerClient.SaveDocumentClass(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Esempio n. 42
0
 public void DeleteDocumentClass(DocumentClass data)
 {
     try {
     SetService();  SerClient.DeleteDocumentClass(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }