Beispiel #1
0
        public List <LineH> getLineHByTypeFor(DocType type, List <Document> documents, CurrentExchange exchange)
        {
            try
            {
                List <LineH> HLines = null;
                switch (type)
                {
                case DocType.Boleta:
                    HLines = _iBillingRepository.getBoletasLineHFor(documents, exchange);
                    break;

                case DocType.Factura:
                    HLines = _iBillingRepository.getFacturasLineHFor(documents, exchange);
                    break;

                case DocType.NotaDeCreditoBoleta:
                case DocType.NotaDeCreditoFactura:
                    HLines = _iBillingRepository.getNotasDeCreditoLineHFor(documents, exchange);
                    break;
                }
                _iLogService.Debug("Line H " + type.ToString());
                _iLogService.Debug("Count: " + HLines.Count);
                return(HLines);
            }
            catch (Exception ex)
            {
                _iLogService.Error(ex.Message);
            }
            return(null);
        }
Beispiel #2
0
        public LastDoc getLastDocByType(DocType type)
        {
            try
            {
                LastDoc lastDoc = null;
                switch (type)
                {
                case DocType.Boleta:
                    lastDoc = _iBdConsulta1Repository.getLastBoleta();
                    break;

                case DocType.Factura:
                    lastDoc = _iBdConsulta1Repository.getLastFactura();
                    break;

                case DocType.NotaDeCreditoBoleta:
                    lastDoc = _iBdConsulta1Repository.getLastNotaDeCreditoBoleta();
                    break;

                case DocType.NotaDeCreditoFactura:
                    lastDoc = _iBdConsulta1Repository.getLastNotaDeCreditoFactura();
                    break;
                }
                _iLogService.Debug("Last " + type.ToString());
                _iLogService.Debug(lastDoc);
                return(lastDoc);
            }
            catch (Exception ex)
            {
                _iLogService.Error(ex.Message);
            }
            return(null);
        }
Beispiel #3
0
        public List <Document> getNextDocumentsByTypeFrom(DocType type, LastDoc lastDoc)
        {
            try
            {
                List <Document> documents = null;
                switch (type)
                {
                case DocType.Boleta:
                    documents = _iBillingRepository.getNextBoletasFrom(lastDoc);
                    break;

                case DocType.Factura:
                    documents = _iBillingRepository.getNextFacturasFrom(lastDoc);
                    break;

                case DocType.NotaDeCreditoBoleta:
                    documents = _iBillingRepository.getNextNotasDeCreditoBoletaFrom(lastDoc);
                    break;

                case DocType.NotaDeCreditoFactura:
                    documents = _iBillingRepository.getNextNotasDeCreditoFacturaFrom(lastDoc);
                    break;
                }
                _iLogService.Debug("Next " + type.ToString());
                _iLogService.Debug("Count: " + documents.Count);
                _iLogService.Debug <Document>(documents);
                return(documents);
            }
            catch (Exception ex)
            {
                _iLogService.Error(ex.Message);
            }
            return(null);
        }
Beispiel #4
0
        private string DocTypeString(DocType docType)
        {
            switch (docType)
            {
            case DocType.Html:
                return("html");

            case DocType.Json:
                return("json");

            case DocType.Sql:
                return("sql");

            case DocType.Text:
                return("text");

            case DocType.Xml:
                return("xml");

            case DocType.Unknown:
                return("unknown");
            }

            throw new ArgumentException("Unknown DocType: " + docType.ToString());
        }
