using System; using System.Data; using System.Linq; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Payroll.BO; using Ease.CoreV35.Caching; using System.IO; namespace Payroll.Service { #region SAPDataProcess Service [Serializable] public class SAPDataProcessService : ServiceTemplate, ISAPDataProcessService { #region Private functions and declaration Cache _cache = new Cache(typeof(SAPDataProcess)); public SAPDataProcessService() { } private void SendMail(ref string sError, SAPInterface oSapInterface, SAPDataProcess oSAPDataProcess) { try { //Blocked temporarily oSapInterface.SendMail(oSAPDataProcess); } catch (Exception ex) { sError += "Could not send message. Due To:" + ex.Message + ".Otherwise Everything saved Successfully.\n"; //throw new Exception("Could not send message. Due To:"+ex.Message); //Do Something to indicate mail not send } } #endregion #region Object Mapping private void MapObject(SAPDataProcess oSAPDataProcess, DataReader oReader) { base.SetObjectID(oSAPDataProcess, oReader.GetID("SAPDataProcessID")); oSAPDataProcess.ProcessDate = oReader.GetDateTime("ProcessDate").Value; oSAPDataProcess.ProcessStatus = (EnumSAPProcessStatus)oReader.GetInt32("ProcessStatus").Value; oSAPDataProcess.ProcessTime = oReader.GetString("ProcessTime"); oSAPDataProcess.ProcessBy = oReader.GetID("ProcessBy"); oSAPDataProcess.MailCompleted = (EnumSendMail)oReader.GetInt32("MailCompleted").Value; oSAPDataProcess.SourceFileName = oReader.GetString("SourceFileName"); this.SetObjectState(oSAPDataProcess, Ease.CoreV35.ObjectState.Saved); } protected override T CreateObject(DataReader oReader) { SAPDataProcess oSAPDataProcess = new SAPDataProcess(); MapObject(oSAPDataProcess, oReader); return oSAPDataProcess as T; } protected SAPDataProcess CreateObject(DataReader oReader) { SAPDataProcess oSAPDataProcess = new SAPDataProcess(); MapObject(oSAPDataProcess, oReader); return oSAPDataProcess; } private void MapSAPDetailObject(SAPDataProcessDetail oSAPDataProcessDetail, DataReader oReader) { base.SetObjectID(oSAPDataProcessDetail, oReader.GetID("SAPDataProcessDetailID")); oSAPDataProcessDetail.EmployeeNo = oReader.GetString("EmployeeNo"); oSAPDataProcessDetail.Name = oReader.GetString("Name"); oSAPDataProcessDetail.DataType = oReader.GetString("DataType"); oSAPDataProcessDetail.Description = oReader.GetString("Description"); oSAPDataProcessDetail.SAPDataProcessID = oReader.GetID("SAPDataProcessID"); this.SetObjectState(oSAPDataProcessDetail, Ease.CoreV35.ObjectState.Saved); } protected ObjectsTemplate CreateSAPDetailObject(DataReader oReader) { ObjectsTemplate oSAPDetails = new ObjectsTemplate(); while (oReader.Read()) { SAPDataProcessDetail oSAPDetail = new SAPDataProcessDetail(); MapSAPDetailObject(oSAPDetail, oReader); oSAPDetails.Add(oSAPDetail); } return oSAPDetails; } #endregion #region Service implementation public SAPDataProcess Get(ID id) { SAPDataProcess oSAPDataProcess = new SAPDataProcess(); #region Cache Header oSAPDataProcess = _cache["Get", id] as SAPDataProcess; if (oSAPDataProcess != null) return oSAPDataProcess; #endregion TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(SAPDataProcessDA.Get(tc, id)); if (oreader.Read()) { oSAPDataProcess = this.CreateObject(oreader); } oreader.Close(); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } #region Cache Footer _cache.Add(oSAPDataProcess, "Get", id); #endregion return oSAPDataProcess; } public SAPDataProcess Get(DateTime dSAPDate) { SAPDataProcess oSAPDataProcess = new SAPDataProcess(); #region Cache Header oSAPDataProcess = _cache["Get", dSAPDate] as SAPDataProcess; if (oSAPDataProcess != null) return oSAPDataProcess; #endregion TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(SAPDataProcessDA.Get(tc, dSAPDate)); if (oreader.Read()) { oSAPDataProcess = this.CreateObject(oreader); } if (oSAPDataProcess != null) { oreader = new DataReader(SAPDataProcessDA.GetSAPDetails(tc, oSAPDataProcess.ID)); oSAPDataProcess.Details = this.CreateSAPDetailObject(oreader); } oreader.Close(); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } #region Cache Footer _cache.Add(oSAPDataProcess, "Get", dSAPDate); #endregion return oSAPDataProcess; } public SAPDataProcessDetail GetSAPDetails(ID id) { SAPDataProcessDetail oSAPDataProcessDetail = new SAPDataProcessDetail(); #region Cache Header oSAPDataProcessDetail = _cache["Get", id] as SAPDataProcessDetail; if (oSAPDataProcessDetail != null) return oSAPDataProcessDetail; #endregion TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(SAPDataProcessDA.Get(tc, id)); if (oreader.Read()) { oSAPDataProcessDetail = this.CreateObject(oreader); } oreader.Close(); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } #region Cache Footer _cache.Add(oSAPDataProcessDetail, "Get", id); #endregion return oSAPDataProcessDetail; } public ObjectsTemplate Get() { #region Cache Header ObjectsTemplate SAPDataProcesss = _cache["Get"] as ObjectsTemplate; if (SAPDataProcesss != null) return SAPDataProcesss; #endregion TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(SAPDataProcessDA.Get(tc)); SAPDataProcesss = this.CreateObjects(dr); dr.Close(); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } #region Cache Footer _cache.Add(SAPDataProcesss, "Get"); #endregion return SAPDataProcesss; } public void SAPStatusSave(TransactionContext tc, SAPDataProcess oSapProcess) { SAPDataProcess oSAPDProcess = new SAPDataProcess(); if (oSapProcess.ErrorList.Count > 0) { oSAPDProcess.ProcessStatus = EnumSAPProcessStatus.Error; oSAPDProcess.Details = oSapProcess.ErrorList; } else { oSAPDProcess.ProcessStatus = EnumSAPProcessStatus.Success; oSAPDProcess.Details = oSapProcess.SuccessList; } oSAPDProcess.ProcessDate = DateTime.Now; oSAPDProcess.ProcessTime = oSAPDProcess.ProcessDate.ToString("hh:mm tt"); oSAPDProcess.ProcessBy = Payroll.BO.SystemInformation.CurrentSysInfo.ModifiedBy; //foreach (SAPDataProcessDetail oPDetail in oSAPDProcess.Details) //{ // //SendMailNotification = SendMail(oPDetail); //} ////_SAPDProcess.MailCompleted = SendMailNotification; this.Save(tc, oSAPDProcess); } public void SAPStatusSave(SAPDataProcess oSapProcess) { // TransactionContext tc = null; SAPDataProcess oSAPDProcess = new SAPDataProcess(); if (oSapProcess.ErrorList.Count > 0) { oSAPDProcess.ProcessStatus = EnumSAPProcessStatus.Error; oSAPDProcess.Details = oSapProcess.ErrorList; } else { oSAPDProcess.ProcessStatus = EnumSAPProcessStatus.Success; oSAPDProcess.Details = oSapProcess.SuccessList; } oSAPDProcess.ProcessDate = DateTime.Now; oSAPDProcess.ProcessTime = oSAPDProcess.ProcessDate.ToString("hh:mm tt"); oSAPDProcess.ProcessBy = Payroll.BO.SystemInformation.CurrentSysInfo.ModifiedBy; oSAPDProcess.SourceFileName = oSapProcess.SourceFileName; //foreach (SAPDataProcessDetail oPDetail in oSAPDProcess.Details) //{ // //SendMailNotification = SendMail(oPDetail); //} ////_SAPDProcess.MailCompleted = SendMailNotification; this.Save(oSAPDProcess); } //public void Process_Old(bool IsSystemInfoNeeded) //{ // try // { // if (IsSystemInfoNeeded) // { // ConfigurationManager manager = new ConfigurationManager(); // manager.LoadConfiguration(); // PayrollType ptype = PayrollType.Get(ID.FromInteger(1)); // User oUser = User.Get(ID.FromInteger(9)); // oUser.LogInMode = EnumUserLogInMode.Normal; // oUser.LogInPayrollTypeID = ptype.ID; // User.SetCurrentUser(oUser); // SystemInformation.CurrentSysInfo = SystemInformation.Get(); // } // ObjectsTemplate oEmps = Employee.GetAllEmps(); // #region Read SAP XML File // SAPDataProcess oSAPDataProcess = null;//new SAPDataProcess(); // SAPInterface oSAPInterface = new SAPInterface(); // oSAPDataProcess = oSAPInterface.Process_Old(); // #endregion // #region Prepare Life-Cycle Data // IntigrationSetup osetup = IntigrationSetup.Get(); // DateTime salaryCutoffDate = new DateTime(SystemInformation.CurrentSysInfo.NextPayProcessDate.Year, SystemInformation.CurrentSysInfo.NextPayProcessDate.Month, osetup.CutOffDay); // EmpLifeCycleService osvr = new EmpLifeCycleService(); // ObjectsTemplate empLfs = new ObjectsTemplate(); // ObjectsTemplate uptotodaysData = osvr.GetNotYetProcessUptoToday(); // foreach (EmpLifeCycle item in uptotodaysData) // empLfs.Add(item); // foreach (EmpLifeCycle item in empLfs) // item.Employee = oEmps.GetItem(item.EmployeeID); // #endregion // #region Prepare Bank Account Data // ObjectsTemplate EmpAccs = new ObjectsTemplate(); // EmployeeBankAccountService oAccsvr = new EmployeeBankAccountService(); // ObjectsTemplate AccuptotodaysData = oAccsvr.GetNotYetProcessUptoToday(); // foreach (EmployeeBankAccount item in AccuptotodaysData) // EmpAccs.Add(item); // #endregion // #region Save All Data // TransactionContext tc = null; // if (oSAPDataProcess.ErrorList.Count == 0) // { // // if process contains error save the error list and return. // // else do the following // //Save employee data and update ID of New Joining in life cycle object // try // { // tc = TransactionContext.Begin(true); // this.SaveEmployees(tc, oSAPDataProcess); // // Adding Employee Life Cycle and Bank Account // empLfs.AddRange(oSAPDataProcess.SAPEmpLifeCycles); // EmpAccs.AddRange(oSAPDataProcess.EmpBankAccounts); // osvr.Save(empLfs, salaryCutoffDate, tc); // oAccsvr.Save(tc, EmpAccs, salaryCutoffDate); // // Server Delete Will Go here // oSAPInterface.DeleteXMLFilesFromFTP(); // oSAPDataProcess.SourceFileName = oSAPInterface.GetXMLFileNamesFromLocal(); // oSAPInterface.MoveXMLFilesToBackup(); // tc.End(); // } // catch (Exception ex) // { // tc.HandleError(); // oSAPInterface.DeleteXMLFilesFromLocal(); // SAPDataProcessDetail oDetail = new SAPDataProcessDetail(); // oDetail.Description = "Could not Save Data due to system error:\n" + ex.Message; // oSAPDataProcess.ProcessStatus = EnumSAPProcessStatus.Error; // oSAPDataProcess.ErrorList.Add(oDetail); // } // } // else // { // oSAPInterface.DeleteXMLFilesFromLocal(); // } // //this.Save(oSAPDataProcess); // this.SAPStatusSave(oSAPDataProcess); // #endregion // //oSAPInterface.SendMail(oSAPDataProcess); // } // catch (Exception ex) // { // throw new ServiceException(ex.Message); // } //} public void Process(bool IsSystemInfoNeeded) { SAPInterface oSAPInterface = new SAPInterface(); EmpLifeCycleService osvr = new EmpLifeCycleService(); EmployeeBankAccountService oAccsvr = new EmployeeBankAccountService(); IntigrationSetup osetup = IntigrationSetup.Get(); DateTime salaryCutoffDate = DateTime.MinValue; ObjectsTemplate oEmps = Employee.GetAllEmps(); #region Get System Information if (IsSystemInfoNeeded) { ConfigurationManager manager = new ConfigurationManager(); manager.LoadConfiguration(); PayrollType ptype = PayrollType.Get(ID.FromInteger(1)); User oUser = User.Get(ID.FromInteger(9)); oUser.LogInMode = EnumUserLogInMode.Normal; oUser.LogInPayrollTypeID = ptype.ID; User.SetCurrentUser(oUser); SystemInformation.CurrentSysInfo = SystemInformation.Get(); } #endregion EffectPrevious(false); #region Process Downloaded SAP Data try { string sDataDumpError = string.Empty; string sEmailError = string.Empty; salaryCutoffDate = new DateTime(SystemInformation.CurrentSysInfo.NextPayProcessDate.Year, SystemInformation.CurrentSysInfo.NextPayProcessDate.Month, osetup.CutOffDay); List oFiles = oSAPInterface.GetDownloadedFileInfos(); foreach (FileInfo oFile in oFiles) { #region ProcessSAPFile SAPDataProcess oSAPDataProcess = null; oSAPDataProcess = oSAPInterface.Process(oFile); #endregion #region Prepare Life-Cycle Data foreach (EmpLifeCycle item in oSAPDataProcess.SAPEmpLifeCycles) { item.Employee = oEmps.GetItem(item.EmployeeID); if (item.EmployeeID != null && !item.EmployeeID.IsUnassigned && item.Employee == null) { item.HREmployee = (new HREmployeeService()).Get(item.EmployeeID); item.Employee = (new EmployeeService()).Get(item.EmployeeID); } (new EmpLifeCycleService()).ProcessGradeSalary(item); if (item.EmployeeGradeSalary != null) { item.Gradesalaries = item.EmployeeGradeSalary.process(); } } #endregion #region Save All Data TransactionContext tc = null; if (oSAPDataProcess.ErrorList.Count == 0) { // if process contains error save the error list and return. // else do the following //Save employee data and update ID of New Joining in life cycle object try { tc = TransactionContext.Begin(true); this.SaveEmployees(tc, oSAPDataProcess); osvr.Save(oSAPDataProcess.SAPEmpLifeCycles, salaryCutoffDate, tc); oAccsvr.Save(tc, oSAPDataProcess.EmpBankAccounts, salaryCutoffDate); tc.End(); } catch (Exception ex) { tc.HandleError(); SAPDataProcessDetail oDetail = new SAPDataProcessDetail(); oDetail.Description = "Could not Save Data due to system error:\n" + ex.Message; oSAPDataProcess.ProcessStatus = EnumSAPProcessStatus.Error; oSAPDataProcess.ErrorList.Add(oDetail); } oSAPDataProcess.SourceFileName = oFile.Name; this.SAPStatusSave(oSAPDataProcess); if (oSAPDataProcess.ErrorList.Count > 0) { // SendMail(ref sEmailError, oSAPInterface, oSAPDataProcess); break; } else { //Blocked for testing oSAPInterface.DeleteFromFTP(oFile.Name); oSAPInterface.SaveFileToBackUp(oFile.FullName); try { (new SAPDataDumpService()).Save(oSAPDataProcess.SAPDataDumps); } catch (Exception e) { sDataDumpError += "Could not save to Datadump.Error:" + e.Message + ". Otherwise Everything saved Successfully.\n"; //throw new Exception("Could not save to Datadump.Error:"+e.Message+"\nOtherwise Everything saved Successfully."); } } } else { oSAPDataProcess.SourceFileName = oFile.Name; this.SAPStatusSave(oSAPDataProcess); // SendMail(ref sEmailError, oSAPInterface, oSAPDataProcess); break; } #endregion //SendMail(ref sEmailError, oSAPInterface, oSAPDataProcess); } //Blocked for testing #region Delete Unread Downloaded Local Files oSAPInterface.DeleteXMLFilesFromLocal(); #endregion if (sEmailError != string.Empty || sDataDumpError != string.Empty) { throw new Exception(sDataDumpError + ((sDataDumpError != string.Empty && sDataDumpError != string.Empty) ? "\n" : string.Empty) + sEmailError); } } catch (Exception ex) { //Blocked for testing oSAPInterface.DeleteXMLFilesFromLocal(); throw new ServiceException(ex.Message); } #endregion } public void EffectPrevious(bool IsSystemInfoNeeded) { EmpLifeCycleService osvr = new EmpLifeCycleService(); EmployeeBankAccountService oAccsvr = new EmployeeBankAccountService(); IntigrationSetup osetup = null; DateTime salaryCutoffDate = DateTime.MinValue; ObjectsTemplate oEmps = Employee.GetAllEmps(); #region Get System Information if (IsSystemInfoNeeded) { ConfigurationManager manager = new ConfigurationManager(); manager.LoadConfiguration(); PayrollType ptype = PayrollType.Get(ID.FromInteger(1)); User oUser = User.Get(ID.FromInteger(9)); oUser.LogInMode = EnumUserLogInMode.Normal; oUser.LogInPayrollTypeID = ptype.ID; User.SetCurrentUser(oUser); SystemInformation.CurrentSysInfo = SystemInformation.Get(); } #endregion #region Process Not Yet Processed Data try { osetup = IntigrationSetup.Get(); salaryCutoffDate = new DateTime(SystemInformation.CurrentSysInfo.NextPayProcessDate.Year, SystemInformation.CurrentSysInfo.NextPayProcessDate.Month, osetup.CutOffDay); ObjectsTemplate uptotodaysEmpLifeData = osvr.GetNotYetProcessUptoToday(); ObjectsTemplate UptoTodaysAccountData = oAccsvr.GetNotYetProcessUptoToday(); foreach (EmpLifeCycle item in uptotodaysEmpLifeData) { item.Employee = oEmps.GetItem(item.EmployeeID); if (item.EmployeeID != null && !item.EmployeeID.IsUnassigned && item.Employee == null) { item.HREmployee = (new HREmployeeService()).Get(item.EmployeeID); item.Employee = (new EmployeeService()).Get(item.EmployeeID); } (new EmpLifeCycleService()).ProcessGradeSalary(item); if (item.EmployeeGradeSalary != null) { item.Gradesalaries = item.EmployeeGradeSalary.process(); } } osvr.Save(uptotodaysEmpLifeData, salaryCutoffDate); oAccsvr.Save(UptoTodaysAccountData, salaryCutoffDate); } catch (Exception excp) { throw new ServiceException("Exception while giving effect to previously not processed EmpLifeCycle/EmployeeBankAccount Data :" + excp.Message); } #endregion } public ID Save(SAPDataProcess oSAPDataProcess) { TransactionContext tc = null; try { //string tableName = "SAPDataProcess"; tc = TransactionContext.Begin(true); if (oSAPDataProcess.IsNew) { int id = tc.GenerateID("SAPDataProcess", "SAPDataProcessID"); base.SetObjectID(oSAPDataProcess, ID.FromInteger(id)); SAPDataProcessDA.Insert(tc, oSAPDataProcess); } else { SAPDataProcessDA.Update(tc, oSAPDataProcess); SAPDataProcessDA.DeleteSAPDetail(tc, oSAPDataProcess.ID); } // tableName = "SAPDataProcessDetail"; int idSDP = tc.GenerateID("SAPDataProcessDetail", "SAPDataProcessDetailID"); foreach (SAPDataProcessDetail oSAPDProDetail in oSAPDataProcess.Details) { oSAPDProDetail.SAPDataProcessID = oSAPDataProcess.ID; base.SetObjectID(oSAPDProDetail, ID.FromInteger(idSDP)); SAPDataProcessDA.Insert(tc, oSAPDProDetail); idSDP = idSDP + 1; } tc.End(); return oSAPDataProcess.ID; } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public ID Save(TransactionContext tc, SAPDataProcess oSAPDataProcess) { try { // string tableName = "SAPDataProcess"; if (oSAPDataProcess.IsNew) { int id = tc.GenerateID("SAPDataProcess", "SAPDataProcessID"); base.SetObjectID(oSAPDataProcess, ID.FromInteger(id)); SAPDataProcessDA.Insert(tc, oSAPDataProcess); } else { SAPDataProcessDA.Update(tc, oSAPDataProcess); SAPDataProcessDA.DeleteSAPDetail(tc, oSAPDataProcess.ID); } // tableName = "SAPDataProcessDetail"; int idSDP = tc.GenerateID("SAPDataProcessDetail", "SAPDataProcessDetailID"); foreach (SAPDataProcessDetail oSAPDProDetail in oSAPDataProcess.Details) { oSAPDProDetail.SAPDataProcessID = oSAPDataProcess.ID; base.SetObjectID(oSAPDProDetail, ID.FromInteger(idSDP)); SAPDataProcessDA.Insert(tc, oSAPDProDetail); idSDP = idSDP + 1; } return oSAPDataProcess.ID; } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void SaveEmployees(TransactionContext tc, SAPDataProcess sAPDataProcess) { try { foreach (Employee oEmployee in sAPDataProcess.SAPEmployees) { if (oEmployee.IsNew) { ID oldID = oEmployee.ID; int id = tc.GenerateID("Employee", "EmployeeID"); base.SetObjectID(oEmployee, ID.FromInteger(id)); EmployeeDA.Insert(tc,oEmployee); if (sAPDataProcess.SAPEmpLifeCycles != null) { foreach (EmpLifeCycle item in sAPDataProcess.SAPEmpLifeCycles .Where(m => m.EmployeeID == oldID)) { item.EmployeeID = ID.FromInteger(id); item.CategoryID = oEmployee.CategoryID; if (item.Gradesalaries != null) { item.Gradesalaries.ForEach(o => o.EmployeeID = ID.FromInteger(id)); } } } if (sAPDataProcess.EmpBankAccounts != null) { sAPDataProcess.EmpBankAccounts .Where(n => n.EmployeeID == oldID) .ToList() .ForEach(n => n.EmployeeID = ID.FromInteger(id)); } sAPDataProcess.SAPDataDumps .Where(m => m.EmployeeID == oldID) .ToList() .ForEach(m => m.EmployeeID = ID.FromInteger(id)); } else { EmployeeDA.Update(tc, oEmployee); } } } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void Delete(ID id) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); SAPDataProcessDA.Delete(tc, id); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public DataSet GetSapDataProcessDetail(ID ID) { DataSet oSapDataProcessDetail = new DataSet(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); oSapDataProcessDetail = SAPDataProcessDA.GetSapDataProcessDetail(tc, ID); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return oSapDataProcessDetail; } public DataSet GetSapProcessDifferentErrors() { DataSet oSapDataProcessDetail = new DataSet(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); oSapDataProcessDetail = SAPDataProcessDA.GetSapProcessDifferentErrors(tc); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return oSapDataProcessDetail; } public bool GetFileReadStatus(string filename) { TransactionContext tc = null; try { tc = TransactionContext.Begin(); return SAPDataProcessDA.GetFileReadStatus(tc, filename); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } finally { if (tc != null) tc.End(); } } #endregion } #endregion }