예제 #1
0
        public frmData(Train train)
        {
            InitializeComponent();

            DataTable dataTable = Services.SqliteHelper.QueryTable(train.TableName);
            List <CHUANLING_EEG.EEG_Para> eEG_Paras = ToModel <CHUANLING_EEG.EEG_Para> .ConvertToModel(dataTable);

            //InitChartA()

            lblStart.Text    = train.Start;
            lblEnd.Text      = train.End;
            lblLtime.Text    = train.Duration;
            lblUserName.Text = train.UserName;
            dataTable        = Services.SqliteHelper.QueryTable("UserInfo", "*", "UserName='******'");
            List <User> users = Services.ToModel <User> .ConvertToModel(dataTable);

            lblName.Text = users.First().Name;
            lblSex.Text  = users.First().Sex;
            lblAge.Text  = users.First().Years;
            DrawChartA(eEG_Paras);
            DrawChartB(eEG_Paras);
            DrawChartC(eEG_Paras);
            DrawChartD(eEG_Paras);
            DrawChartE(eEG_Paras);
            DrawChartF(eEG_Paras);
        }
예제 #2
0
 public UserService(UserManager <User> userManager, SignInManager <User> signInManager, IOptions <ApplicationSettingsVM> appSettings)
 {
     toViewModel          = new ToViewModel();
     toModel              = new ToModel();
     _userManager         = userManager;
     _signInManager       = signInManager;
     _applicationSettings = appSettings.Value;
 }
예제 #3
0
        public async Task <IHttpActionResult> Post(SendMailBindingModel model)
        {
            ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            Account acc = this.repository.GetAccountFromAddress(user.Email);

            this.mailBox = new EmailSettings(
                user.Email,
                user.UserName,
                acc.Password
                //Helper.GetDomainNameFromAddress(this.user.Email)    //domain
                );

            if (model.IsDraft)
            {
                //Draft mail does not require model validations
                bool saveSucceed = this.repository.SaveMessageAsDraft(this.mailBox, new List <string> {
                    model.To
                }, model.Subject, model.Body);
                return(Ok(saveSucceed ? "Your mail has been saved as draft" : "Error saving mail"));
            }
            else
            {
                ToModel tm = Helper.CheckEmailInputFromClient(model.To);

                if (!tm.IsValid)
                {
                    ModelState.AddModelError("To", "Invalid recipient address(es)");
                }

                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                //System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(
                //    user.Email,
                //    model.To, // To
                //    model.Subject, // Subject
                //    model.Body); // Body

                //bool IsSuccessful = this.repository.SendMessage(this.mailBox, mailMessage);

                bool sendSucceed = this.repository.SendMessage(this.mailBox, tm.Addresses, model.Subject, model.Body);

                return(Ok(sendSucceed ? "Your mail has been sent" : "Error sending mail"));
            }
        }
예제 #4
0
        public List <PhoneBookModel> GetAll()
        {
            var list = _phoneBookRepo.GetList(_context);

            return(ToModel.ToPhoneBookModelList(list));
        }
예제 #5
0
        public List <EntryModel> GetAllForPhoneBook(int?phoneBookId)
        {
            var list = _entryRepo.GetList(_context, e => e.PhoneBookId == phoneBookId);

            return(ToModel.ToEntryModelList(list));
        }
예제 #6
0
        public EntryModel Get(int?id)
        {
            var entry = _entryRepo.Get(u => u.Id == id, _context);

            return(ToModel.ToEntryModel(entry));
        }