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; } }
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; } }
private void verifyRecords(int _empno) { PilotData pobj = new PilotData(); bool _inserted = false; for (int i = 1; i <= pobj.getBeneficiaryOrders(_empno); i++) { if (_inserted) { break; } foreach (DataRow dr in ds.Tables[0].Rows) { if (Convert.ToInt32(dr["D_Order"]) == i) { if (dr["D_Rel"].ToString().Trim().Equals("CH")) { if ((!Convert.ToBoolean(dr["D_Elegb"])) && (dr["D_OStopdt"].ToString().Trim().Equals("")) && (Convert.ToInt32(dr["D_Age"]) < 24)) { HRAdata.insertValidationRecord(_empno, dr["D_SSN"].ToString().Trim(), dr["D_Rel"].ToString().Trim()); _inserted = true; break; } } else { if ((!Convert.ToBoolean(dr["D_Elegb"])) && (dr["D_OStopdt"].ToString().Trim().Equals(""))) { HRAdata.insertValidationRecord(_empno, dr["D_SSN"].ToString().Trim(), dr["D_Rel"].ToString().Trim()); _inserted = true; break; } } } } } }