Пример #1
0
 public Account CreateAccount(Account account)
 {
     Model.Account model = account;
     model.Id = 0;
     context.Account.Add(model);
     return(context.TrySaveChanges() ? model : null);
 }
 public async static Task Update(m.Account obj)
 {
     using (var db = DbAccess.ConnectionFactory())
     {
         await db.ExecuteAsync(DbAccess.Update <m.Account>(), obj);
     }
 }
Пример #3
0
 public void SetValue(Account account)
 {
     WhRoles = account.WhRoles;
     Accountid = account.TeamId;
     AccountName = account.AccountName;
     AccountPwd = account.AccountPwd;
     IsAdmin = account.IsAdmin;
     TeamId = account.TeamId;
     IsCanLogin = account.IsCanLogin;
 }
Пример #4
0
 public StreamManagerViewModel(Account account)
 {
     _selectedCircleIndex = -1;
     _accountModel = account;
     _streamManagerModel = account.Stream;
     _streams = new ObservableCollection<StreamViewModel>();
     _streamSyncer = _streamManagerModel.Streams.SyncWith(
         _streams, item => new StreamViewModel(item, _accountModel, _streamManagerModel),
         _stream_ChangedDisplayStreams, item => item.Cleanup(), App.Current.Dispatcher);
     PropertyChanged += StreamManagerViewModel_PropertyChanged;
 }
