本文整理匯總了C#中BaseService.SendMail方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseService.SendMail方法的具體用法?C# BaseService.SendMail怎麽用?C# BaseService.SendMail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseService
的用法示例。
在下文中一共展示了BaseService.SendMail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SendMaToPreReject
public DataErrorCode SendMaToPreReject(string host, Guid recordID, Guid userApprovedID, Guid loginId)
{
using (var context = new VnrHrmDataContext())
{
string statusMess = string.Empty;
var Services = new BaseService();
var UserLogin = string.Empty;
string status = string.Empty;
string typeApprover = FinApproverType.Fin_CashAdvance.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);
var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();
var repoCashItem = new CustomBaseRepository<Fin_CashAdvanceItem>(unitOfWork);
var totalItem = repoCashItem.GetAll().Where(s => s.CashAdvanceID == recordID && s.Status.Contains("E_APPROVED")).Sum(s => s.Amount);
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
var repoFIN_TravelRequest = new CustomBaseRepository<Fin_CashAdvance>(unitOfWork);
var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
string _typeTemplate = EnumDropDown.EmailType.E_REJECTED_CASHADVANCE.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return DataErrorCode.Error_NoTemplateMail;
var approverEntity = repoFin_Approver.GetAll().Where(s => s.IsDelete == null && s.ApprovedID != null && s.ApprovedID.Value == loginId).FirstOrDefault();
if (approverEntity != null && approverEntity.OrderNo != null)
{
var userInfo = repoSys_UserInfo.GetAll().Where(s => s.IsDelete == null && s.ID == approverEntity.ApprovedID.Value).FirstOrDefault();
if (userInfo != null)
{
var profileRequest = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(record.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();
var profileEntity = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();
if (profileEntity != null)
{
var jobTitleEntity = lstJobTitle.Where(s => profileEntity.JobTitleID != null && s.ID == profileEntity.JobTitleID.Value).FirstOrDefault();
var orgEntity = lstOrg.Where(s => profileEntity.OrgStructureID != null && s.ID == profileEntity.OrgStructureID.Value).FirstOrDefault();
if (template != null)
{
try
{
string MailTo = profileRequest.Email;
string urlClickHere = host + "#Hrm_Main_Web/Fin_SendMailApprovedCashAdvance/DetailTravelRequest/" + recordID + "#NewTab";
string linkcontent = string.Empty;
string linkcontentReject = string.Empty;
linkcontent += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessApprovedPage"
+ "?loginID=" + approverEntity.ApprovedID
+ "&userApprovedID=" + approverEntity.ID
+ "&recordID=" + recordID
+ "'>đây" + "<a/>" + " để đồng ý.";
linkcontentReject += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessRejectPage"
+ "?loginID=" + approverEntity.ApprovedID
+ "&userApprovedID=" + approverEntity.ID
+ "&recordID=" + recordID
+ "'>đây" + "<a/>" + " để từ chối.";
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_PROFILENAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_JOBTITLE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_AREA.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_USERINFONAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCENAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCECODE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_TOTALADVANCE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_DENIES.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_LINKCONTENT.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_REJECTLINK.ToString(),
//.........這裏部分代碼省略.........
示例2: SendMaToNextApproved
public DataErrorCode SendMaToNextApproved(string host, Guid recordID, Guid userApprovedID)
{
using (var context = new VnrHrmDataContext())
{
string statusMess = string.Empty;
var Services = new BaseService();
string status = string.Empty;
var UserLogin = string.Empty;
string typeApprover = FinApproverType.Fin_CashAdvance.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);
var lstApprover = repoFin_Approver.GetAll().Where(s => s.IsDelete == null).ToList();
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();
var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
var lstProfile = repoProfile.GetAll().Where(s => s.IsDelete == null).ToList();
var repoCashItem = new CustomBaseRepository<Fin_CashAdvanceItem>(unitOfWork);
var totalItem = repoCashItem.GetAll().Where(s => s.CashAdvanceID == recordID && s.Status.Contains("E_APPROVED")).Sum(s => s.Amount);
var repoFIN_TravelRequest = new CustomBaseRepository<Fin_CashAdvance>(unitOfWork);
var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
string _typeTemplate = EnumDropDown.EmailType.E_REQUEST_CASHADVANCE.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return DataErrorCode.Error_NoTemplateMail;
#region KT nếu là nguoi duyet cuoi thì gui email lại cho người yêu cầu duyệt
if (userApprovedID == Guid.Empty)
{
if (record != null)
{
string _typeTemplateApproved = EnumDropDown.EmailType.E_APPROVED_CASHADVANCE.ToString();
var typeTemplateApproved = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplateApproved).FirstOrDefault();
if (typeTemplateApproved == null)
{
return DataErrorCode.Error_NoTemplateMail;
}
var lastApprover = lstApprover.Where(s => s.ProfileID == record.ProfileID && s.ApprovedID != null).OrderByDescending(s => s.OrderNo).FirstOrDefault();
var userInfo = repoSys_UserInfo.GetAll().Where(s => s.IsDelete == null && s.ID == lastApprover.ApprovedID.Value).FirstOrDefault();
var lastProfileEntity = lstProfile.Where(s => userInfo != null && userInfo.ProfileID.Value == s.ID).FirstOrDefault();
var profileEntity = lstProfile.Where(s => record.ProfileID != null && record.ProfileID.Value == s.ID).FirstOrDefault();
if (profileEntity != null)
{
var jobTitleEntity = lstJobTitle.Where(s => profileEntity.JobTitleID != null && s.ID == profileEntity.JobTitleID.Value).FirstOrDefault();
var orgEntity = lstOrg.Where(s => profileEntity.OrgStructureID != null && s.ID == profileEntity.OrgStructureID.Value).FirstOrDefault();
if (template != null)
{
string MailTo = profileEntity.Email;
string urlClickHere = host + "#Hrm_Main_Web/Fin_SendMailApprovedCashAdvance/DetailTravelRequest/" + recordID + "#NewTab";
try
{
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_PROFILENAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_JOBTITLE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_AREA.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_USERINFONAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCENAME.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_CASHADVANCECODE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_TOTALADVANCE.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_DENIES.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_LINKCONTENT.ToString(),
EnumDropDown.EmailType_APPROVED_CASHADVANCE.E_REJECTLINK.ToString(),
};
strsParaValues = new string[]
{
lastProfileEntity != null? lastProfileEntity.ProfileName : string.Empty,
jobTitleEntity != null ? jobTitleEntity.JobTitleName : string.Empty,
orgEntity != null ? orgEntity.OrgStructureName : string.Empty,
profileEntity.ProfileName,
record.CashAdvanceName,
record.Code != null ? record.Code:"" ,
totalItem.ToString(),
"Đã được duyệt.",
"",
""
};
string body = LibraryService.ReplaceContentFile(typeTemplateApproved.Content, strsParaKey, strsParaValues);
#endregion
string titleMail = typeTemplateApproved.Subject;
//.........這裏部分代碼省略.........
示例3: ProcessSendMailForFirstApprove
public string ProcessSendMailForFirstApprove(string host, Guid userId, Guid recordID)
{
DataErrorCode status = DataErrorCode.Success;
using (var context = new VnrHrmDataContext())
{
var Services = new BaseService();
var UserLogin = string.Empty;
string statusMess = string.Empty;
string type = ApproveType.E_FIN_CashAdvance.ToString();
string typeApprover = FinApproverType.Fin_CashAdvance.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var lstUserInfo = repoSys_UserInfo.GetAll().Where(s => s.IsDelete == null).ToList();
var userInfoEntity = lstUserInfo.Where(s => userId == s.ID).FirstOrDefault();
var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();
var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
var lstProfile = repoProfile.GetAll().Where(s => s.IsDelete == null).ToList();
var repoFIN_TravelRequest = new CustomBaseRepository<Fin_CashAdvance>(unitOfWork);
var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
if (record != null)
{
List<Guid> lstIds = new List<Guid>();
lstIds.Add(record.ID);
ActionApprovedAll(lstIds, "E_REQUEST", userId);
}
var repoCashItem = new CustomBaseRepository<Fin_CashAdvanceItem>(unitOfWork);
var totalItem = repoCashItem.GetAll().Where(s => s.IsDelete == null && s.CashAdvanceID != null && s.CashAdvanceID.Value == recordID).Sum(s => s.Amount);
var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);
var lstApprover = repoFin_Approver.GetAll().Where(s => s.IsDelete == null).ToList();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
string _typeTemplate = EnumDropDown.EmailType.E_REQUEST_CASHADVANCE.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (userInfoEntity != null)
{
var profileInfoEntity = lstProfile.Where(s => s.ID == userInfoEntity.ProfileID.Value).FirstOrDefault();
var jobTitleEntity = lstJobTitle.Where(s => profileInfoEntity.JobTitleID != null && s.ID == profileInfoEntity.JobTitleID.Value).FirstOrDefault();
var orgEntity = lstOrg.Where(s => profileInfoEntity.OrgStructureID != null && s.ID == profileInfoEntity.OrgStructureID.Value).FirstOrDefault();
var lstApproverByClaim = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover && s.ApprovedID != null).OrderBy(s => s.OrderNo).ToList();
var approvedEntity = new FIN_ApproverECLAIM();
// var firstApprover = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover).OrderBy(s => s.OrderNo).FirstOrDefault();
var firstApprover = lstApproverByClaim.FirstOrDefault();
foreach (var item in lstApproverByClaim)
{
if (firstApprover.OrderNo == item.OrderNo)
{
continue;
}
approvedEntity = item;
break;
}
// var userIdSecondApprover = lstApprover.Where(s => s.ProfileID == userInfoEntity.ProfileID && s.ApprovedType == typeApprover && s.OrderNo == 2).FirstOrDefault();
var userIdSecondApprover = lstApprover.Where(s => s.ID == approvedEntity.ID).FirstOrDefault();
if (firstApprover != null)
{
var userEnityByProfileID = lstUserInfo.Where(s => s.ID == firstApprover.ApprovedID.Value).FirstOrDefault();
var profileEntity = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userEnityByProfileID.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref statusMess).FirstOrDefault();
if (profileEntity != null)
{
if (userIdSecondApprover != null)
{
if (template != null)
{
string MailTo = profileEntity.Email;
string urlClickHere = host + "#Hrm_Main_Web/Fin_SendMailApprovedCashAdvance/DetailTravelRequest/" + recordID + "#NewTab";
string linkcontent = string.Empty;
string linkcontentReject = string.Empty;
var temp = lstUserInfo.Where(s => s.ID == userIdSecondApprover.ApprovedID.Value).FirstOrDefault();
var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;
linkcontent += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessApprovedPage"
+ "?loginID=" + firstApprover.ApprovedID
+ "&userApprovedID=" + userIdSecondApprover.ID
+ "&recordID=" + recordID
+ "'>đây" + "<a/>" + " để đồng ý.";
linkcontentReject += "Nhấn vào " + "<a href='" + host + "Fin_SendMailApprovedCashAdvance/ProcessRejectPage"
+ "?loginID=" + firstApprover.ApprovedID
+ "&userApprovedID=" + userIdSecondApprover.ID
//.........這裏部分代碼省略.........
示例4: Set_RejectRoster_ByModuleApprove
public string Set_RejectRoster_ByModuleApprove(string host, List<Guid> lstRoster, Guid UserLoginID, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string status = string.Empty;
string statusSendMail = DataErrorCode.Error.ToString();
BaseService service = new BaseService();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoAtt_Roster = new CustomBaseRepository<Att_Roster>(unitOfWork);
#region getdata
List<object> lstParamUser = new List<object>();
lstParamUser.AddRange(new object[4]);
lstParamUser[3] = Int32.MaxValue;
var lstUserAll = service.GetData<Sys_UserInfo>(lstParamUser, ConstantSql.hrm_sys_sp_get_users, userLogin, ref status);
var lstUser = lstUserAll.Where(m => !string.IsNullOrEmpty(m.Email)).Select(m => new { m.ID, m.Email }).ToList();
#endregion
#region process
string E_REJECTED = RosterStatus.E_REJECTED.ToString();
List<Att_Roster> lstRosterSendMail = new List<Att_Roster>();
foreach (var rosID in lstRoster)
{
var Roster = repoAtt_Roster.GetById(rosID);
lstRosterSendMail.Add(Roster);
Roster.Status = E_REJECTED;
}
var stt = repoAtt_Roster.SaveChanges();
#endregion
if (stt == DataErrorCode.Success)
{
#region getdata
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
List<Sys_TemplateSendMail> template = new List<Sys_TemplateSendMail>();
Sys_TemplateSendMail tempApprove = new Sys_TemplateSendMail();
Sys_TemplateSendMail tempReturn = new Sys_TemplateSendMail();
string[] strsParaKey = null;
string bodyContent = null;
string titleMail = null;
string[] strsParaValues = null;
string[] strsParaValues_Return = null;
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_ROSTER.ToString();
string _typeTemplate_return = EnumDropDown.EmailType.E_APPROVED_ROSTER_RETURN.ToString();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate || s.Type == _typeTemplate_return).ToList();
if (template.Count < 2)
return DataErrorCode.Error_NoTemplateMail.ToString();
tempApprove = template.Where(s => s.Type == _typeTemplate).FirstOrDefault();
tempReturn = template.Where(s => s.Type == _typeTemplate_return).FirstOrDefault();
string proIDS = string.Join(",", lstRosterSendMail.Select(s => s.ProfileID.ToString()).Distinct().ToList());
proIDS = Common.DotNetToOracle(proIDS);
lstProfile = GetData<Hre_ProfileEntity>(proIDS, ConstantSql.hrm_hr_sp_get_ProfileByIds, userLogin, ref status);
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_ROSTER.E_UserName.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_ProfileName.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_CodeEmp.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_DateStart.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_DateEnd.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_Status.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_Type.ToString(),
EnumDropDown.EmailType_APPROVED_ROSTER.E_LinkContent.ToString(),
};
#endregion
foreach (var Roster in lstRosterSendMail)
{
List<Guid> lstDelegateApproveUserID = new List<Guid>();
var UserRegister = lstUserAll.Where(m => m.ProfileID == Roster.ProfileID).FirstOrDefault();
if (UserRegister != null)
{
lstDelegateApproveUserID.Add(UserRegister.ID);
}
lstDelegateApproveUserID = lstDelegateApproveUserID.Distinct().ToList();
var lstUserInfoCanView = lstUser.Where(m => lstDelegateApproveUserID.Contains(m.ID)).ToList();
List<Att_EmailRequireEntity> lstEmailRequire = new List<Att_EmailRequireEntity>();
foreach (var UserInfoCanView in lstUserInfoCanView)
{
if (UserInfoCanView.Email == null)
continue;
Att_EmailRequireEntity EmailRequireEntity = new Att_EmailRequireEntity();
EmailRequireEntity.IdObject = Roster.ID;
EmailRequireEntity.EmailUserApprove = UserInfoCanView.Email;
EmailRequireEntity.IdUserApprove = UserInfoCanView.ID;
if (UserRegister != null && UserInfoCanView.ID == UserRegister.ID)
{
EmailRequireEntity.IsRegister = true;
//.........這裏部分代碼省略.........
示例5: SendMail_ToNextApproved
/// <summary>
/// Hieu.Van
/// Gửi mail duyệt
/// recordID : ID bản ghi
/// userApprovedID : Id ngưởi nhận dc mail
/// currentStatus : trạng thái hiện tại của bản ghi
/// type : ApproveType.E_FIN_PurchaseRequest
/// </summary>
/// <param name="recordID"></param>
/// <param name="userApprovedID"></param>
/// <param name="currentStatus"></param>
/// <param name="type"></param>
/// <returns></returns>
public DataErrorCode SendMail_ToNextApproved(string host, Guid recordID, Guid userApprovedID, string currentStatus, string type)
{
using (var context = new VnrHrmDataContext())
{
var Services = new BaseService();
var UserLogin = string.Empty;
string status = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_PURCHASEREQUEST.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return DataErrorCode.Error_NoTemplateMail;
var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
var lstUserInfo = repoSys_UserInfo.FindBy(s => s.ID != null).ToList();
var userInfo = lstUserInfo.Where(s => s.ID == userApproved.UserApproveID).FirstOrDefault();
var Profile = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == currentStatus).FirstOrDefault();
var record = GetData<FIN_PurchaseRequestEntity>(recordID, ConstantSql.hrm_hr_sp_get_PurchaseRequestById, UserLogin, ref status).FirstOrDefault();
double total = record.Total != null ? record.Total.Value : 0.0;
List<ElementFormula> listFomula = new List<ElementFormula>();
ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
listFomula.Add(FomulaItem);
listFomula.Add(statusItem);
string nextStatus = Services.GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();
var lstUserApprovedNextStatus = repoSys_UserApprove.FindBy(s => s.IsDelete == null && s.Type == type && s.CurrentStatus == nextStatus).ToList();
var RequestUserInfo = lstUserInfo.Where(s => s.ID == record.UserCreateID).FirstOrDefault();
string MailTo = Profile.Email;
try
{
string urlClickHere = host + "#Hrm_Main_Web/Fin_ApprovedPurchaseRequest/DetailPurchaseRequest/" + recordID + "#NewTab";
string dateFrom = record.From != null ? record.From.Value.ToString(ConstantFormat.HRM_Format_DayMonthYear.ToString()) : "...";
string dateTo = record.To != null ? record.To.Value.ToString(ConstantFormat.HRM_Format_DayMonthYear.ToString()) : "...";
#region process Link Content
string linkcontent = string.Empty;
foreach (var item in lstUserApprovedNextStatus)
{
var temp = lstUserInfo.Where(s => s.ID == item.UserApproveID).FirstOrDefault();
var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;
linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessApprovedPage"
+ "?loginID=" + userInfo.ID
+ "&userApprovedID=" + item.ID
+ "&recordID=" + recordID
+ "'>Click this link to approve and forward to '" + name + "'<a/><br /><br />";
}
// trường hợp duyệt không có cấp cao hơn userApprovedID Guid.Empty
if (lstUserApprovedNextStatus == null)
{
linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessApprovedPage"
+ "?loginID=" + userInfo.ID
+ "&userApprovedID=" + Guid.Empty
+ "&recordID=" + recordID
+ "'>Click this link to approve<a/><br /><br />";
}
linkcontent += "<a href='" + host + "Fin_ApprovedPurchaseRequest/ProcessRejectPage"
+ "?loginID=" + userInfo.ID
+ "&recordID=" + recordID
+ "'>Click this link to reject<a/><br /><br />";
linkcontent += "<a href='" + urlClickHere + "'>Click this link to view detail information and approve or reject<a/> <br /> ";
#endregion
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_PROFILENAME.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_USERINFONAME.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_FUNCTIONNAME.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_BUDGETOWNERNAME.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_SUPPLIERNAME.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_BUDGETCHARGEDIN.ToString(),
EnumDropDown.EmailType_APPROVED_PURCHASEREQUEST.E_FROMTO.ToString(),
//.........這裏部分代碼省略.........
示例6: GetEmailToSend_Overtime
public string GetEmailToSend_Overtime(List<Att_OvertimeEntity> lstOvertime, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
DateTime today = DateTime.Today;
string statusSendMail = DataErrorCode.Error.ToString();
string E_OVERTIME = DelegateApproveType.E_OVERTIME.ToString();
BaseService service = new BaseService();
string status = string.Empty;
#region Process get lstEmail
List<object> lstParamUser = new List<object>();
lstParamUser.AddRange(new object[4]);
lstParamUser[3] = Int32.MaxValue;
var lstUserAll = service.GetData<Sys_UserInfo>(lstParamUser, ConstantSql.hrm_sys_sp_get_users, userLogin, ref status);
List<object> lstParam = new List<object>();
lstParam.AddRange(new object[10]);
var lstDelegateApprove = service.GetData<Sys_DelegateApprove>(lstParam, ConstantSql.hrm_sys_sp_get_DelegateApprove, userLogin, ref status);
List<Att_EmailRequireEntity> lstEmailRequire = new List<Att_EmailRequireEntity>();
foreach (var item in lstOvertime)
{
List<Guid> UserApproveByItem = new List<Guid>();
if (item.UserApproveID != null)
{
UserApproveByItem.Add(item.UserApproveID);
}
if (item.UserApproveID2 != null)
{
UserApproveByItem.Add(item.UserApproveID2.Value);
}
List<Guid> lstUserCanView = lstDelegateApprove.Where(m => m.UserID != null
&& m.DataTypeDelegate == E_OVERTIME
&& m.DateFrom <= today
&& m.DateTo >= today
&& m.UserID != null
&& UserApproveByItem.Contains(m.UserID.Value)).Select(m => m.UserDelegateID.Value).ToList();
lstUserCanView.AddRange(UserApproveByItem);
var UserInfoRegisterID = lstUserAll.Where(m => m.ProfileID == item.ProfileID).Select(m => m.ID).FirstOrDefault();
if (UserInfoRegisterID != null && UserInfoRegisterID != Guid.Empty)
{
lstUserCanView.Add(UserInfoRegisterID);
}
lstUserCanView = lstUserCanView.Distinct().ToList();
var lstUserInfoCanView = lstUserAll.Where(m => lstUserCanView.Contains(m.ID)).ToList();
foreach (var UserInfoCanView in lstUserInfoCanView)
{
if (UserInfoCanView.Email == null)
continue;
Att_EmailRequireEntity EmailRequireEntity = new Att_EmailRequireEntity();
EmailRequireEntity.IdObject = item.ID;
EmailRequireEntity.EmailUserApprove = UserInfoCanView.Email;
EmailRequireEntity.IdUserApprove = UserInfoCanView.ID;
if (UserInfoRegisterID != null && UserInfoRegisterID != Guid.Empty && UserInfoCanView.ID == UserInfoRegisterID)
{
EmailRequireEntity.IsRegister = true;
}
lstEmailRequire.Add(EmailRequireEntity);
}
}
#endregion
#region get Template
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
List<Sys_TemplateSendMail> template = new List<Sys_TemplateSendMail>();
Sys_TemplateSendMail tempApprove = new Sys_TemplateSendMail();
Sys_TemplateSendMail tempReturn = new Sys_TemplateSendMail();
string[] strsParaKey = null;
string bodyContent = null;
string titleMail = null;
string[] strsParaValues = null;
string[] strsParaValues_Return = null;
if (lstOvertime.Count > 0)
{
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_OVERTIME.ToString();
string _typeTemplate_return = EnumDropDown.EmailType.E_APPROVED_OVERTIME_RETURN.ToString();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate || s.Type == _typeTemplate_return).ToList();
if (template.Count < 2)
return DataErrorCode.Error_NoTemplateMail.ToString();
tempApprove = template.Where(s => s.Type == _typeTemplate).FirstOrDefault();
tempReturn = template.Where(s => s.Type == _typeTemplate_return).FirstOrDefault();
string proIDS = string.Join(",", lstOvertime.Select(s => s.ProfileID.ToString()).Distinct().ToList());
proIDS = Common.DotNetToOracle(proIDS);
lstProfile = GetData<Hre_ProfileEntity>(proIDS, ConstantSql.hrm_hr_sp_get_ProfileByIds, userLogin, ref status);
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_OVERTIME.E_UserName.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_ProfileName.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_CodeEmp.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_OrgStructureName.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_WorkDate.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_RegisterHours.ToString(),
EnumDropDown.EmailType_APPROVED_OVERTIME.E_ReasonOT.ToString(),
//.........這裏部分代碼省略.........
示例7: Set_ApproveLeaveDay_ByModuleApprove
public string Set_ApproveLeaveDay_ByModuleApprove(string host, List<Guid> lstLeaveDay, Guid UserLoginID, string userLogin)
{
using (var context = new VnrHrmDataContext())
{
string status = string.Empty;
string statusSendMail = DataErrorCode.Error.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
BaseService service = new BaseService();
var repoAtt_LeaveDay = new CustomBaseRepository<Att_LeaveDay>(unitOfWork);
#region getdata
List<object> lstParamUser = new List<object>();
lstParamUser.AddRange(new object[4]);
lstParamUser[3] = Int32.MaxValue;
var lstUserAll = service.GetData<Sys_UserInfo>(lstParamUser, ConstantSql.hrm_sys_sp_get_users, userLogin, ref status);
var lstUser = lstUserAll.Where(m => !string.IsNullOrEmpty(m.Email)).Select(m => new { m.ID, m.Email }).ToList();
//Step1 : Check 1 Approve or 2 approve
DateTime today = DateTime.Today;
string E_LEAVEDAY = DelegateApproveType.E_LEAVE_DAY.ToString();
List<object> lstParam = new List<object>();
lstParam.AddRange(new object[10]);
var lstDelegateApproveAll = service.GetData<Sys_DelegateApprove>(lstParam, ConstantSql.hrm_sys_sp_get_DelegateApprove, userLogin, ref status);
var lstDelegateApprove = lstDelegateApproveAll.Where(m => m.UserID != null
&& m.UserDelegateID != null
&& m.DataTypeDelegate == E_LEAVEDAY
&& m.DateFrom <= today
&& m.DateTo >= today).ToList();
List<Guid> lstUserCanView = lstDelegateApprove.Where(m => m.UserDelegateID == UserLoginID).Select(m => m.UserID.Value).ToList();
lstUserCanView.Add(UserLoginID);
#endregion
#region process
string E_APPROVED = LeaveDayStatus.E_APPROVED.ToString();
string E_FIRST_APPROVED = LeaveDayStatus.E_FIRST_APPROVED.ToString();
List<Att_LeaveDay> lstLeaveDaySendMail = new List<Att_LeaveDay>();
foreach (var leaID in lstLeaveDay)
{
var LeaveDay = repoAtt_LeaveDay.GetById(leaID);
lstLeaveDaySendMail.Add(LeaveDay);
if (LeaveDay.UserApproveID2 != null && lstUserCanView.Contains(LeaveDay.UserApproveID2.Value))
{
LeaveDay.Status = E_APPROVED;
}
if (LeaveDay.UserApproveID != null && lstUserCanView.Contains(LeaveDay.UserApproveID.Value))
{
LeaveDay.Status = E_FIRST_APPROVED;
}
}
var stt = repoAtt_LeaveDay.SaveChanges();
#endregion
if (stt == DataErrorCode.Success)
{
#region getdata
List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
List<Sys_TemplateSendMail> template = new List<Sys_TemplateSendMail>();
Sys_TemplateSendMail tempApprove = new Sys_TemplateSendMail();
Sys_TemplateSendMail tempReturn = new Sys_TemplateSendMail();
List<Cat_LeaveDayType> lstLeaveDayType = new List<Cat_LeaveDayType>();
string[] strsParaKey = null;
string bodyContent = null;
string titleMail = null;
string[] strsParaValues = null;
string[] strsParaValues_Return = null;
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_LEAVEDAY.ToString();
string _typeTemplate_return = EnumDropDown.EmailType.E_APPROVED_LEAVEDAY_RETURN.ToString();
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate || s.Type == _typeTemplate_return).ToList();
if (template.Count < 2)
return DataErrorCode.Error_NoTemplateMail.ToString();
var repoCat_LeaveDayType = new CustomBaseRepository<Cat_LeaveDayType>(unitOfWork);
lstLeaveDayType = repoCat_LeaveDayType.FindBy(s => s.IsDelete == null).ToList();
tempApprove = template.Where(s => s.Type == _typeTemplate).FirstOrDefault();
tempReturn = template.Where(s => s.Type == _typeTemplate_return).FirstOrDefault();
string proIDS = string.Join(",", lstLeaveDaySendMail.Select(s => s.ProfileID.ToString()).Distinct().ToList());
proIDS = Common.DotNetToOracle(proIDS);
lstProfile = GetData<Hre_ProfileEntity>(proIDS, ConstantSql.hrm_hr_sp_get_ProfileByIds, userLogin, ref status);
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_UserName.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_ProfileName.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_CodeEmp.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_DateStart.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_DateEnd.ToString(),
EnumDropDown.EmailType_APPROVED_LEAVEDAY.E_Status.ToString(),
//.........這裏部分代碼省略.........
示例8: SendMailContract
/// <summary>
/// HieuVan
/// Hàm xử lý tự động send mail hợp đồng đến hạn
/// </summary>
public static void SendMailContract()
{
BaseService _base = new BaseService();
string status = string.Empty;
string fullPath = string.Empty;
List<Hre_ContractSendMailEntity> lstProbation = new List<Hre_ContractSendMailEntity>();
List<Hre_ContractEntity> lstAttach = new List<Hre_ContractEntity>();
Hre_ContractEntity attach = new Hre_ContractEntity();
DateTime DS = DateTime.Now;
DateTime DE = DateTime.Now;
List<object> lstParam = new List<object>();
lstParam.AddRange(new object[3]);
var dataProfile = _base.GetData<Hre_ProfileEntity>(lstParam, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, string.Empty, ref status);
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoHre_Contract = new CustomBaseRepository<Hre_Contract>(unitOfWork);
var repoCat_ContractType = new CustomBaseRepository<Cat_ContractType>(unitOfWork);
var repoCat_Export = new CustomBaseRepository<Cat_Export>(unitOfWork);
var repoCat_OrgStructure = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
var repoCat_OrgStructureType = new CustomBaseRepository<Cat_OrgStructureType>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
string _typeTemplate = EnumDropDown.EmailType.E_WARNINGCONTRACT.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return;
var dataContractType = repoCat_ContractType.FindBy(s => s.ID != null).ToList();
var dataContract = repoHre_Contract.FindBy(s => s.IsDelete == null).ToList();
var dataOrgStructure = repoCat_OrgStructure.FindBy(s => s.IsDelete == null).ToList();
var dataOrgStructureType = repoCat_OrgStructureType.FindBy(s => s.IsDelete == null).ToList();
// lọc từng hợp đồng, kiểm tra những hợp đồng nào đến hạn
Hre_ContractSendMailEntity entity = new Hre_ContractSendMailEntity();
List<string> lstTemp = new List<string>();
foreach (var item in dataContract)
{
lstTemp = new List<string>();
entity = new Hre_ContractSendMailEntity();
if (item.DateEnd == null)
continue;
var contractType = dataContractType.Where(s => s.ID == item.ContractTypeID).FirstOrDefault();
int loop = contractType.ExpiryContractLoop != null ? contractType.ExpiryContractLoop.Value : 0;
int dbd = contractType.ExpiryContractDayByDay != null ? contractType.ExpiryContractDayByDay.Value : 0;
DateTime loopStart = DateTime.Now.AddDays(loop);
DateTime dbdStart = DateTime.Now.AddDays(dbd);
if ((dbdStart >= item.DateEnd.Value || item.DateEnd.Value <= DateTime.Now) && item.ContractResult == null)
{
attach = item.Copy<Hre_ContractEntity>();
var profile = dataProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
entity.ContractID = item.ID;
entity.DayDue = item.DateEnd;
entity.ProfileName = profile.ProfileName;
attach.ProfileName = profile.ProfileName;
attach.CodeEmp = profile.CodeEmp;
entity.Type = EnumDropDown.ExpiredContractType.E_DayByDay.ToString();
if (contractType.EmailToList != null)
{
var lstCodeOrg = contractType.EmailToList.Split(',').ToList();
foreach (var itemCO in lstCodeOrg)
{
var temp = LibraryService.GetNearestParent(profile.OrgStructureID, (OrgUnit)Enum.Parse(typeof(OrgUnit), itemCO, true), dataOrgStructure, dataOrgStructureType);
if (temp == null || temp.Email == null)
continue;
var mailOfOrg = temp.Email.Split(',').ToList();
lstTemp.AddRange(mailOfOrg);
}
}
if (!string.IsNullOrEmpty(contractType.EmailOther))
{
var lstEmailOther = contractType.EmailOther.Split(',').ToList();
lstTemp.AddRange(lstEmailOther);
}
if (lstTemp != null)
entity.lstEmail = lstTemp;
lstAttach.Add(attach);
lstProbation.Add(entity);
}
else if ((loopStart >= item.DateEnd.Value || item.DateEnd.Value <= DateTime.Now) && item.ContractResult == null)
{
attach = item.Copy<Hre_ContractEntity>();
if (DateTime.Now.Day != contractType.DayInMonthLoop1 && DateTime.Now.Day != contractType.DayInMonthLoop2 && DateTime.Now.Day != contractType.DayInMonthLoop3)
continue;
var profile = dataProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
entity.ContractID = item.ID;
entity.DayDue = item.DateEnd;
entity.ProfileName = profile.ProfileName;
attach.ProfileName = profile.ProfileName;
attach.CodeEmp = profile.CodeEmp;
entity.Type = EnumDropDown.ExpiredContractType.E_Loop.ToString();
if (contractType.EmailToList != null)
//.........這裏部分代碼省略.........
示例9: SendMailCandidateFail
public bool SendMailCandidateFail(List<Guid> candidateIds, bool isPass)
{
var isSuccess = false;
#region template
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoRecCandidate = new Rec_CandidateRepository(unitOfWork);
var candidates = unitOfWork.CreateQueryable<Rec_Candidate>(Guid.Empty, m => candidateIds.Contains(m.ID)).ToList();
var jobVacancyIds = candidates.Select(m => m.JobVacancyID).ToList();
var jobVacancyObjs = unitOfWork.CreateQueryable<Rec_JobVacancy>(Guid.Empty, m => jobVacancyIds.Contains(m.ID)).Select(m => new {
m.ID,m.JobVacancyName
}).ToList();
string _typeTemplate = EnumDropDown.EmailType.E_NOTIFYCANDIDATEFAIL.ToString();
var template = unitOfWork.CreateQueryable<Sys_TemplateSendMail>(Guid.Empty, m => m.Type == _typeTemplate).FirstOrDefault();
if (template == null)
{
return false;
}
else
{
BaseService _base = new BaseService();
foreach (var item in candidates)
{
#region set so lan goi email
if (item.NoEmailFail == null)
{
item.NoEmailFail = 0;
}
if (item.NoEmailPass == null)
{
item.NoEmailPass = 0;
}
if (isPass)
{
item.NoEmailPass++;
}
else
{
item.NoEmailFail++;
}
#endregion
string title = template.Subject;
#region mergeData
var jobVancancyName = jobVacancyObjs.Where(m => m.ID == item.JobVacancyID).Select(m => m.JobVacancyName).FirstOrDefault();
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailCandidateParam.E_CandidateName.ToString(),
EnumDropDown.EmailCandidateParam.E_CodeCandidate.ToString(),
EnumDropDown.EmailCandidateParam.E_ReasonFailFilter.ToString(),
EnumDropDown.EmailCandidateParam.E_WorkplaceSuggestion.ToString(),
EnumDropDown.EmailCandidateParam.E_JobVacancyID.ToString(),
EnumDropDown.EmailCandidateParam.E_NoEmailPass.ToString(),
EnumDropDown.EmailCandidateParam.E_NoEmailFail.ToString(),
};
strsParaValues = new string[]
{
item.CandidateName,
item.CodeCandidate,
item.ReasonFailFilter,
item.WorkplaceSuggestion,
jobVancancyName,
item.NoEmailPass.ToString(),
item.NoEmailFail.ToString()
};
string body = LibraryService.ReplaceContentFile(template.Content, strsParaKey, strsParaValues);
isSuccess = _base.SendMail(title, item.Email, body, string.Empty);
#endregion
}
if (candidates.Any())
{
repoRecCandidate.Edit(candidates);
repoRecCandidate.SaveChanges();
}
}
}
#endregion
return isSuccess;
}
示例10: SendMail_ToNextApproved
/// <summary>
/// Hieu.Van
/// Gửi mail duyệt
/// recordID : ID bản ghi
/// userApprovedID : Id ngưởi nhận dc mail
/// currentStatus : trạng thái hiện tại của bản ghi
/// type : ApproveType.E_FIN_Claim
/// </summary>
/// <param name="recordID"></param>
/// <param name="userApprovedID"></param>
/// <param name="currentStatus"></param>
/// <param name="type"></param>
/// <returns></returns>
public DataErrorCode SendMail_ToNextApproved(string host, Guid recordID, Guid userApprovedID, string currentStatus, string type)
{
using (var context = new VnrHrmDataContext())
{
var Services = new BaseService();
var UserLogin = string.Empty;
string status = string.Empty;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
string _typeTemplate = EnumDropDown.EmailType.E_APPROVED_CLAIM.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return DataErrorCode.Error_NoTemplateMail;
var userApproved = repoSys_UserApprove.FindBy(s => s.ID == userApprovedID).FirstOrDefault();
var lstUserInfo = repoSys_UserInfo.FindBy(s => s.ID != null).ToList();
var userInfo = lstUserInfo.Where(s => s.ID == userApproved.UserApproveID).FirstOrDefault();
var Profile = GetData<Hre_ProfileEntity>(Common.DotNetToOracle(userInfo.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
var configProcess = repoSys_ConfigProcessApprove.FindBy(s => s.IsDelete == null && s.Function == type && s.CurrentStatus == currentStatus).FirstOrDefault();
var record = GetData<FIN_ClaimEntity>(recordID, ConstantSql.hrm_hr_sp_get_ClaimById, UserLogin, ref status).FirstOrDefault();
double total = record.Total != null ? record.Total.Value : 0.0;
List<ElementFormula> listFomula = new List<ElementFormula>();
ElementFormula FomulaItem = new ElementFormula("Total", total, 0);
ElementFormula statusItem = new ElementFormula(configProcess.NextStatusFormular, configProcess.NextStatusFormular, 1);
listFomula.Add(FomulaItem);
listFomula.Add(statusItem);
string nextStatus = Services.GetObjectValue(new List<Cat_ElementEntity>(), listFomula, configProcess.NextStatusFormular).ToString();
var lstUserApprovedNextStatus = repoSys_UserApprove.FindBy(s => s.IsDelete == null && s.Type == type && s.CurrentStatus == nextStatus).ToList();
var RequestUserInfo = lstUserInfo.Where(s => s.ID == record.UserCreateID).FirstOrDefault();
string MailTo = Profile.Email;
try
{
string urlClickHere = host + "##Hrm_Main_Web/Fin_ApprovedClaim/DetailClaim/" + recordID + "#NewTab";
#region process Link Content
string linkcontent = string.Empty;
foreach (var item in lstUserApprovedNextStatus)
{
var temp = lstUserInfo.Where(s => s.ID == item.UserApproveID).FirstOrDefault();
var name = temp.UserInfoName != null ? temp.UserInfoName : temp.UserLogin;
linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessApprovedPage"
+ "?loginID=" + userInfo.ID
+ "&userApprovedID=" + item.ID
+ "&recordID=" + recordID
+ "'>Click this link to approve and forward to '" + name + "'<a/><br /><br />";
}
// trường hợp duyệt không có cấp cao hơn userApprovedID Guid.Empty
if (lstUserApprovedNextStatus == null)
{
linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessApprovedPage"
+ "?loginID=" + userInfo.ID
+ "&userApprovedID=" + Guid.Empty
+ "&recordID=" + recordID
+ "'>Click this link to approve<a/><br /><br />";
}
linkcontent += "<a href='" + host + "Fin_ApprovedClaim/ProcessRejectPage"
+ "?loginID=" + userInfo.ID
+ "&recordID=" + recordID
+ "'>Click this link to reject<a/><br /><br />";
linkcontent += "<a href='" + urlClickHere + "'>Click this link to view detail information and approve or reject<a/> <br /> ";
#endregion
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_CLAIM.E_PROFILENAME.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_USERINFONAME.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_CLAIMNAME.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_CLAIMCODE.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_TRAVELREQUESTNAME.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_ACCOUNTCODE.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_TOTAL.ToString(),
EnumDropDown.EmailType_APPROVED_CLAIM.E_STATUS.ToString(),
//.........這裏部分代碼省略.........
示例11: SendMailEvalution
public static void SendMailEvalution()
{
BaseService _base = new BaseService();
string status = string.Empty;
List<object> lstParam = new List<object>();
lstParam.AddRange(new object[3]);
var dataProfile = _base.GetData<Hre_ProfileEntity>(lstParam, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, string.Empty, ref status);
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
try
{
#region get config cycle Evalution
var dataSys_AllSetting = unitOfWork.CreateQueryable<Sys_AllSetting>(Guid.Empty).Select(s => new { s.ID, s.Name, s.Value1 }).ToList();
var empEva = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_ISEMPLOYEEEVALUATION.ToString()).FirstOrDefault();
var userEva1 = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_ISUSERAPPROVEVALUATION1.ToString()).FirstOrDefault();
var userEva2 = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_ISUSERAPPROVEVALUATION2.ToString()).FirstOrDefault();
var isCycle = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_ISCYCLE.ToString()).FirstOrDefault();
var cycleDay1 = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_CYCLE_DAY1.ToString()).FirstOrDefault();
var cycleDay2 = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_CYCLE_DAY2.ToString()).FirstOrDefault();
var cycleDay3 = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_BYCYCLE_DAY3.ToString()).FirstOrDefault();
var isTime = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_ISTIME.ToString()).FirstOrDefault();
var from = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_TIME_DATEFROM.ToString()).FirstOrDefault();
var to = dataSys_AllSetting.Where(s => s.Name == AppConfig.HRM_EVA_CONFIG_EMAIL_TIME_DATETO.ToString()).FirstOrDefault();
if ((isCycle.Value1 == null || isCycle.Value1 == false.ToString()) && (isTime.Value1 == null || isTime.Value1 == false.ToString()))
{
return;
}
else if (isCycle.Value1 == true.ToString())
{
if (!(isCycle.Value1 == true.ToString() && (
(cycleDay1.Value1 != null && int.Parse(cycleDay1.Value1) == DateTime.Today.Day)
|| (cycleDay2.Value1 != null && int.Parse(cycleDay2.Value1) == DateTime.Today.Day)
|| (cycleDay3.Value1 != null && int.Parse(cycleDay3.Value1) == DateTime.Today.Day))))
{
return;
}
}
else if (isTime.Value1 == true.ToString())
{
if (!(isTime.Value1 == true.ToString() && ((from.Value1 != null && int.Parse(from.Value1) <= DateTime.Today.Day) && (to.Value1 != null && int.Parse(to.Value1) >= DateTime.Today.Day))))
{
return;
}
}
#endregion
#region getdata
List<Eva_PerformanceEvaSendMailEntity> lstEvaLevel = new List<Eva_PerformanceEvaSendMailEntity>();
List<Eva_PerformanceEvaSendMailEntity> lstEvaLevel1 = new List<Eva_PerformanceEvaSendMailEntity>();
List<Eva_PerformanceEvaSendMailEntity> lstEvaLevel2 = new List<Eva_PerformanceEvaSendMailEntity>();
var dataEva_Performance = unitOfWork.CreateQueryable<Eva_Performance>(Guid.Empty, d => d.Status != PerformaceEvaStatus.E_APPROVE_END.ToString())
.Select(s => new { s.ID, s.ProfileID, s.Status, s.PerformanceTemplateID, s.PeriodFromDate, s.PeriodToDate }).ToList();
var dataEva_PerformanceEva = unitOfWork.CreateQueryable<Eva_PerformanceEva>(Guid.Empty, d => d.Status != PerformaceEvaStatus.E_APPROVE_END.ToString())
.Select(s => new Eva_PerformanceEvaSendMailEntity() { ID = s.ID, PerformanceID = s.PerformanceID, OrderEva = s.OrderEva, EvaluatorID = s.EvaluatorID, Status = s.Status }).ToList();
var dataEva_Evaluator = unitOfWork.CreateQueryable<Eva_Evaluator>(Guid.Empty).Select(s => new { s.ID, s.ProfileID, s.EvaluatorID, s.OrderNo }).ToList();
var dataEva_PerformanceTemplate = unitOfWork.CreateQueryable<Eva_PerformanceTemplate>(Guid.Empty).Select(s => new { s.ID, s.TemplateName }).ToList();
var profileOfPerformance = dataEva_Performance.Select(s => s.ProfileID).Distinct().ToList();
List<Hre_ProfileEntity> lstProEvalution = dataProfile.Where(s => profileOfPerformance.Contains(s.ID)).ToList();
#endregion
#region process Data Evalution
foreach (var profile in lstProEvalution)
{
var performByProfile = dataEva_Performance.Where(s => s.ProfileID == profile.ID).ToList();
if (performByProfile.Count == 0)
continue;
var performByProfileIDs = performByProfile.Select(s => s.ID).ToList();
var performEvaByProfile = dataEva_PerformanceEva.Where(s => s.PerformanceID != null && performByProfileIDs.Contains(s.PerformanceID.Value)).ToList();
foreach (var perform in performByProfile)
{
var performEva = performEvaByProfile.Where(s => s.PerformanceID == perform.ID).OrderBy(s => s.OrderEva).ToList();
foreach (var eva in performEva)
{
if (eva.Status == null || eva.Status == PerformaceEvaStatus.E_SEFT.ToString() || eva.Status == PerformaceEvaStatus.E_WAITING.ToString())
{
//var evaluator = dataEva_Evaluator.Where(s => s.ProfileID == perform.ProfileID && s.EvaluatorID == eva.EvaluatorID).FirstOrDefault();
eva.ProfileIDofEvaluator = eva.EvaluatorID;
if (performEva.IndexOf(eva) == 0)
{
lstEvaLevel.Add(eva);
break;
//.........這裏部分代碼省略.........
示例12: SendMaToNextApproved
public DataErrorCode SendMaToNextApproved(string host, Guid recordID, Guid userApprovedID)
{
using (var context = new VnrHrmDataContext())
{
string statusMess = string.Empty;
var UserLogin = string.Empty;
var Services = new BaseService();
string status = string.Empty;
string typeApprover = FinApproverType.FIN_TravelRequest_Domestic.ToString();
// string typeApprover2 = FinApproverType.FIN_TravelRequest_External.ToString();
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
var repoSys_UserApprove = new CustomBaseRepository<Sys_UserApprove>(unitOfWork);
var repoFin_Approver = new CustomBaseRepository<FIN_ApproverECLAIM>(unitOfWork);
var lstApprover = repoFin_Approver.GetAll().Where(s => s.IsDelete == null).ToList();
var repo_JobTitle = new CustomBaseRepository<Cat_JobTitle>(unitOfWork);
var lstJobTitle = repo_JobTitle.GetAll().Where(s => s.IsDelete == null).ToList();
var repoOrg = new CustomBaseRepository<Cat_OrgStructure>(unitOfWork);
var lstOrg = repoOrg.GetAll().Where(s => s.IsDelete == null).ToList();
var repoProfile = new CustomBaseRepository<Hre_Profile>(unitOfWork);
var lstProfile = repoProfile.GetAll().Where(s => s.IsDelete == null).ToList();
var repoSys_UserInfo = new CustomBaseRepository<Sys_UserInfo>(unitOfWork);
var repoSys_ConfigProcessApprove = new CustomBaseRepository<Sys_ConfigProcessApprove>(unitOfWork);
var repoSys_TemplateSendMail = new CustomBaseRepository<Sys_TemplateSendMail>(unitOfWork);
var repoFIN_TravelRequest = new CustomBaseRepository<FIN_TravelRequest>(unitOfWork);
var record = repoFIN_TravelRequest.FindBy(s => s.ID == recordID).FirstOrDefault();
var repoFin_TravelRequestItem = new CustomBaseRepository<FIN_TravelRequestItem>(unitOfWork);
var totalItem = repoFin_TravelRequestItem.FindBy(s => s.IsDelete == null && s.Description2.Contains("E_APPROVED") && s.TravelRequestID != null && s.TravelRequestID.Value == recordID).ToList();
string _typeTemplate = EnumDropDown.EmailType.E_REQUEST_TRAVELREQUEST.ToString();
var template = repoSys_TemplateSendMail.FindBy(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return DataErrorCode.Error_NoTemplateMail;
#region KT nếu là nguoi duyet cuoi thì gui email lại cho người yêu cầu duyệt
if (userApprovedID == Guid.Empty)
{
var flag = false;
var des = string.Empty;
foreach (var item in totalItem)
{
if(item.IsBookingHotel != null && item.IsBookingHotel == true)
{
flag = true;
des = item.Description;
}
}
if (record != null)
{
string _typeTemplateApproved = EnumDropDown.EmailType.E_APPROVED_TRAVELREQUEST.ToString();
var typeTemplateApproved = repoSys_TemplateSendMail.FindBy(s => s.IsDelete == null && s.Type == _typeTemplateApproved).FirstOrDefault();
if (typeTemplateApproved == null)
{
return DataErrorCode.Error_NoTemplateMail;
}
var lastApprover = lstApprover.Where(s => record.Type != null && s.ProfileID == record.ProfileID && s.ApprovedType == record.Type && s.ApprovedID != null).OrderByDescending(s => s.OrderNo).FirstOrDefault();
var userInfo = repoSys_UserInfo.FindBy(s => s.IsDelete == null && s.ID == lastApprover.ApprovedID.Value).FirstOrDefault();
var lastProfileEntity = lstProfile.Where(s => userInfo != null && userInfo.ProfileID.Value == s.ID).FirstOrDefault();
var profileEntity = lstProfile.Where(s => record.ProfileID != null && record.ProfileID.Value == s.ID).FirstOrDefault();
if (profileEntity != null)
{
var jobTitleEntity = lstJobTitle.Where(s => profileEntity.JobTitleID != null && s.ID == profileEntity.JobTitleID.Value).FirstOrDefault();
var orgEntity = lstOrg.Where(s => profileEntity.OrgStructureID != null && s.ID == profileEntity.OrgStructureID.Value).FirstOrDefault();
if(template != null)
{
string MailTo = profileEntity.Email;
string urlClickHere = host + "#Hrm_Main_Web/Fin_ApprovedTravelRequest/DetailTravelRequest/" + recordID + "#NewTab";
try
{
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_PROFILENAME.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_JOBTITLE.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_AREA.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_USERINFONAME.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_TRAVELREQUESTNAME.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_TRAVELREQUESTCODE.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_DENIES.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_LINKCONTENT.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_REJECTLINK.ToString(),
EnumDropDown.EmailType_APPROVED_TRAVELREQUEST.E_ISBOOKINGHOTEL.ToString(),
};
strsParaValues = new string[]
{
//.........這裏部分代碼省略.........
示例13: Execute
public void Execute()
{
if (!string.IsNullOrWhiteSpace(JobArgs))
{
BaseService service = new BaseService();
string status = string.Empty;
var taskArgs = JobArgs.Split('|');
JobType = taskArgs.Length > 0 ? taskArgs[0] : string.Empty;
var procedure = taskArgs.Length > 1 ? taskArgs[1] : string.Empty;
var email = taskArgs.Length > 2 ? taskArgs[2] : string.Empty;
try
{
if (procedure == "SendMailForgetTAMScanLog")
{
SendMailForgetTAMScanLog();
}
else if (procedure == "SendMailContract")
{
LibraryService.SendMailContract();
}
else if (procedure == "SendMailEvalution")
{
LibraryService.SendMailEvalution();
}
else
{
//Gọi lệnh thực thi câu stored procedure
service.ActionData(procedure,7200, ref status);
service.SendMail(JobType, email, status, "");
//SendMail(email, JobType, status);
//List<object> obj = new List<object>();
//service.UpdateData<Eva_EvalutionData>(obj, ConstantSql.hrm_vnr_RemoveEvalutionData, ref status);
}
}
catch (Exception ex)
{
//Gọi hàm gửi mail và throw exception để lớp dưới ghi log
//Sử dụng TaskName làm tiêu đề mail gửi đi + exception
// SendMail(email, JobType, ex.GetExceptionMessage());
service.SendMail(JobType, email, ex.GetExceptionMessage(), "");
throw;
}
}
}
示例14: SendMailForgetTAMScanLog
public static void SendMailForgetTAMScanLog()
{
using (var context = new VnrHrmDataContext())
{
BaseService _base = new BaseService();
string body2;
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
try
{
string _typeTemplate = EnumDropDown.EmailType.E_SENDMAILFORGETTAMSCANLOG.ToString();
var template = unitOfWork.CreateQueryable<Sys_TemplateSendMail>(s => s.Type == _typeTemplate).FirstOrDefault();
if (template == null)
return;
if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
{
return;
}
//Common.HostPath = System.Configuration.ConfigurationSettings.AppSettings["URLHost"].ToString();
var date1 = DateTime.Now;
if (date1.Day > 26)
{
date1 = date1.AddMonths(1);
}
DateTime dateStart = new DateTime(date1.Year, date1.Month, 26);
dateStart = dateStart.AddMonths(-1);
DateTime dateEnd = new DateTime(date1.Year, date1.Month, 25);
if (dateEnd >= DateTime.Now.Date)
{
dateEnd = DateTime.Now.Date.AddDays(-1);
}
dateEnd = dateEnd.AddDays(1).AddMilliseconds(-1);
var dayOffs = unitOfWork.CreateQueryable<Cat_DayOff>(s => dateStart <= s.DateOff && s.DateOff <= dateEnd).Select(s => s.DateOff).ToList();
var inOuts = unitOfWork.CreateQueryable<Att_Workday>(s => s.ShiftID != null && dateStart <= s.WorkDate && s.WorkDate <= dateEnd)
.Select(s => new { s.InTime1, s.ProfileID, s.ShiftID, s.OutTime1, s.WorkDate }).OrderByDescending(s => s.InTime1).ToList();
string status = ProfileStatusSyn.E_HIRE.ToString();
var profiles = unitOfWork.CreateQueryable<Hre_Profile>(s => s.Email != null && s.StatusSyn == status
&& (s.DateQuit == null || s.DateQuit > DateTime.Now)).ToList();
string key = AppConfig.E_SERVER_MAIL.ToString();
//Sys_AppConfig AppConfigServerSendMail = unitOfWork.CreateQueryable<Sys_AppConfig>(s => s.Info == key).FirstOrDefault();
//string host = AppConfigServerSendMail.Value1;
//string emailFrom = AppConfigServerSendMail.Value2;
//string pass = AppConfigServerSendMail.Value3;
//bool isSSL = false;
//string subject = System.Configuration.ConfigurationManager.AppSettings["SendMailInOut"];
//string emailTitle = System.Configuration.ConfigurationManager.AppSettings["SendMailInOut"];
//if (AppConfigServerSendMail.Value6 != null)
// bool.TryParse(AppConfigServerSendMail.Value6, out isSSL);
//int port = AppConfigServerSendMail.Value30.AsInt();
var shifts = unitOfWork.CreateQueryable<Cat_Shift>().ToList();
string approve = RosterStatus.E_APPROVED.ToString();
var rosters = unitOfWork.CreateQueryable<Att_Roster>(s => s.MonShiftID != null && s.DateStart <= dateEnd && dateStart <= s.DateEnd && s.Status == approve).ToList<Att_Roster>();
List<Hre_Profile> profileHasIns = profiles;
List<Att_Roster> lstRosterTypeGroup = new List<Att_Roster>();
List<Att_RosterGroup> lstRosterGroup = new List<Att_RosterGroup>();
var listHoliday = unitOfWork.CreateQueryable<Cat_DayOff>(s => dateStart <= s.DateOff && s.DateOff <= dateEnd).ToList<Cat_DayOff>();
string E_FIRST = PregnancyLeaveEarlyType.E_FIRST.ToString();
string E_LAST = PregnancyLeaveEarlyType.E_LAST.ToString();
var profileIDEarlys = unitOfWork.CreateQueryable<Att_Pregnancy>(s => (s.TypePregnancyEarly == E_FIRST || s.TypePregnancyEarly == E_LAST)
&& s.DateStart <= dateEnd && dateStart <= s.DateEnd).Select(s => s.ProfileID).ToList();
var approveKey = LeaveDayStatus.E_APPROVED.ToString();
var E_FULLSHIFT = LeaveDayDurationType.E_FULLSHIFT.ToString();
var leavdays = unitOfWork.CreateQueryable<Att_LeaveDay>(s => s.DateStart <= dateEnd && dateStart <= s.DateEnd && s.Status == approveKey)
.Select(s => new { s.ProfileID, s.DateStart, s.DateEnd, s.DurationType }).ToList();
var leavdaysFullShifts = leavdays.Where(s => s.DurationType == E_FULLSHIFT).ToList();
//string contenFile = File.ReadAllText(UIController.GetPath("~/TemplateTemp/InOutTemplate.html"));
string codeEmp = "85S";
if (codeEmp == null)
{
profiles = profiles.Where(s => s.CodeEmp == codeEmp).ToList();
}
var profileIDs = profileHasIns.Select(s => s.ID).ToList();
var grades = unitOfWork.CreateQueryable<Att_Grade>(s => s.MonthStart <= dateEnd).OrderByDescending(d => d.MonthStart)
.Select(d => new { d.ProfileID, d.MonthStart, d.GradeAttendanceID }).ToList();
List<Guid> gardeIDs = grades.Select(d => d.GradeAttendanceID.Value).ToList();
List<Cat_GradeAttendance> garCfgs = unitOfWork.CreateQueryable<Cat_GradeAttendance>(s => s.Code != "GENERAL DIRECTOR" && s.Code != "DIRECTOR").ToList();
garCfgs = garCfgs.Where(s => gardeIDs.Contains(s.ID)).ToList();
var workHistorys = unitOfWork.CreateQueryable<Hre_WorkHistory>(d => d.OrganizationStructureID != null && profileIDs.Contains(d.ProfileID)).ToList<Hre_WorkHistory>();
foreach (var profile in profileHasIns)
{
string body = string.Empty;
var isSend = false;
int index = 1;
var profileLeavesFullShifts = leavdaysFullShifts.Where(s => s.ProfileID == profile.ID).ToList();
List<DateTime> dateLeaveFullShits = new List<DateTime>();
foreach (var leavesFullShift in profileLeavesFullShifts)
{
for (DateTime date = leavesFullShift.DateStart; date <= leavesFullShift.DateEnd; date = date.AddDays(1))
{
dateLeaveFullShits.Add(date);
}
}
for (DateTime date = dateStart; date <= dateEnd; date = date.AddDays(1))
{
if (date < profile.DateHire)
{
continue;
//.........這裏部分代碼省略.........
示例15: ResetPasswordResponseEmail
/// <summary>Send Mail (reset password)</summary>
/// <param name="lstUserPasswordResets"></param>
/// <returns></returns>
public bool ResetPasswordResponseEmail(List<UserPasswordResetEntity> lstUserPasswordResets)
{
var isSuccess = false;
#region template
using (var context = new VnrHrmDataContext())
{
var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
string _typeTemplate = EnumDropDown.EmailType.E_NOTIFYRESETPASSWORD.ToString();
var template = unitOfWork.CreateQueryable<Sys_TemplateSendMail>(Guid.Empty, m => m.Type == _typeTemplate).FirstOrDefault();
if (template == null)
{
return false;
}
else
{
BaseService _base = new BaseService();
foreach (var user in lstUserPasswordResets)
{
string title = template.Subject;
var name = user.Email.Split('@');
#region magreData
string[] strsParaKey = null;
string[] strsParaValues = null;
strsParaKey = new string[]
{
EnumDropDown.EmailTypeDetails.E_Password.ToString(),
EnumDropDown.EmailTypeDetails.E_UserInfoName.ToString(),
EnumDropDown.EmailTypeDetails.E_UserLogin.ToString(),
};
strsParaValues = new string[]
{
user.Password,
user.UserInfoName,
user.UserLogin
};
string body = LibraryService.ReplaceContentFile(template.Content, strsParaKey, strsParaValues);
isSuccess = _base.SendMail(title, user.Email, body, string.Empty);
#endregion
}
}
}
#endregion
return isSuccess;
}