EchoTex_Payroll/HRM.BO/Common/ConfigReader.cs
2024-10-14 10:01:49 +06:00

141 lines
6.2 KiB
C#

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
public class ConfigReader
{
private string[] items = null;
public List<SetupDetail> Details { get; }
public List<string> Types { get; }
public List<EnmSetupManagerTranType> EnumTypes { get; }
public List<string> SQLRelationToEmp { get; }
public int TotalTypes { get; }
//public static List<EnmSetupManagerTranType> GetTotalTypes(string sType)
//{
// List<EnmSetupManagerTranType> nTypes = new List<EnmSetupManagerTranType>();
// string[] items = sType.Split(',');
// if (items != null && items.Length > 0)
// {
// foreach (string item in items)
// {
// switch (item.ToLower().Trim())
// {
// case "grade":
// nTypes.Add(EnmSetupManagerTranType.Grade);
// break;
// case "location":
// nTypes.Add(EnmSetupManagerTranType.Location);
// break;
// case "category":
// nTypes.Add(EnmSetupManagerTranType.Category);
// break;
// case "designation":
// nTypes.Add(EnmSetupManagerTranType.Designation);
// break;
// }
// }
// }
// return nTypes;
//}
//public ConfigReader(string sType)
//{
// items = sType.Split(',');
// SetupDetail detail = null;
// _sTypes = new List<string>();
// _nTypes = new List<EnmSetupManagerTranType>();
// _sqlRelationtoEmp = new List<string>();
// if (items != null && items.Length > 0)
// {
// _SetupDetails = new List<SetupDetail>();
// foreach (string item in items)
// {
// switch (item.ToLower().Trim())
// {
// case "grade":
// _sTypes.Add("Grade");
// _nTypes.Add(EnmSetupManagerTranType.Grade);
// _totalType++;
// _sqlRelationtoEmp.Add(" SD.TranType=1 AND E.GradeID= SD.TranID");
// List<Grade> oGrades = Grade.Get(EnumStatus.Active);
// foreach (Grade grade in oGrades)
// {
// detail = new SetupDetail();
// detail.Code = grade.Code;
// detail.Name = grade.Name;
// detail.IsSelected = false;
// detail.TranID = grade.ID;
// detail.TranType = EnmSetupManagerTranType.Grade;
// _SetupDetails.Add(detail);
// }
// break;
// case "location":
// _totalType++;
// _sTypes.Add("Location");
// _nTypes.Add(EnmSetupManagerTranType.Location);
// _sqlRelationtoEmp.Add(" SD.TranType=2 AND E.LocationID= SD.TranID");
// List<Location> oLocations = Location.GetByTier(3);
// foreach (Location olocation in oLocations)
// {
// detail = new SetupDetail();
// detail.Code = olocation.Code;
// detail.Name = olocation.Name;
// detail.IsSelected = false;
// detail.TranID = olocation.ID;
// detail.TranType = EnmSetupManagerTranType.Location;
// _SetupDetails.Add(detail);
// }
// break;
// case "category":
// _sTypes.Add("Category");
// _nTypes.Add(EnmSetupManagerTranType.Category);
// _totalType++;
// _sqlRelationtoEmp.Add(" SD.TranType=3 AND E.CategoryID= SD.TranID");
// List<Category> oCategorys = Category.Get(EnumStatus.Active);
// foreach (Category ocat in oCategorys)
// {
// detail = new SetupDetail();
// detail.Code = ocat.Code;
// detail.Name = ocat.Name;
// detail.IsSelected = false;
// detail.TranID = ocat.ID;
// detail.TranType = EnmSetupManagerTranType.Category;
// _SetupDetails.Add(detail);
// }
// break;
// case "designation":
// _sTypes.Add("Designation");
// _nTypes.Add(EnmSetupManagerTranType.Designation);
// _totalType++;
// _sqlRelationtoEmp.Add(" SD.TranType=4 AND E.DesignationID= SD.TranID");
// List<Designation> oDesignations = Designation.Get(EnumStatus.Active);
// foreach (Designation oDesg in oDesignations)
// {
// detail = new SetupDetail();
// detail.Code = oDesg.Code;
// detail.Name = oDesg.Name;
// detail.IsSelected = false;
// detail.TranID = oDesg.ID;
// detail.TranType = EnmSetupManagerTranType.Designation;
// _SetupDetails.Add(detail);
// }
// break;
// }
// }
// }
//}
}
}