Пример #5
0
        public void ReScheduleAccount(Account account, DateTime nextLoginTime)
        {
            SimpleTrigger triggerObject = (SimpleTrigger)m_ApplicationContext.GetObject("AccountTrigger");
            triggerObject.StartTimeUtc = nextLoginTime;
            triggerObject.RepeatInterval = TimeSpan.Zero;
            triggerObject.Name = account.Login + "Trigger";
            triggerObject.JobName = account.Login + "Job";

            account.SchedulerTrigger = triggerObject;

            m_SchedulerFactory.RescheduleJob(account.SchedulerTrigger.Name, account.SchedulerTrigger.Group, triggerObject);
        }
        public async Task <IActionResult> Post([FromBody] m.Account data)
        {
            try
            {
                await d.Account.Insert(data);

                return(Ok(data));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public void Get()
        {
            try
            {
                m.Account obj = d.Account.Get(account.ProfileId).Result;
                IEnumerable <m.Account> accounts = d.Account.Get().Result;

                Assert.IsTrue(true);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Пример #8
0
        public AccountViewModel(Account model, MainViewModel managerVM)
        {
            _accountModel = model;
            _userName = _accountModel.Builder.Name;
            _userMailAddress = _accountModel.Builder.Email;
            _manager = managerVM;
            _stream = new StreamManagerViewModel(_accountModel);
            _notification = new NotificationManagerViewModel(_accountModel.Notification);
            OpenAccountListCommand = new RelayCommand(OpenAccountListCommand_Execute);
            ActivateCommand = new RelayCommand(ActivateCommand_Execute);

            PropertyChanged += AccountViewModel_PropertyChanged;
            DataCacheDictionary.DownloadImage(new Uri(_accountModel.Builder.IconUrl.Replace("$SIZE_SEGMENT", "s38-c-k")))
                .ContinueWith(tsk => UserIconUrl = tsk.Result);
        }
Пример #9
0
        public StreamViewModel(Stream circle, Account account, StreamManager manager)
        {
            _circleModel = circle;
            _name = circle.Name;
            _circleManagerModel = manager;
            _accountModel = account;
            _isConnected = true;
            _activities = new ObservableCollection<ViewModelBase>();
            ReconnectCommand = new RelayCommand(ReconnectCommand_Executed);
            ResumeCommand = new RelayCommand(ReconnectCommand_Executed);

            _resumeButton = new ResumeButtonViewModel(ResumeCommand);
            _circleModel.ChangedStatus += _circleModel_ChangedStatus;
            _circleModel.ChangedChangedActivityCount += _circleModel_ChangedChangedActivityCount;
            PropertyChanged += StreamViewModel_PropertyChanged;
        }
Пример #10
0
        public ActionResult Login( string username,string password)
        {
            Account account = new Account()
            {
                AccountName = username,
                AccountPwd = password
            };
            var s = db.AccountDal.ValiValidationAccount(account);
            if ( s!=null)
            {
              FormsAuthentication.SetAuthCookie(s.Accountid.ToString(),false);
              Session["account"] = s;
              return  RedirectToAction("Index", "Permissions");

            }
            return View();
        }
        public async Task <IActionResult> Put(Guid id, [FromBody] m.Account data)
        {
            try
            {
                if (id != data.AccountId)
                {
                    return(BadRequest());
                }

                await d.Account.Update(data);

                return(Ok(data));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #12
0
        public ActionResult Index(string accountname,string accountpwd)
        {
            var s = new Account
            {
                AccountName = accountname,
                AccountPwd = accountpwd
            };
            s = db.AccountDal.ValiValidationAccount(s);
            if (s!=null)
            {
                FormsAuthentication.SetAuthCookie(s.AccountName,false);
                Session["Account"] = s;
                return RedirectToAction("Index", "Home");
            }

            return View();
        }
Пример #13
0
 public AccountListItem(Account account)
 {
     this.m_account = account;
     InitializeComponent();
 }
Пример #14
0
 public void ScheduleAccount(Account account, DateTime nextLoginTime)
 {
     account.SchedulerTrigger.StartTimeUtc = nextLoginTime;
     m_SchedulerFactory.ScheduleJob(account.SchedulerJobDetail, account.SchedulerTrigger);
 }
Пример #15
0
        private Account NewAccountInstance()
        {
            Account account = new Account();
            account.Login = m_AccountListView.Login;
            account.Passwd = m_AccountListView.Passwd;

            AccountJob accountJobObject = (AccountJob)m_ApplicationContext.GetObject("AccountJobObject");
            accountJobObject.Account = account;
            accountJobObject.SchedulerService = (ISchedulerService)m_ApplicationContext.GetObject("SchedulerService");

            MethodInvokingJobDetailFactoryObject job = new MethodInvokingJobDetailFactoryObject();
            job.Concurrent = false;
            job.TargetObject = accountJobObject;
            job.TargetMethod = "RunProcess";
            job.Name = account.Login + "Job";

            job.AfterPropertiesSet();

            account.SchedulerJobDetail = (JobDetail)job.GetObject();

            SimpleTrigger triggerObject = (SimpleTrigger)m_ApplicationContext.GetObject("AccountTrigger");
            triggerObject.StartTimeUtc = DateTime.MinValue;
            triggerObject.RepeatInterval = TimeSpan.Zero;
            triggerObject.Name = account.Login + "Trigger";
            triggerObject.JobName = account.Login + "Job";

            account.SchedulerTrigger = triggerObject;

            return account;
        }
Пример #16
0
 private void Schedule(Account account)
 {
     m_schedulerFactory.AddJob(account.SchedulerJobDetail, true);
     m_schedulerFactory.ScheduleJob(account.SchedulerTrigger);
 }
Пример #17
0
 public void UnScheduleAccount(Account account)
 {
     account.SchedulerTrigger.StartTimeUtc = DateTime.MinValue;
     m_SchedulerFactory.DeleteJob(account.SchedulerJobDetail.Name, account.SchedulerJobDetail.Group);
     m_SchedulerFactory.UnscheduleJob(account.SchedulerTrigger.Name, account.SchedulerTrigger.Group);
 }
Пример #18
0
 public void StartAccount(Account account)
 {
     account.SchedulerTrigger.StartTimeUtc = DateTime.UtcNow.AddSeconds(m_settingsFactory.Default.AccountFirstFireTime);
     ScheduleAccount(account);
 }
Пример #19
0
 private void ScheduleAccount(Account account)
 {
     Schedule(account);
 }
Пример #20
0
 public void UpdateAccountInformation(Account account)
 {
     foreach (AccountListItem item in m_accountList.pAccounts.Controls)
     {
         if (item.Account.Login.Equals(account.Login))
         {
             item.Account = account;
             return;
         }
     }
 }
        public IList<Account> GetAllDevAccounts()
        {
            var list = new List<Account>();
            var properties = typeof(Account).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
            var columns = new DataColumn[properties.Length];
            for (int i = 0; i < properties.Length; i++)
            {
                var property = properties[i];
                DataColumn column = null;
                foreach (DataColumn item in this["Account"].Columns)
                {
                    if (item.ColumnName.Equals(property.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        column = item;
                        break;
                    }
                }
                if (column != null)
                {
                    columns[i] = column;
                }
            }
            foreach (DataRow row in this["Account"].Rows)
            {
                var obj = new Account();
                for (var i = 0; i < columns.Length; i++)
                {
                    var column = columns[i];
                    if (column == null)
                    {
                        continue;
                    }
                    var property = properties[i];
                    if (!property.CanWrite)
                    {
                        continue;
                    }
                    var value = row[column];
                    if (value == DBNull.Value) value = null;

                    property.SetValue(obj, value, null);
                }
                list.Add(obj);
            }
            return list;
        }
Пример #22
0
        private void PrepareSchedulerObjects(ref Account account)
        {
            MethodInvokingJobDetailFactoryObject job = new MethodInvokingJobDetailFactoryObject();
            job.TargetObject = m_applicationContext.GetComponentFromContext<AccountJob>("accountJob");
            job.Name = account.Login + "Job";
            job.TargetMethod = "RunProcess";
            job.Concurrent = false;

            job.AfterPropertiesSet();

            account.SchedulerJobDetail = (JobDetail)job.GetObject();

            SimpleTrigger triggerObject = new SimpleTrigger(account.Login + "Trigger", "account", DateTime.MinValue, null, 0, TimeSpan.Zero);

            triggerObject.JobName = account.Login + "Job";

            triggerObject.JobDataMap.Add("account", account);

            account.SchedulerTrigger = triggerObject;
        }
Пример #23
0
        public ActionResult Register(string mname,string mpwd,int teamid)
        {
            //todo

            //增加注册画面
            Account account = new Account()
            {
                AccountName = mname,
                AccountPwd = mpwd,
                TeamId = teamid,
                IsAdmin = false
            };

            if (_db2.AccountDal.Register(account)!=null)
            {
                return RedirectToAction("Index", "Home");
            }
            return  View();
        }
Пример #24
0
 private void UnSchedule(Account account)
 {
     m_schedulerFactory.DeleteJob(account.SchedulerJobDetail.Name, account.SchedulerJobDetail.Group);
     m_schedulerFactory.UnscheduleJob(account.SchedulerTrigger.Name, account.SchedulerTrigger.Group);
 }
Пример #25
0
 private void UnScheduleAccount(Account account)
 {
     UnSchedule(account);
 }
Пример #26
0
 private void ReSchedule(Account account)
 {
     UnSchedule(account);
     Schedule(account);
 }
Пример #27
0
 public WhUser(Account account)
 {
     SetValue(account);
 }
Пример #28
0
 public void SetNextLoginTimeForAccount(Account account)
 {
     m_viewProvider.UpdateAccountInformation(account);
     ReScheduleAccount(account);
 }
Пример #29
0
 private static void printAccountInfo(Model.Account a)
 {
     Console.WriteLine("\nAccount No : " + a.AccNo);
     Console.WriteLine("Account Holder Name : " + a.AccountName);
     Console.WriteLine("Current Balance : " + a.Balance);
 }
Пример #30
0
        private void pbAdd_Click(object sender, EventArgs e)
        {
            Account account = new Account();
            account.Login = tbLogin.Text;
            account.Passwd = tbPasswd.Text;

            PrepareSchedulerObjects(ref account);

            AccountListItem accountDetailsControl = new AccountListItem(account);
            int position = 0;
            if (pAccounts.Controls.Count != 0)
            {
                position += 22 * pAccounts.Controls.Count;
            }
            else
            {
                account.Selected = true;
            }
            accountDetailsControl.Location = new Point(0, position);

            this.Invoke((Action)(delegate
            {
                pAccounts.Controls.Add(accountDetailsControl);
            }));

            tbLogin.Text = String.Empty;
            tbPasswd.Text = String.Empty;
        }