예제 #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
파일: whUser.cs 프로젝트: jieaido/WorkHour2
 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
파일: whUser.cs 프로젝트: jieaido/WorkHour2
 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;
        }