using System; using HRM.BO; using Ease.Core.Model; using Ease.Core.DataAccess; using Ease.Core.Utility; using System.Collections.Generic; using HRM.BO; using System.Data; using Microsoft.Data.SqlClient; namespace HRM.DA { public class ADParameterEmployeeService : ServiceTemplate, IADParameterEmployeeService { public ADParameterEmployeeService() { } private void MapObject(ADParameterEmployee oADParameterEmployee, DataReader oReader) { base.SetObjectID(oADParameterEmployee, oReader.GetInt32("ADPARAMETEREMPID").Value); oADParameterEmployee.ADParameterID = oReader.GetInt32("aDParameterID", 0); oADParameterEmployee.AllowDeductID = oReader.GetInt32("allowDeductID", 0); oADParameterEmployee.Periodicity = (EnumPeriodicity)oReader.GetInt32("periodicity").Value; oADParameterEmployee.EmployeeID = oReader.GetInt32("EmployeeID", 0); oADParameterEmployee.EmployeeName = oReader.GetString("Name", true, string.Empty); oADParameterEmployee.EmployeeNo = oReader.GetString("EmployeeNo", true, string.Empty); oADParameterEmployee.FormDate = oReader.GetDateTime("fromDate").Value; oADParameterEmployee.TillDate = oReader.GetDateTime("TILLDATE"); oADParameterEmployee.MonthlyAmount = oReader.GetDouble("monthlyAmount").Value; oADParameterEmployee.TotalAmount = oReader.GetDouble("totalAmount").Value; oADParameterEmployee.Arreartype = (EnumArrearType)oReader.GetInt32("ARREARINFO").Value; oADParameterEmployee.ADEmpType = (EnumADEmpType)oReader.GetInt32("ADEMPTYPE").Value; oADParameterEmployee.ValueType = (EnumValueType)oReader.GetInt32("ValueType").Value; oADParameterEmployee.TracNo = oReader.GetString("TracNo", true, string.Empty); oADParameterEmployee.ModifiedBy = oReader.GetInt32("ModifiedBy", 0); oADParameterEmployee.ModifiedDate = oReader.GetDateTime("ModifiedDate"); this.SetObjectState(oADParameterEmployee, Ease.Core.ObjectState.Saved); } protected override T CreateObject(DataReader oReader) { ADParameterEmployee oADParameterEmployee = new ADParameterEmployee(); MapObject(oADParameterEmployee, oReader); return oADParameterEmployee as T; } #region Service implementation public ADParameterEmployee Get(int id) { ADParameterEmployee oADParameterEmployee = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ADParameterEmployeeDA.Get(tc, id)); if (oreader.Read()) { oADParameterEmployee = 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 } return oADParameterEmployee; } public ADParameterEmployee Get(int nEmpID, int nAllowDeductID, int nADParamID) { ADParameterEmployee oADParameterEmployee = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ADParameterEmployeeDA.Get(tc, nEmpID, nAllowDeductID, nADParamID)); if (oreader.Read()) { oADParameterEmployee = 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 } return oADParameterEmployee; } public ADParameterEmployee Get(int nEmpID, int nAllowDeductID, int nADParamID, EnumArrearType nArrearType) { ADParameterEmployee oADParameterEmployee = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader oreader = new DataReader(ADParameterEmployeeDA.Get(tc, nEmpID, nAllowDeductID, nADParamID, nArrearType)); if (oreader.Read()) { oADParameterEmployee = 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 } return oADParameterEmployee; } public List GetbyParameter(int nADPAramID, EnumADEmpType type) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetbyParameter(tc, nADPAramID, type)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetByEmployee(int nEmpID, EnumAllowOrDeduct adType, EnumADEmpType sTypes) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); //DataReader dr = new DataReader(ADParameterEmployeeDA.GetByEmployee(tc, nEmpID, adType, sTypes)); //aDParameterEmployees = 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 } return aDParameterEmployees; } public List Get(int AllowDeductID, DateTime fromDate, DateTime toDate, int payrollTypeID) { List aDParameterEmployees = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.Get(tc, AllowDeductID, fromDate, toDate, payrollTypeID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetForApproval(int AllowDeductID, DateTime fromDate, DateTime toDate, int payrollTypeID) { List aDParameterEmployees = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader( ADParameterEmployeeDA.GetForApproval(tc, AllowDeductID, fromDate, toDate, payrollTypeID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List Get(int nEmpID, int AllowDeductID, DateTime fromDate, DateTime toDate) { List aDParameterEmployees = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.Get(tc, nEmpID, AllowDeductID, fromDate, toDate)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List Get(DateTime fromDate, DateTime toDate, int payrollTypeID) { List aDParameterEmployees = null; TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.Get(tc, fromDate, toDate, payrollTypeID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetByEmployee(int nEmpID, EnumAllowOrDeduct adType, EnumADEmpType adEmpType, int payrollTypeID, DateTime nextPayProcessDate) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetByEmployee(tc, nEmpID, adType, adEmpType, payrollTypeID, nextPayProcessDate)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetByEmployee(int nEmpID, int nAllowDeductID, int payrollTypeID) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetByEmployee(tc, nEmpID, nAllowDeductID, payrollTypeID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List Get(EnumADEmpType status) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.Get(tc, status)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List Get(EnumADEmpType status, EnumAllowOrDeduct allowOrDeduct) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.Get(tc, status)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetbyParameter(int nADParamID, DateTime nextPayProcessDate) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetbyParameter(tc, nADParamID, nextPayProcessDate)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetbyParameterID(TransactionContext tc, int nADParamID) { List aDParameterEmployees = new List(); try { DataReader dr = new DataReader(ADParameterEmployeeDA.GetbyParameterID(tc, nADParamID)); aDParameterEmployees = this.CreateObjects(dr); dr.Close(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return aDParameterEmployees; } public List GetNextSalaryMonthItems(TransactionContext tc, int nADParamID,int payrolltypeid) { List aDParameterEmployees = new List(); try { DataReader dr = new DataReader(ADParameterEmployeeDA.GetNextSalaryMonthItems(tc, nADParamID, payrolltypeid)); aDParameterEmployees = this.CreateObjects(dr); dr.Close(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } return aDParameterEmployees; } public List GetByAllow(int nAllowdeductID) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetByAllow(tc, nAllowdeductID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public List GetByAllowForApproval(int nAllowdeductID, int payrollTypeID) { List aDParameterEmployees = new List(); TransactionContext tc = null; try { tc = TransactionContext.Begin(); DataReader dr = new DataReader(ADParameterEmployeeDA.GetByAllowForApproval(tc, nAllowdeductID, payrollTypeID)); aDParameterEmployees = 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 } return aDParameterEmployees; } public int Save(ADParameterEmployee oADParameterEmployee, DateTime LastPayProcessDate) { TransactionContext tc = null; tc = TransactionContext.Begin(true); ADParameterEmployeeDA.DeleteByAllowDeductMonth(tc, oADParameterEmployee.EmployeeID, oADParameterEmployee.AllowDeductID, oADParameterEmployee.FormDate); int nid = this.Save(tc, oADParameterEmployee, LastPayProcessDate); tc.End(); return nid; } public int Save(TransactionContext tc, ADParameterEmployee oADParameterEmployee, DateTime LastPayProcessDate) { ADParameterEmployee adEmpArrear = null; int id = 0; try { if (oADParameterEmployee.IsNew) { //if(oADParameterEmployee.AllowDeductID==14) //{ // id = tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"); // base.SetObjectID(oADParameterEmployee, ID.FromInteger(id)); // ADParameterEmployeeDA.Insert(tc, oADParameterEmployee); //} // else //{ if (oADParameterEmployee.FormDate <= LastPayProcessDate) { adEmpArrear = oADParameterEmployee.GetClone(); adEmpArrear.Arreartype = EnumArrearType.ToCalculate; adEmpArrear.TillDate = LastPayProcessDate; adEmpArrear.CreatedBy = oADParameterEmployee.CreatedBy; adEmpArrear.CreatedDate = DateTime.Today; adEmpArrear.ModifiedBy = oADParameterEmployee.ModifiedBy; adEmpArrear.ModifiedDate = DateTime.Today; id = tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"); base.SetObjectID(adEmpArrear, (id)); ADParameterEmployeeDA.Insert(tc, adEmpArrear); oADParameterEmployee.FormDate = LastPayProcessDate.AddDays(1); } id = tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"); base.SetObjectID(oADParameterEmployee, (id)); //ADParameterEmployeeDA.DeleteByAllowDeductMonth(tc, oADParameterEmployee.EmployeeID, oADParameterEmployee.AllowDeductID, oADParameterEmployee.FormDate); ADParameterEmployeeDA.Insert(tc, oADParameterEmployee); } //} else { ADParameterEmployeeDA.Update(tc, oADParameterEmployee); } return oADParameterEmployee.ID; } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void Save(List items, DateTime lastPayProcessDate) { TransactionContext tc = null; int id = 0; try { tc = TransactionContext.Begin(true); foreach (ADParameterEmployee item in items) { item.ID= this.Save(tc, item, lastPayProcessDate); } tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void IntegrationSave(List items, DateTime lastPayProcessDate, List deletedItems) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); foreach (ADParameterEmployee item in deletedItems) { ADParameterEmployeeDA.Delete(tc, item.ID); } int id; id = tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"); foreach (ADParameterEmployee item in items) { if (item.IsNew) { if (item.FormDate <= lastPayProcessDate) { var arrearItem = item.GetClone(); arrearItem.Arreartype = EnumArrearType.ToCalculate; arrearItem.TillDate = lastPayProcessDate; arrearItem.CreatedBy = item.CreatedBy; arrearItem.CreatedDate = DateTime.Today; arrearItem.ModifiedBy = item.ModifiedBy; arrearItem.ModifiedDate = DateTime.Today; id = id + 1; base.SetObjectID(arrearItem, (id)); ADParameterEmployeeDA.Insert(tc, arrearItem); } id = id + 1; base.SetObjectID(item, (id)); ADParameterEmployeeDA.Insert(tc, item); } else { ADParameterEmployeeDA.Update(tc, item); } } tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void UpdateAmountAndDate(ADParameterEmployee item) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ADParameterEmployeeDA.UpdateAmountAndDate(tc, item); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void BulkSave(TransactionContext tc , List items, DateTime lastPayProcessDate) { int id = 0; List newitems = new List(); try { id = tc.GenerateID("ADParameterEmployee", "ADPARAMETEREMPID"); foreach (ADParameterEmployee item in items) { if (item.FormDate <= lastPayProcessDate) { id = id + 1; ADParameterEmployee arrItem = item.GetClone(); arrItem.ID = id; arrItem.Arreartype = EnumArrearType.ToCalculate; arrItem.TillDate = lastPayProcessDate; arrItem.CreatedBy = item.CreatedBy; arrItem.CreatedDate = DateTime.Today; arrItem.ModifiedBy = item.ModifiedBy; arrItem.ModifiedDate = DateTime.Today; newitems.Add(arrItem); } id = id + 1; item.ID = id; newitems.Add(item); } DataTable attnProcessEntryTable = new DataTable("ADPARAMETEREMPLOYEE"); attnProcessEntryTable.Columns.Add(new DataColumn("ENTRYDATE", typeof(DateTime))); attnProcessEntryTable.Columns.Add(new DataColumn("ADPARAMETEREMPID", typeof(int))); attnProcessEntryTable.Columns.Add(new DataColumn("ADPARAMETERID", typeof(int))); attnProcessEntryTable.Columns.Add(new DataColumn("ALLOWDEDUCTID", typeof(int))); // NULL attnProcessEntryTable.Columns.Add(new DataColumn("PERIODICITY", typeof(int))); // NULL attnProcessEntryTable.Columns.Add(new DataColumn("EMPLOYEEID", typeof(int))); // NULL attnProcessEntryTable.Columns.Add(new DataColumn("FROMDATE", typeof(DateTime))); attnProcessEntryTable.Columns.Add(new DataColumn("TILLDATE", typeof(DateTime))); attnProcessEntryTable.Columns.Add(new DataColumn("MONTHLYAMOUNT", typeof(double))); attnProcessEntryTable.Columns.Add(new DataColumn("TOTALAMOUNT", typeof(double))); attnProcessEntryTable.Columns.Add(new DataColumn("DISBURSEDAMOUNT", typeof(double))); // NULL attnProcessEntryTable.Columns.Add(new DataColumn("ARREARINFO", typeof(int))); // NULL, attnProcessEntryTable.Columns.Add(new DataColumn("MODIFIEDBY", typeof(int))); // NULL, attnProcessEntryTable.Columns.Add(new DataColumn("MODIFIEDDATE", typeof(DateTime))); // NULL, attnProcessEntryTable.Columns.Add(new DataColumn("ADEMPTYPE", typeof(int))); attnProcessEntryTable.Columns.Add(new DataColumn("VALUETYPE", typeof(int))); attnProcessEntryTable.Columns.Add(new DataColumn("TRACNO", typeof(string))); attnProcessEntryTable.Columns.Add(new DataColumn("CREATEDBY", typeof(bool))); attnProcessEntryTable.Columns.Add(new DataColumn("CREATEDDATE", typeof(DateTime))); // NULL, foreach (ADParameterEmployee item in items) { attnProcessEntryTable.Rows.Add( DateTime.Today, item.ID, item.ADParameterID, item.AllowDeductID, item.Periodicity, item.EmployeeID, item.FormDate, item.TillDate, item.MonthlyAmount, item.TotalAmount, item.DisburseAmount, item.Arreartype, item.ModifiedBy, item.ModifiedDate, item.ADEmpType, item.ValueType, item.TracNo, item.CreatedBy, item.CreatedDate ); } using (SqlBulkCopy bulkCopy = new SqlBulkCopy((SqlConnection)tc.Connection, SqlBulkCopyOptions.Default, (SqlTransaction)tc.Transaction)) { bulkCopy.BulkCopyTimeout = 6000; // in seconds bulkCopy.DestinationTableName = "ADPARAMETEREMPLOYEE"; bulkCopy.WriteToServer(attnProcessEntryTable); } } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } internal void Save(TransactionContext tc, ADParameterEmployee item) { throw new NotImplementedException(); } public void Delete(int id) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ADParameterEmployeeDA.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 void Delete(ADParameterEmployee adParamEmp) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ADParameterEmployeeDA.Delete(tc, adParamEmp); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void Delete(TransactionContext tc, ADParameterEmployee adParamEmp) { try { ADParameterEmployeeDA.Delete(tc, adParamEmp); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public void DeleteByAllowDeductMonth(int nEmpID, int nAllowDeductID, DateTime dAllowDeductMonht) { TransactionContext tc = null; try { tc = TransactionContext.Begin(true); ADParameterEmployeeDA.DeleteByAllowDeductMonth(tc, nEmpID, nAllowDeductID, dAllowDeductMonht); tc.End(); } catch (Exception e) { #region Handle Exception if (tc != null) tc.HandleError(); ExceptionLog.Write(e); throw new ServiceException(e.Message, e); #endregion } } public int Save(ADParameterEmployee item) { throw new NotImplementedException(); } //internal void DeleteByAllo(TransactionContext tc, int allowDeductID) //{ // //TransactionContext tc = null; // try // { // //tc = TransactionContext.Begin(true); // ADParameterEmployeeDA.DeleteByAllo(tc, allowDeductID); // //tc.End(); // } // catch (Exception e) // { // #region Handle Exception // //if (tc != null) // // tc.HandleError(); // ExceptionLog.Write(e); // throw new ServiceException(e.Message, e); // #endregion // } //} //internal void DeleteByEmpID(TransactionContext tc,int nEmpID, int nADParameterID) //{ // try // { // ADParameterEmployeeDA.DeleteByEmpID(tc, nEmpID, nADParameterID); // } // catch (Exception e) // { // #region Handle Exception // ExceptionLog.Write(e); // throw new ServiceException(e.Message, e); // #endregion // } //} //public void DeleteByEmpID(int nEmpID, int nADParameterID) //{ // TransactionContext tc = null; // try // { // tc = TransactionContext.Begin(true); // this.DeleteByEmpID(tc, nEmpID, nADParameterID); // tc.End(); // } // catch (Exception e) // { // #region Handle Exception // if (tc != null) // tc.HandleError(); // ExceptionLog.Write(e); // throw new ServiceException(e.Message, e); // #endregion // } //} //public void DeleteByAllo(int nAllowDeducID) //{ // TransactionContext tc = null; // try // { // tc = TransactionContext.Begin(true); // this.DeleteByAllo(tc, nAllowDeducID); // tc.End(); // } // catch (Exception e) // { // #region Handle Exception // if (tc != null) // tc.HandleError(); // ExceptionLog.Write(e); // throw new ServiceException(e.Message, e); // #endregion // } //} #endregion } }