Beispiel #5
0
        public List <LineP> getLinePByTypeFor(DocType type, List <Document> documents)
        {
            try
            {
                List <LineP> PLines = null;
                switch (type)
                {
                case DocType.Boleta:
                    PLines = _iBdMostRepository.getBoletasLinePFor(documents);
                    break;

                case DocType.Factura:
                    PLines = _iBdMostRepository.getFacturasLinePFor(documents);
                    break;

                case DocType.NotaDeCreditoBoleta:
                case DocType.NotaDeCreditoFactura:
                    PLines = _iBdMostRepository.getNotasDeCreditoLinePFor(documents);
                    break;
                }
                _iLogService.Debug("Line P " + type.ToString());
                _iLogService.Debug("Count: " + PLines.Count);
                return(PLines);
            }
            catch (Exception ex)
            {
                _iLogService.Error(ex.Message);
            }
            return(null);
        }
        /// <summary>
        /// 轉回 DAL 用 Content
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public void SetContentData(Dictionary <string, StudBatchUpdateRecContentEntity> data)
        {
            XmlElement retValue = new XmlDocument().CreateElement("Content");
            Dictionary <string, List <StudBatchUpdateRecContentEntity> > ByGradeYear = new Dictionary <string, List <StudBatchUpdateRecContentEntity> >();

            foreach (StudBatchUpdateRecContentEntity sburce in data.Values)
            {
                string strGRYear;
                if (string.IsNullOrEmpty(sburce.GetGradeYear()))
                {
                    strGRYear = " ";
                }
                else
                {
                    strGRYear = sburce.GetGradeYear();
                }

                if (ByGradeYear.ContainsKey(strGRYear))
                {
                    ByGradeYear[strGRYear].Add(sburce);
                }
                else
                {
                    List <StudBatchUpdateRecContentEntity> list = new List <StudBatchUpdateRecContentEntity>();
                    list.Add(sburce);
                    ByGradeYear.Add(strGRYear, list);
                }

                // 清除原 XML
                UpdateBatchRec.Content.RemoveAll();

                XmlElement elemRoot = new XmlDocument().CreateElement("異動名冊");
                elemRoot.SetAttribute("學年度", SchoolYear + "");
                elemRoot.SetAttribute("學期", Semester + "");
                elemRoot.SetAttribute("學校名稱", SchoolName);
                elemRoot.SetAttribute("學校代號", SchoolCode);
                elemRoot.SetAttribute("類別", DocType.ToString());

                foreach (KeyValuePair <string, List <StudBatchUpdateRecContentEntity> > val in ByGradeYear)
                {
                    XmlElement elemGrdYear = new XmlDataDocument().CreateElement("清單");
                    elemGrdYear.SetAttribute("年級", val.Key);
                    elemGrdYear.SetAttribute("科別", "");

                    foreach (StudBatchUpdateRecContentEntity sburce1 in val.Value)
                    {
                        XmlElement xe = elemGrdYear.OwnerDocument.ImportNode(sburce1.GetXmlData(), true) as XmlElement;
                        elemGrdYear.AppendChild(xe);
                    }

                    XmlElement XmlRootChild = elemRoot.OwnerDocument.ImportNode(elemGrdYear, true) as XmlElement;
                    elemRoot.AppendChild(XmlRootChild);
                }

                XmlElement elemRot = UpdateBatchRec.Content.OwnerDocument.ImportNode(elemRoot, true) as XmlElement;
                UpdateBatchRec.Content.AppendChild(elemRot);
            }
        }
