Example #1
0
        private WebSMSAndUserViewModel ConvertToViewModel(EWebSMSAndUserNew item, EAlarmInfo alarmInfo)//, IList<EUser> ltUser)
        {
            WebSMSAndUserViewModel vm = new WebSMSAndUserViewModel();
            vm.RecordID = item.RecordID;
            vm.ReceiveUserCode = item.ReceiveUserCode;
            vm.SMSInfoID = item.SMSInfoID;
            vm.ReceiveTime = item.ReceiveTime;
            vm.SMSInfoType = item.SMSInfoType;
            vm.ReadTime = item.ReadTime;
            vm.IsRead = item.IsRead;
            
            vm.SMSInfo = new VWebSMSInfoViewModel();
            vm.SMSInfo.InfoID = item.Info.RecordID;
            vm.SMSInfo.Title = item.Info.Title;
            vm.SMSInfo.Content = item.Info.Content;

            if (alarmInfo != null)
            {
                vm.HandleAlarmRecord = ConvertEntityToVM(alarmInfo);
            }
            return vm;
        }
Example #2
0
        private WebSMSAndUserViewModel ConvertToViewModel(EWebSMSAndUser item, EWebSMSInfo info, EAlarmInfo alarmInfo, IList<EUser> ltUser)
        {
            WebSMSAndUserViewModel vm = new WebSMSAndUserViewModel();
            vm.RecordID = item.RecordID;
            vm.ReceiveUserCode = item.ReceiveUserCode;
            vm.SMSInfoID = item.SMSInfoID;
            vm.ReceiveTime = item.ReceiveTime;
            vm.SMSInfoType = item.SMSInfoType;
            vm.ReadTime = item.ReadTime;
            vm.IsRead = item.IsRead;

            if (info != null)
            {
                VWebSMSInfoViewModel infoVM = new VWebSMSInfoViewModel();
                infoVM.InfoID = info.RecordID;
                infoVM.Title = info.Title;
                infoVM.Content = info.Content;
                vm.SMSInfo = infoVM;
            }

            if (alarmInfo != null)
            {
                VHandleAlarmRecord alarmRecordVM = ConvertEntityToVM(alarmInfo);
                if (!string.IsNullOrEmpty(alarmRecordVM.ProcessUserCode))
                {
                    var user = ltUser.FirstOrDefault(s => s.UserCode == alarmRecordVM.ProcessUserCode);
                    if (user != null)
                    {
                        alarmRecordVM.ProcessUserName = user.UserName;
                    }
                }
                vm.HandleAlarmRecord = alarmRecordVM;
            }
            return vm;
        }