public EWebSMSInfo Add(EWebSMSInfo entity) { using (IRepository repository = SessionManager.CreateRepository(typeof(EWebSMSInfo))) { repository.Save(entity); return entity; } }
public EWebSMSInfo Add(string[] arrUsers, string title, string content,Guid vehicleCode, EnumSMSInfoType type) { EWebSMSInfo info = new EWebSMSInfo(); info.Content = content; info.Title = title; info.Type = (int)type; info.VehicleCode = vehicleCode; info.SMSAndUser = new List<EWebSMSAndUser>(); for (int i = 0; i < arrUsers.Length; i++) { EWebSMSAndUser user = new EWebSMSAndUser(); user.ReceiveTime = DateTime.Now; user.ReceiveUserCode = arrUsers[i]; user.SMSInfoType = (int)type; info.SMSAndUser.Add(user); } Add(info); IList<EWebSMSAndUser_New> ltResult = ConvertEntity(info); Add(ltResult); return info; }
private IList<EWebSMSAndUser_New> ConvertEntity(EWebSMSInfo info) { IList<EWebSMSAndUser_New> ltResult = new List<EWebSMSAndUser_New>(); if (info.SMSAndUser != null && info.SMSAndUser.Count > 0) { foreach (var item in info.SMSAndUser) { EWebSMSAndUser_New entity = new EWebSMSAndUser_New(); entity.Content = item.Content; entity.IsDel = item.IsDel; entity.IsRead = item.IsRead; entity.ReadTime = item.ReadTime; entity.ReceiveTime = item.ReceiveTime; entity.ReceiveUserCode = item.ReceiveUserCode; entity.RecordID = item.RecordID; entity.SMSInfoID = info.RecordID; entity.SMSInfoType = item.SMSInfoType; entity.Title = item.Title; ltResult.Add(entity); } } return ltResult; }
protected EAlarmInfo CreateAlarmEntity(AlarmHandleContext context, EBaseAlertReport report, EWebSMSInfo webSMS) { EAlarmInfo eAlarmInfo = new EAlarmInfo(); eAlarmInfo.ACCState = report.ACCState; eAlarmInfo.AlarmGrade = (int)report.EnumAlarmGrade; eAlarmInfo.GPSTime = report.GPSReportTime; eAlarmInfo.IsLock = false; eAlarmInfo.ProcessState = (int)EnumProcessState.UnProcess; eAlarmInfo.Position = this.GetPlaceName(context, report.Latitude, report.Longitude); eAlarmInfo.SMSInfoType = (int)report.EnumSMSInfoType; eAlarmInfo.Speed = report.Speed; eAlarmInfo.StarkMileage = report.VStarkMileage; eAlarmInfo.VehicleCode = report.VehicleCode; eAlarmInfo.WebSMSInfoID = webSMS.RecordID; return eAlarmInfo; }