EchoTex_Payroll/HRM.DA/Service/Fund/YearEnd/YearEndService.cs

151 lines
5.8 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
//using System;
//using System.Data;
//
//using Ease.Core.Model;
//using Ease.Core.DataAccess;
//
//using Ease.Core;
//using System.Collections.Generic;
//using Ease.Core.Utility;
//
//
//using HRM.BO;
//using HRM.DA;
//using HRM.BO.Fund;
//namespace HRM.DA.Fund
//{
// public class YearEndService : ServiceTemplate
// {
// protected override T CreateObject<T>(DataReader dataReader)
// {
// YearEnd yearEnd = new YearEnd();
// return yearEnd as T;
// }
// #region IYearEndService Members
// //public void Insert(CompanyInfo companyInfo, YearEnd yearEnd)
// //{
// // //TransactionContext tc = null;
// // //try
// // //{
// // // CompanyInfoService comInfoService = new CompanyInfoService();
// // // GLTrans glTrans = new GLTrans();
// // // glTrans.Add(yearEnd.GlTran);
// // // tc = TransactionContext.Begin(true);
// // // comInfoService.Insert(companyInfo);
// // // SaveVoucher(tc, glTrans, 1); // 1 only for voucher param
// // // tc.End();
// // //}
// // //catch (Exception e)
// // //{
// // // throw new Exception("Insert failed : " + e.Message, e);
// // //}
// //}
// public void UndoYearEnd(DateTime YearEndDate)
// {
// try
// {
// TransactionContext tc = null;
// tc = TransactionContext.Begin(true);
// EaseFAS.Service.GLTranService oservice = new EaseFAS.Service.GLTranService();
// Ease.Core.DataAccess.TransactionContext coretc = Ease.Core.DataAccess.TransactionContext.SetConnection(tc.Connection, tc.Transaction);
// oservice.DeleteYearEndVoucher(coretc, YearEndDate);
// MembersTransactionDetailsService mservice = new MembersTransactionDetailsService();
// mservice.DeleteYearEndInterestTran(tc, YearEndDate);
// DateTime LastyearEndDate;
// int distMonth = Convert.ToInt32(ConfigurationSettings.AppSettings["MemberDividentDuration"]);
// if (distMonth == 0 || distMonth == 1)
// {
// if (distMonth == 0)
// LastyearEndDate = Ease.Core.Global.PayrollFirstDateOfMonth(YearEndDate.AddMonths(-5));
// else
// LastyearEndDate = Ease.Core.Global.PayrollFirstDateOfMonth(YearEndDate.AddMonths(-11));
// LastyearEndDate = LastyearEndDate.AddDays(-1);
// }
// else throw new Exception("Year End Mode is undefined in configuration file.");
// CompanyInfoService comInfoService = new CompanyInfoService();
// comInfoService.UpdateLastYearEndDate(tc, LastyearEndDate);
// tc.End();
// }
// catch (Exception ex)
// {
// throw new Exception("failed to Undo YearEnd: " + ex.Message, ex);
// }
// }
// public void DoYearEnd(CompanyInfo companyInfo, YearEnd yearEnd, EaseFAS.BO.GLTrans oTrans,
// List<FM.BO.Common.MembersTransactionDetails> membertransactions)
// {
// TransactionContext tc = null;
// try
// {
// CompanyInfoService comInfoService = new CompanyInfoService();
// DateTime LastAuditMonth = ThisSystem.Default.GetLastAuditMonthCurrentYear();
// DateTime SystemCurrMonth = CompanyInfo.GetCurrentMonth();
// EaseFAS.Service.GLTranService orv = new EaseFAS.Service.GLTranService();
// bool yearEndAlreadyDone = orv.VoucherExist(EaseFAS.Global.EnumGLTranType.YearEndVoucher, PayrollGlobalFunctions.PayrollFirstDateOfMonth(LastAuditMonth), LastAuditMonth);
// bool voucherAfterYearEnd = orv.VoucherExist(EaseFAS.Global.EnumGLTranType.YearEndVoucher, PayrollGlobalFunctions.PayrollFirstDateOfMonth(LastAuditMonth), LastAuditMonth);
// tc = TransactionContext.Begin(true);
// comInfoService.UpdateLastYearEndDate(tc, LastAuditMonth);
// Ease.Core.DataAccess.TransactionContext coretc = Ease.Core.DataAccess.TransactionContext.SetConnection(tc.Connection, tc.Transaction);
// EaseFAS.Service.GLTranService oservice = new EaseFAS.Service.GLTranService();
// //Delete
// if (yearEndAlreadyDone == true) oservice.DeleteYearEndVoucher(coretc, LastAuditMonth);
// oservice.Insert(coretc, oTrans);
// MembersTransactionDetailsService mservice = new MembersTransactionDetailsService();
// if (yearEndAlreadyDone == true)
// mservice.DeleteYearEndInterestTran(tc, LastAuditMonth);
// mservice.Insert(tc, membertransactions);
// if (voucherAfterYearEnd == true)
// mservice.DeleteYearEndInterestTran(tc, LastAuditMonth);
// tc.End();
// }
// catch (Exception e)
// {
// throw new Exception("Insert failed : " + e.Message, e);
// }
// }
// #endregion
// #region IFASService Members
// public void SaveUserRecords(Ease.CoreV35.DataAccess.TransactionContext tc, Ease.CoreV35.Model.List<HelperForSubsidiaryUpload> UserObjects)
// {
// throw new NotImplementedException();
// }
// public void SaveVoucher(TransactionContext tc, GLTrans glTrans, int investActivitiesInInt)
// {
// GLTranService glTranService = new GLTranService();
// if (glTrans != null)
// {
// glTranService.Insert(tc, glTrans);
// }
// }
// #endregion
// }
//}