EchoTex_Payroll/HRM.BO/Common/Miscellaneous.cs

334 lines
12 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
#region Miscellaneous
public class Miscellaneous : AuditTrailBase
{
#region Constructor
public Miscellaneous()
{
}
#endregion
#region Service Factory IMiscellaneousService : IMiscellaneousService
internal static IMiscellaneousService Service
{
get { return Services.Factory.CreateService<IMiscellaneousService>(typeof(IMiscellaneousService)); }
}
#endregion
//#region Functions
//public static DataSet GetEmpExpenseAmount(string sQuary)
//{
// DataSet ds = null;
// try
// {
// ds = Service.GetEmpExpenseAmount(sQuary);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
// return ds;
//}
//public static DataSet GetReckittTaxCard(int EmpID, EnumIncomeTaxDataFrom ITData, int TaxParamID)
//{
// DataSet ds = null;
// try
// {
// ds = Service.GetReckittTaxCard(EmpID, ITData, TaxParamID);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
// return ds;
//}
//public static DataSet GetADEmpLoseData(string sQuary)
//{
// DataSet ds = null;
// try
// {
// ds = Service.GetADEmpLoseData(sQuary);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
// return ds;
//}
//public void Delete(string sQuary)
//{
// try
// {
// Miscellaneous.Service.Delete(sQuary);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
//}
//public static bool ImportMonthlyExpenseData(string nMonth, string nYear)
//{
// return Service.ImportMonthlyExpenseData(nMonth, nYear);
//}
//public static DataSet GetWrongSalary(string Ssql)
//{
// DataSet ds = null;
// try
// {
// ds = Service.GetWrongSalary(Ssql);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
// return ds;
//}
//public void UpdateBasicSalary(string Ssql)
//{
// try
// {
// Miscellaneous.Service.UpdateBasicSalary(Ssql);
// }
// catch (Exception e)
// {
// throw new Exception(e.Message, e);
// }
//}
//#endregion
public double GetOverallValuesRatings(List<YearEndValueDetailsRating> oValueDetails)
{
double nTotalRating = 0;
foreach (YearEndValueDetailsRating item in oValueDetails)
{
nTotalRating += item.RatingID;
}
//nAvarageRating = nTotalRating / oValueDetails.Count;
//if (nTotalRating >= 46 && nTotalRating <= 51)
// sRating = "A";
//else if (nTotalRating >= 34 && nTotalRating <= 45)
// sRating = "B";
//else if (nTotalRating >= 17 && nTotalRating <= 33)
// sRating = "C";
return nTotalRating;
}
public double GetOverallObjectiveRatings(List<Objective> oObjectives,
List<ObjectiveCategory> oObjectiveCategory, int nGradeID, bool IsInternational)
{
double nTotalRatingOperation = 0;
double nTotalRatingPeople = 0;
double nTotalRatingStrategic = 0;
double nAvgRatingOperation = 0;
double nAvgRatingPeople = 0;
double nAvgRatingStrategic = 0;
double nPercentRatingOperation = 0;
double nPercentRatingPeople = 0;
double nPercentRatingStrategic = 0;
int nCount1 = 0;
int nCount2 = 0;
int nCount3 = 0;
foreach (Objective item in oObjectives)
{
//if (item.ObjectiveType == EnumObjectiveType.Operation)
//{
// nPercentRatingOperation = (item.LMRatingID * item.PriorityPercent)/100;
// nTotalRatingOperation += nPercentRatingOperation;
//}
}
foreach (Objective item in oObjectives)
{
//if (item.ObjectiveType == EnumObjectiveType.People)
//{
// nPercentRatingPeople = (item.LMRatingID * item.PriorityPercent) / 100;
// nTotalRatingPeople += nPercentRatingPeople;
//}
}
foreach (Objective item in oObjectives)
{
//if (item.ObjectiveType == EnumObjectiveType.Strategic)
//{
// nPercentRatingStrategic = (item.LMRatingID * item.PriorityPercent) / 100;
// nTotalRatingStrategic += nPercentRatingStrategic;
//}
}
//nAvgRatingOperation =nTotalRatingOperation>0? nTotalRatingOperation / nCount1:0;
//nAvgRatingPeople =nTotalRatingPeople>0? nTotalRatingPeople / nCount2:0;
//nAvgRatingStrategic =nTotalRatingStrategic>0?nTotalRatingStrategic / nCount3:0;
//EnumObjectiveCategory etype = IsInternational ? EnumObjectiveCategory.BRACInternational : EnumObjectiveCategory.BRAC;
//List<ObjectiveCategory> oObjectiveCategoryFinal = oObjectiveCategory.FindAll(delegate(ObjectiveCategory item) { return item.Category == etype; });
//List<ObjectiveCategoryGrades> oCatGrades = new List<ObjectiveCategoryGrades>();
//foreach (ObjectiveCategory oItem in oObjectiveCategoryFinal)
//{
// foreach (ObjectiveCategoryGrades oItem1 in oItem.ObjectiveCategoryGrades)
// {
// oCatGrades.Add(oItem1);
// }
//}
//ObjectiveCategoryGrades oObjGrade1 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.Operation && item.GradeID.Integer == nGradeID; });
//if (oObjGrade1 != null)
//{
// nPercentRatingOperation = (nAvgRatingOperation * oObjGrade1.Percent) / 100;
//}
//ObjectiveCategoryGrades oObjGrade2 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.People && item.GradeID.Integer == nGradeID; });
//if (oObjGrade2 != null)
//{
// nPercentRatingPeople = (nAvgRatingPeople * oObjGrade2.Percent) / 100;
//}
//ObjectiveCategoryGrades oObjGrade3 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.Strategic && item.GradeID.Integer == nGradeID; });
//if (oObjGrade3 != null)
//{
// nPercentRatingStrategic = (nAvgRatingStrategic * oObjGrade3.Percent) / 100;
//}
//return (nPercentRatingOperation + nPercentRatingPeople + nPercentRatingStrategic);
return (nTotalRatingOperation + nTotalRatingPeople + nTotalRatingStrategic);
}
public DataTable GetIndividualAverageObjectiveRating(List<Objective> oObjectives,
List<ObjectiveCategory> oObjectiveCategory, int nGradeID, bool IsInternational)
{
DataTable dt = new DataTable();
dt.Columns.Add("Type");
dt.Columns.Add("Percentage");
double nTotalRatingOperation = 0;
double nTotalRatingPeople = 0;
double nTotalRatingStrategic = 0;
double nAvgRatingOperation = 0;
double nAvgRatingPeople = 0;
double nAvgRatingStrategic = 0;
double nPercentRatingOperation = 0;
double nPercentRatingPeople = 0;
double nPercentRatingStrategic = 0;
int nCount1 = 0;
int nCount2 = 0;
int nCount3 = 0;
foreach (Objective item in oObjectives)
{
//if (item.ObjectiveType == EnumObjectiveType.Operation)
//{
// nPercentRatingOperation = (item.LMRatingID * item.PriorityPercent) / 100;
// nTotalRatingOperation += nPercentRatingOperation;
//}
}
foreach (Objective item in oObjectives)
{
//if (item.ObjectiveType == EnumObjectiveType.People)
//{
// nPercentRatingPeople = (item.LMRatingID * item.PriorityPercent) / 100;
// nTotalRatingPeople += nPercentRatingPeople;
//}
}
foreach (Objective item in oObjectives)
{
// if (item.ObjectiveType == EnumObjectiveType.Strategic)
// {
// nPercentRatingStrategic = (item.LMRatingID * item.PriorityPercent) / 100;
// nTotalRatingStrategic += nPercentRatingStrategic;
// }
}
//nAvgRatingOperation = nTotalRatingOperation / nCount1;
//nAvgRatingPeople = nTotalRatingPeople / nCount2;
//nAvgRatingStrategic = nTotalRatingStrategic / nCount3;
//EnumObjectiveCategory etype = IsInternational ? EnumObjectiveCategory.BRACInternational : EnumObjectiveCategory.BRAC;
//List<ObjectiveCategory> oObjectiveCategoryFinal = oObjectiveCategory.FindAll(delegate(ObjectiveCategory item) { return item.Category == etype; });
//List<ObjectiveCategoryGrades> oCatGrades = new List<ObjectiveCategoryGrades>();
//foreach (ObjectiveCategory oItem in oObjectiveCategoryFinal)
//{
// foreach (ObjectiveCategoryGrades oItem1 in oItem.ObjectiveCategoryGrades)
// {
// oCatGrades.Add(oItem1);
// }
//}
//ObjectiveCategoryGrades oObjGrade1 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.Operation && item.GradeID.Integer == nGradeID; });
//if (oObjGrade1 != null)
//{
// nPercentRatingOperation = (nAvgRatingOperation * oObjGrade1.Percent) / 100;
//}
//ObjectiveCategoryGrades oObjGrade2 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.People && item.GradeID.Integer == nGradeID; });
//if (oObjGrade2 != null)
//{
// nPercentRatingPeople = (nAvgRatingPeople * oObjGrade2.Percent) / 100;
//}
//ObjectiveCategoryGrades oObjGrade3 = oCatGrades.Find(delegate(ObjectiveCategoryGrades item) { return item.ObjectiveType == EnumObjectiveType.Strategic && item.GradeID.Integer == nGradeID; });
//if (oObjGrade3 != null)
//{
// nPercentRatingStrategic = (nAvgRatingStrategic * oObjGrade3.Percent) / 100;
//}
if (nPercentRatingOperation > 0)
dt.Rows.Add("Operation", nTotalRatingOperation).ToString();
if (nPercentRatingPeople > 0)
dt.Rows.Add("People", nTotalRatingPeople).ToString();
if (nPercentRatingStrategic > 0)
dt.Rows.Add("Strategic", nTotalRatingStrategic).ToString();
return dt;
}
}
#endregion
#region IMiscellaneousService Service
public interface IMiscellaneousService
{
DataSet GetReckittTaxCard(int EmpID, EnumIncomeTaxDataFrom ITData, int TaxParamID);
DataSet GetEmpExpenseAmount(string sQuary);
DataSet GetADEmpLoseData(string SQuary);
DataSet GetWrongSalary(string Ssql);
void UpdateBasicSalary(string Ssql);
void Delete(string sQuary);
bool ImportMonthlyExpenseData(string nMonth, string nYear);
int GetNextID(string tableName, string ColumnName, string whereClause);
}
#endregion
}