11
This commit is contained in:
@@ -180,7 +180,7 @@ namespace FineUIPro.Web.SES
|
||||
protected void btnEmail_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Model.View_EMC_Punishment> pList = (from x in Funs.DB.View_EMC_Punishment
|
||||
where x.Flag == "1" && x.EmailIsSend == "否" && x.BYCRU != null && x.BYCRU.ToLower() != "none"
|
||||
where x.Flag == "1" && x.EmailIsSend == "否"
|
||||
&& (x.PunishDate.Value.Year + x.PunishDate.Value.Month) == (DateTime.Now.Year + DateTime.Now.Month)
|
||||
select x).ToList();
|
||||
if (pList.Count()>0)
|
||||
|
||||
@@ -131,6 +131,13 @@ namespace FineUIPro.Web.SES
|
||||
txtDef.Enabled = false;
|
||||
}
|
||||
|
||||
var puList = (from x in Funs.DB.EMC_Punishment where x.Flag == "1" && x.BYC_RU != null && x.BYC_RU != "NA" select x.BYC_RU).Distinct().ToArray();
|
||||
if (this.CurrUser.DepartId != null && puList.Contains(this.CurrUser.DepartId))
|
||||
{
|
||||
drpViolationInspector.Hidden = true;
|
||||
txtInspectionDep.Hidden = true;
|
||||
}
|
||||
|
||||
this.txtCompletionDate.Text = punishment.CompletionDate != null ? string.Format("{0:yyyy-MM-dd}", punishment.CompletionDate) : "";
|
||||
this.txtSESNo.Text = punishment.SES_No;
|
||||
txtViolationRelatedSes.Text = punishment.ViolationRelatedSes;
|
||||
@@ -301,53 +308,53 @@ namespace FineUIPro.Web.SES
|
||||
{
|
||||
PunishmentId = SQLHelper.GetNewID(typeof(Model.EMC_Punishment));
|
||||
punishment.PunishmentId = PunishmentId;
|
||||
punishment.CreateDate = DateTime.Now;
|
||||
BLL.PunishmentService.AddPunishment(punishment);
|
||||
|
||||
#region 增加时发送安全扣款邮件
|
||||
Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
|
||||
if (pops == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] mailTo = null;
|
||||
string[] mailCC = null;
|
||||
string resultMessage = "";
|
||||
#region 承包商EHSS违规关联SES号的填写通知 改在Golbal里触发
|
||||
//Model.EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
|
||||
//if (pops == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//string[] mailTo = null;
|
||||
//string[] mailCC = null;
|
||||
//string resultMessage = "";
|
||||
|
||||
var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("承包商EHSS违规关联SES号的填写通知"));
|
||||
if (emailTemplate.Count() > 0)
|
||||
{
|
||||
var dep = BLL.DepartService.GetDepartById(drpBYC_RU.SelectedValue);
|
||||
if (dep != null && !string.IsNullOrEmpty(dep.DepartLeader))
|
||||
{
|
||||
var userTo = from x in Funs.DB.Sys_User
|
||||
where x.UserId == dep.DepartLeader
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
if (userTo != null)
|
||||
{
|
||||
mailTo= userTo.Select(x => x.Email).ToArray();
|
||||
}
|
||||
//var emailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("承包商EHSS违规关联SES号的填写通知"));
|
||||
//if (emailTemplate.Count() > 0)
|
||||
//{
|
||||
// var dep = BLL.DepartService.GetDepartById(drpBYC_RU.SelectedValue);
|
||||
// if (dep != null && !string.IsNullOrEmpty(dep.DepartLeader))
|
||||
// {
|
||||
// var userTo = from x in Funs.DB.Sys_User
|
||||
// where x.UserId == dep.DepartLeader
|
||||
// && x.Email != null && x.Email != ""
|
||||
// select x;
|
||||
// if (userTo != null)
|
||||
// {
|
||||
// mailTo= userTo.Select(x => x.Email).ToArray();
|
||||
// }
|
||||
|
||||
var fo = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(drpFO_No.SelectedValue);
|
||||
if (fo != null)
|
||||
{
|
||||
var userCC = from x in Funs.DB.Sys_User
|
||||
where (x.UserId == fo.Contract_Admin || x.UserId == fo.Main_Coordinator
|
||||
|| x.UserId == drpViolationInspector.SelectedValue)
|
||||
&& x.Email != null && x.Email != ""
|
||||
select x;
|
||||
mailCC = userCC.Select(x => x.Email).Distinct().ToArray();
|
||||
}
|
||||
// var fo = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(drpFO_No.SelectedValue);
|
||||
// if (fo != null)
|
||||
// {
|
||||
// var userCC = from x in Funs.DB.Sys_User
|
||||
// where (x.UserId == fo.Contract_Admin || x.UserId == fo.Main_Coordinator)
|
||||
// && x.Email != null && x.Email != ""
|
||||
// select x;
|
||||
// mailCC = userCC.Select(x => x.Email).Distinct().ToArray();
|
||||
// }
|
||||
|
||||
if (mailTo.Length > 0)
|
||||
{
|
||||
NameValueCollection myPram = new NameValueCollection();
|
||||
myPram.Add("ContractNo", fo.FO_NO);
|
||||
myPram.Add("Contractor", drpContractor.SelectedText);
|
||||
MailHelper.SendPunishSesMail(pops, myPram, "承包商EHSS违规关联SES号的填写通知", mailTo, mailCC, out resultMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (mailTo.Length > 0)
|
||||
// {
|
||||
// NameValueCollection myPram = new NameValueCollection();
|
||||
// myPram.Add("ContractNo", fo.FO_NO);
|
||||
// myPram.Add("Contractor", drpContractor.SelectedText);
|
||||
// MailHelper.SendPunishSesMail(pops, myPram, "承包商EHSS违规关联SES号的填写通知", mailTo, mailCC, out resultMessage);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Add Contractor Safety Punishment!");
|
||||
|
||||
Reference in New Issue
Block a user