コード例 #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[] generateLetter(string _empNums, string _lType, int _version)
        {
            string _temReaderstr = LettersGenDAL.getTemplate(_lType, _version);

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

            try
            {
                if (!_empNums.Equals(""))
                {
                    _elList0 = createEmpList(_empNums);
                    foreach (string _empl in _elList0)
                    {
                        PilotData pData  = new PilotData();
                        bool      _found = pData.checkExistRecord(Convert.ToInt32(_empl));
                        if (!_found)
                        {
                            _exceptionEmpl += _empl + ", ";
                        }
                        pData = null;
                    }
                    if (!_exceptionEmpl.Equals(""))
                    {
                        _exceptionEmpl = _exceptionEmpl.Remove(_exceptionEmpl.Length - 1);
                        throw (new Exception("Employee number(s) " + _exceptionEmpl + " not valid! "));
                    }
                }
                dt = LettersGenDAL.getEmpwithallDepData(_empNums);
                getFinalData(_temReader);
                string[] _letters = new string[dtFinal.Rows.Count];

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

                //get Identity for generated letter
                DataSet dsGen = new DataSet();
                dsGen.Clear();
                dsGen.Tables.Add(dt);
                _genertedId = LettersGenDAL.StoreGeneratedLetter(_lType, _version, dsGen.GetXml());

                //store list of employees with letter ids for history purpose
                LettersGenDAL.StoreLetterHistory(_genertedId, _elList0);

                return(_letters);
            }
            catch (Exception ex)
            {
                if (_genertedId != 0)
                {
                    LettersGenDAL.rollbackStoreLetter(_genertedId);
                }
                throw ex;
            }
        }
コード例 #3
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;
            }
        }
コード例 #4
0
        public string[] generateBenValidationLetter(int _empNum, string _dssn, string _lType, int _version, int _penid)
        {
            string _temReaderstr = LettersGenDAL.getTemplate(_lType, _version);

            _temReaderstr = replaceNamespace(_temReaderstr);
            StringReader    _temReader  = new StringReader(_temReaderstr);
            XmlDataDocument xmlDataDoc  = new XmlDataDocument();
            int             _genertedId = 0;

            try
            {
                if (!_empNum.Equals(""))
                {
                    PilotData pData  = new PilotData();
                    bool      _found = pData.checkExistRecord(_empNum);
                    if (!_found)
                    {
                        throw (new Exception("Employee number(s) " + _empNum + " not valid! "));
                    }
                    pData = null;
                }

                dt = LettersGenDAL.getEmpDepData(_empNum, _dssn);
                getFinalData(_temReader);
                string[] _letters = new string[dtFinal.Rows.Count];

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

                //get Identity for generated letter
                DataSet dsGen = new DataSet();
                dsGen.Clear();
                dsGen.Tables.Add(dt);
                _genertedId = LettersGenDAL.StoreGeneratedLetter(_lType, _version, dsGen.GetXml());

                //store list of employees with letter ids for history purpose
                LettersGenDAL.StoreLetterHistory(_genertedId, _empNum);

                //Update pending status
                LettersGenDAL.updatePending(_genertedId, _penid);

                return(_letters);
            }
            catch (Exception ex)
            {
                if (_genertedId != 0)
                {
                    LettersGenDAL.rollbackStoreLetter(_genertedId);
                }
                throw ex;
            }
        }
コード例 #5
0
        public string[] generateLetter(string _lType, int _version, bool _preview)
        {
            string _temReaderstr = LettersGenDAL.getTemplate(_lType, _version);

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

            try
            {
                dt = LettersGenDAL.getEmpwithallDepData();
                getFinalData(_temReader);
                string[] _letters = new string[dtFinal.Rows.Count];

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

                //get Identity for generated letter
                DataSet dsGen = new DataSet();
                dsGen.Clear();
                dsGen.Tables.Add(dt);
                if (!_preview)
                {
                    _genertedId = LettersGenDAL.StoreGeneratedLetter(_lType, _version, dsGen.GetXml());
                    _elList0    = LettersGenDAL.getEmpNumbers();
                    //store list of employees with letter ids for history purpose
                    LettersGenDAL.StoreLetterHistory(_genertedId, _elList0);
                }

                return(_letters);
            }
            catch (Exception ex)
            {
                if (_genertedId != 0)
                {
                    LettersGenDAL.rollbackStoreLetter(_genertedId);
                }
                throw ex;
            }
        }