public void Register(string trcd, string emno) { try { List <ColumnInfo> lstParams = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "trcd", ColumnValue = trcd } }; ttrtraing training = GetSelectedObject <ttrtraing>(lstParams); lstParams.Add(new ColumnInfo() { ColumnName = "emno", ColumnValue = emno }); ttrtraatt att = GetSelectedObject <ttrtraatt>(lstParams); if (att == null) { return; } if (training.endt != null && training.endt < DateTime.Now) { throw new UtilException("The training is out-of-date."); } if (att.isrg == "Y") { throw new UtilException("You have registered the training.Don't need register again."); } using (TransactionScope scope = new TransactionScope()) { att.isrg = "Y"; att.rgtm = DateTime.Now; att.rgur = Function.GetCurrentUser(); DoUpdate <ttrtraatt>(att, lstParams); scope.Complete(); } } catch (Exception ex) { throw ex; } }
public void Publish(List <vw_employment> lstEmp, string trcd, string isEmail, string isBoard) { try { List <ColumnInfo> lstParameters = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "trcd", ColumnValue = trcd } }; ttrtraing tra = new BaseBll().GetSelectedObject <ttrtraing>(lstParameters); if (tra == null) { return; } using (TransactionScope scope = new TransactionScope()) { for (int i = 0; i < lstEmp.Count; i++) { vw_employment emp = lstEmp[i]; ttrtraatt att = new ttrtraatt(); att.emno = emp.emno; att.isat = "N"; att.isrg = "N"; att.lmtm = DateTime.Now; att.lmur = Function.GetCurrentUser(); att.trcd = trcd; DoInsert <ttrtraatt>(att); alarmBll alaBll = new alarmBll(); if (isEmail == "Y") { //发Email tstalarm alarmMdl = alaBll.BuildAlarmMdl(Alarm_AlarmType.Email, "Training: " + tra.trnm, alaBll.BuildTrainingAlarmBody(tra, att.emno), emp.emno, string.Empty, "Training", DateTime.Now.AddDays(1), string.Empty); DoInsert <tstalarm>(alarmMdl); } if (isBoard == "Y") { //发送Board tstalarm alarmMdl = alaBll.BuildAlarmMdl(Alarm_AlarmType.Board, "Training: " + tra.trnm, alaBll.BuildTrainingAlarmBody(tra, att.emno), emp.emno, string.Empty, "Training", DateTime.Now.AddDays(1), string.Empty); DoInsert <tstalarm>(alarmMdl); } //update ispb标识 tra.ispb = "Y"; DoUpdate <ttrtraing>(tra, lstParameters); } scope.Complete(); } } catch (Exception ex) { throw ex; } }