Beispiel #7
0
        void TryShowPopupWindowDoc()
        {
            if (Event.current.type == EventType.Repaint && NeedShowPopupWindowDocType != null)
            {
                DocType selected = NeedShowPopupWindowDocType.Value;

                string tip = string.Format("请输入 {0} 的名字:", selected.ToString());

                NeedShowPopupWindowDocType = null;

                PopupWindow.Show(buttonRect, new TextFieldPopupDialog(tip, (string value) => {
                    if (string.IsNullOrEmpty(value) == false)
                    {
                        JsonFileCreater cjf = null;
                        switch (selected)
                        {
                        case DocType.Element:
                            cjf = new ElementJsonFileCreater(this, value);
                            break;

                        case DocType.SimpleClass:
                            cjf = new SimpleClassJsonFileCreater(this, value);
                            break;

                        case DocType.Enum:
                            cjf = new EnumJsonFileCreater(this, value);
                            break;

                        case DocType.FSM:
                            cjf = new FSMJsonFileCreater(this, value);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                        if (cjf != null)
                        {
                            cjf.Create();
                            WSJsonFilesList = null;
                        }
                    }
                    else
                    {
                        PRDebug.TagLog(lt, lcr, "请输入名字!");
                    }
                }));

                if (Event.current.type == EventType.Repaint)
                {
                    buttonRect = GUILayoutUtility.GetLastRect();
                }
            }
        }
Beispiel #8
0
        //Main search algorithm
        public IEnumerable <Result> Search(string fieldName, string searchTerm)
        {
            DocType docType = DocType.SONG;
            Query   mainQuery;

            switch (fieldName)
            {
            case F_ARTIST:
                docType = DocType.ARTIST;
                break;

            case F_ALBUM:
                docType = DocType.ALBUM;
                break;

            case F_GENRE:
                docType = DocType.GENRE;
                break;
            }
            IndexSearcher searcher     = new IndexSearcher(luceneIndexDirectory);
            BooleanQuery  booleanQuery = new BooleanQuery();
            QueryParser   qp           = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, fieldName, analyzer);

            try
            {
                mainQuery = qp.Parse(searchTerm);
            }
            catch (ParseException e)
            {
                console.Log(e.Message);
                return(null);
            }
            Query DocTypeQuery = new TermQuery(new Term(F_DOCTYPE, docType.ToString()));

            booleanQuery.Add(mainQuery, Occur.MUST);
            booleanQuery.Add(DocTypeQuery, Occur.MUST);
            console.Log("query: " + booleanQuery.ToString());
            TopDocs       hitsFound    = searcher.Search(booleanQuery, Int32.MaxValue);
            List <Result> results      = new List <Result>();
            Result        sampleResult = null;

            for (int i = 0; i < hitsFound.TotalHits; i++)
            {
                sampleResult = new Result();
                Document doc = searcher.Doc(hitsFound.ScoreDocs[i].Doc);
                //key moment
                fillResult(sampleResult, fieldName, doc);
                float score = hitsFound.ScoreDocs[i].Score;
                sampleResult.Score = score;
                results.Add(sampleResult);
            }
            return(results.OrderByDescending(x => x.Score).ToList());
        }
        public bool GeneratePK()
        {
            if (!ID.Equals(Guid.Empty) && DocType > -1)
            {
                PK = PartitionKeyGenerator.Create(DocType.ToString(), ID.ToString());

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #10
0
        public async Task <IReadOnlyCollection <SearchItem> > SearchAsync(string query, DocType type, int limit = 30, bool conjunction = true)
        {
            var uriQuery = new Dictionary <string, object>
            {
                ["query"]       = query,
                ["limit"]       = limit,
                ["type"]        = type.ToString().ToCamelCase(),
                ["conjunction"] = conjunction.ToString().ToLower()
            };

            var response = await _httpClient.GetFromJsonAsync <SearchResult>("search" + uriQuery.AsQueryString());

            return(response.Data);
        }
Beispiel #11
0
        /// <summary>
        /// Recupera le mail dei destinatari
        /// </summary>
        /// <param name="TipoDoc">Destinatari legati a quel tipo di documento</param>
        /// <param name="bl_id">Recupera i destinatari legati a quell'edificio</param>
        /// <returns></returns>
        private ArrayList GetDestinatari(int bl_id, int servizio_id, DocType TipoDoc)
        {
            S_ControlsCollection _SColl = new S_ControlsCollection();

            S_Controls.Collections.S_Object p = new S_Object();
            p.ParameterName = "p_bl_id";
            p.DbType        = CustomDBType.Integer;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = bl_id;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_servizio_id";
            p.DbType        = CustomDBType.Integer;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = servizio_id;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_tipo_doc";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = TipoDoc.ToString();
            p.Size          = 250;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "IO_CURSOR";
            p.DbType        = CustomDBType.Cursor;
            p.Direction     = ParameterDirection.Output;
            p.Index         = _SColl.Count;
            _SColl.Add(p);

            string s_StrSql = "PACK_DETINATARIINVIO.SP_GETDESTINATARI";

            DataSet _Ds = _OraDl.GetRows(_SColl, s_StrSql);

            ArrayList li = new ArrayList();

            foreach (DataRow riga in  _Ds.Tables[0].Rows)
            {
                li.Add(riga["mail"].ToString());
            }

            return(li);
        }
        private void ChooseParentPlan_Load(object sender, EventArgs e)
        {
            dtpStart.Value = DateTime.Now.Subtract(new TimeSpan(10, 0, 0, 0));
            dtpEnd.Value   = DateTime.Now.AddDays(3);

            SqlConnection connection = new SqlConnection(Data.ConnectionString);
            string        sql        = @"SELECT     TOP 50 dh.DocumentID as DocumentID, dh.DocumentDate as DocumentDate,
                       f.FactoryName as FactoryName, dt.DocTypeName as DocTypeName FROM " +
                                       Data.ActiveSchema + @".DocumentHead dh INNER JOIN dbo.DocumentType dt ON dh.DocTypeID = dt.DocTypeID INNER JOIN " +
                                       Data.ActiveSchema + @".Factory f ON dh.FactoryID = f.FactoryID WHERE dh.FactoryID = " + Factory.ToString()
                                       + " AND dh.DocTypeID = " + DocType.ToString();
            SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
            DataTable      data    = new DataTable();

            adapter.Fill(data);
            gridData.DataSource = data;
            gridData.Columns["DocumentID"].HeaderText   = "№ Документа";
            gridData.Columns["DocumentDate"].HeaderText = "Дата документа";
            gridData.Columns["FactoryName"].HeaderText  = "Фабрика";
            gridData.Columns["DocTypeName"].HeaderText  = "Тип документа";
        }
Beispiel #13
0
        /// <summary>
        /// Convert this object into a string representation; provides summary information about the
        /// document.
        /// </summary>
        ///
        /// <returns>
        /// This object as a string.
        /// </returns>

        public override string ToString()
        {
            return("DOM Root (" + DocType.ToString() + ", " + DescendantCount().ToString() + " elements)");
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(Data.ConnectionString);
            string        sql        = @"SELECT     dh.DocumentID as DocumentID, dh.DocumentDate as DocumentDate, f.FactoryName as FactoryName, dt.DocTypeName as DocTypeName
                      FROM " + Data.ActiveSchema + @".DocumentHead dh INNER JOIN DocumentType dt ON dh.DocTypeID = dt.DocTypeID INNER JOIN " +
                                       Data.ActiveSchema + ".Factory f ON dh.FactoryID = f.FactoryID WHERE DocumentDate >= '" +
                                       dtpStart.Value.ToString("yyyyMMdd") + "' AND DocumentDate <= '" + dtpEnd.Value.ToString("yyyyMMdd") + "' " +
                                       " AND dh.FactoryID = " + Factory.ToString() + " AND dh.DocTypeID = " + DocType.ToString();

            SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
            DataTable      data    = new DataTable();

            adapter.Fill(data);
            gridData.DataSource = data;
            gridData.Columns["DocumentID"].HeaderText   = "№ Документа";
            gridData.Columns["DocumentDate"].HeaderText = "Дата документа";
            gridData.Columns["FactoryName"].HeaderText  = "Фабрика";
            gridData.Columns["DocTypeName"].HeaderText  = "Тип документа";
        }
 public string WrapWithAbbreviation(string abbreviation, string text, DocType docType)
 {
     return wrapWithAbbr(abbreviation, text, docType.ToString().ToLowerInvariant());
 }
 public string ExpandAbbreviation(string abbreviation, DocType docType)
 {
     return expandAbbr(abbreviation, docType.ToString().ToLowerInvariant());
 }
Beispiel #17
0
        private void SaveInvio(string FileName, DocType TipoDoc)
        {
            S_ControlsCollection _SColl = new S_ControlsCollection();


            S_Object p = new S_Object();

            p.ParameterName = "p_id";
            p.DbType        = CustomDBType.Integer;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = 0;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_NOME_DOC";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 255;
            p.Value         = Path.GetFileName(FileName);
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_DATA_INVIO";
            p.DbType        = CustomDBType.Date;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 15;
            p.Value         = DateTime.Now;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_USERS";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 255;
            p.Value         = Context.User.Identity.Name;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_TIPO_DOC";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 32;
            p.Value         = TipoDoc.ToString();
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_CODICE";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 255;
            p.Value         = this.HSga.ToString();
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_ID_WR";
            p.DbType        = CustomDBType.Integer;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = this.txtWrHidden.Text;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_ID_BL";
            p.DbType        = CustomDBType.Integer;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Value         = this.id_bl;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_CODICE_BL";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 255;
            p.Value         = lblCodiceEdificio.Text;
            _SColl.Add(p);

            p = new S_Object();
            p.ParameterName = "p_Operazione";
            p.DbType        = CustomDBType.VarChar;
            p.Direction     = ParameterDirection.Input;
            p.Index         = _SColl.Count;
            p.Size          = 255;
            p.Value         = "Insert";
            _SColl.Add(p);

            int result = _ClManCorrettiva.ExecuteTracciaDoc(_SColl);
        }
        /*
         * Start the convertion job on a server
         * and return FileId of the processing file
         * In case of any error exception will be throw
         */
        public async Task <string> StartConversionJob(DocType doctype, Stream file, ConversionOptions options)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(Url);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            ConversionSettings settings = new ConversionSettings(Domain, Username, Password);

            settings.Options = options;

            // get file content
            using (MemoryStream ms = new MemoryStream())
            {
                file.CopyTo(ms);
                byte[] bytes = ms.ToArray();
                settings.Content = System.Convert.ToBase64String(bytes);
            }

            HttpResponseMessage response = await client.PostAsJsonAsync("api/convert/job/" + doctype.ToString(), settings);

            OASResponse resp = null;

            if (response.IsSuccessStatusCode)
            {
                resp = await response.Content.ReadAsAsync <OASResponse>();

                if (resp.ErrorCode == OASErrorCodes.Success)
                {
                    return(resp.FileId);
                }
                else
                {
                    OASConversionException ex = new OASConversionException(resp.Message);
                    ex.Source = resp.ErrorCode.ToString();
                    throw ex;
                }
            }
            else
            {
                OASWebServiceException ex = new OASWebServiceException(response.ReasonPhrase);
                ex.Source = response.StatusCode.ToString();
                throw ex;
            }
        }
 public string ExpandAbbreviation(string abbreviation, DocType docType)
 {
     return(myExpandAbbr(abbreviation, docType.ToString().ToLowerInvariant()));
 }
Beispiel #20
0
 /// <summary>
 /// DocumentType constructor
 /// </summary>
 /// <param name="type"></param>
 /// <param name="title"></param>
 public DocumentType(DocType type, string title)
 {
     this.type  = type;
     this.name  = type.ToString();
     this.title = title;
 }
Beispiel #21
0
 /// <summary>
 /// The documentation for the ACH transaction.  May be 'PPD', 'CCD', 'TEL', 'WEB', or 'ARC'.  Defaults to 'WEB' if not set.
 /// </summary>
 public IBluePay20PostRequestBuilderFields DocType(DocType value)
 {
     this["DOC_TYPE"] = value.ToString();
     return(this);
 }
Beispiel #22
0
        public void ShouldReturnTheTypeWhenCallingToStringOnADocType()
        {
            var docType = new DocType("hello");

            Assert.AreEqual("hello", docType.ToString());
        }
 public string WrapWithAbbreviation(string abbreviation, string text, DocType docType)
 {
     return(myWrapWithAbbr(abbreviation, text, docType.ToString().ToLowerInvariant()));
 }