コード例 #1
0
        public string[] reprintLetters(int _templateId)
        {
            string _temReaderstr = LettersGenDAL.getTemplateGenerated(_templateId);

            _temReaderstr = replaceNamespace(_temReaderstr);
            StringReader    _temReader = new StringReader(_temReaderstr);
            XmlDataDocument xmlDataDoc = new XmlDataDocument();
            DataSet         dsreprint  = new DataSet();

            dsreprint.Clear();
            dsreprint = LettersGenDAL.getGenDataset(_templateId);
            string _tblName = "";

            foreach (DataTable tble in dsreprint.Tables)
            {
                _tblName = tble.TableName;
            }
            dt = dsreprint.Tables[_tblName];
            getFinalData(_temReader);
            string[] _letters = new string[dtFinal.Rows.Count];

            //get letters with all bookmarks replaced with correct values
            _letters = buildLetter(_temReaderstr);

            return(_letters);
        }
コード例 #2
0
        public string[] reprintLetters(int _templateId, string _empnums)
        {
            string _temReaderstr = LettersGenDAL.getTemplateGenerated(_templateId);

            _temReaderstr = replaceNamespace(_temReaderstr);
            StringReader    _temReader     = new StringReader(_temReaderstr);
            XmlDataDocument xmlDataDoc     = new XmlDataDocument();
            List <string>   _elList0       = new List <string>();
            string          _exceptionEmpl = "";

            try
            {
                if (!_empnums.Equals(""))
                {
                    _elList0 = createEmpList(_empnums);
                }

                DataSet dsreprint = new DataSet();
                dsreprint.Clear();
                dsreprint = LettersGenDAL.getGenDataset(_templateId);
                string _tblName = "";
                foreach (DataTable tble in dsreprint.Tables)
                {
                    _tblName = tble.TableName;
                }
                dt.Clear();

                dt = dsreprint.Tables[_tblName].Clone();

                foreach (string _emp in _elList0)
                {
                    foreach (DataRow dr in dsreprint.Tables[_tblName].Rows)
                    {
                        if (dr["EmployeeNo"].ToString().Equals(_emp))
                        {
                            DataRow r = dt.NewRow();
                            r.ItemArray = dr.ItemArray;
                            dt.Rows.Add(r);
                            break;
                        }
                    }
                }

                getFinalData(_temReader);
                string[] _letters = new string[dtFinal.Rows.Count];

                //get letters with all bookmarks replaced with correct values
                _letters = buildLetter(_temReaderstr);

                return(_letters);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }