Beispiel #1
0
 public bool UpdateUser(EPUser user)
 {
     MainUnitOfWork unitOfWork = new MainUnitOfWork();
     unitOfWork.Begin();
     unitOfWork.Session.Update(user);
     unitOfWork.Commit();
     return true;
 }
Beispiel #2
0
 public EPUser RegisterUser(EPUser user)
 {
     MainUnitOfWork unitOfWork = new MainUnitOfWork();
     unitOfWork.Begin();
     user.Id = (int)unitOfWork.Session.Save(user);
     unitOfWork.Commit();
     return user;
 }
Beispiel #3
0
 public bool UpdateUserPassword(string username, string password)
 {
     MainUnitOfWork unitOfWork = new MainUnitOfWork();
     var user = unitOfWork.Session.QueryOver<EPUser>().Where(p => p.Username == username).SingleOrDefault();
     user.Password = password;
     unitOfWork.Begin();
     unitOfWork.Session.Update(user);
     unitOfWork.Commit();
     return true;
 }
Beispiel #4
0
 public bool FinishJob(int jobId, int emailCount, int smsCount)
 {
     var unitOfWork = new MainUnitOfWork();
     unitOfWork.Begin();
     Job job = unitOfWork.Session.Get<Job>(jobId);
     job.EndDate = DateTime.Now;
     job.EmailSent = emailCount;
     job.SmsSent = smsCount;
     job.StatusId = (int)JobStatus.JobCompleted;
     unitOfWork.Session.Update(job);
     unitOfWork.Commit();
     return true;
 }
Beispiel #5
0
 public bool IsLastJobCompleted()
 {
     var unitOfWork = new MainUnitOfWork();
     unitOfWork.Begin();
     var jobs = unitOfWork.Session.QueryOver<Job>().OrderBy(p => p.Id).Desc.List();
     if (jobs == null || jobs.Count == 0)
     {
         return true;
     }
     else if (jobs.First().StatusId == (int)JobStatus.JobCompleted)
     {
         return true;
     }
     return false;
 }
Beispiel #6
0
 public int AddJob(int emailBatchSize, int smsBatchSize)
 {
     var unitOfWork = new MainUnitOfWork();
     unitOfWork.Begin();
     Job job = new Job
     {
         Name = "JOB" + DateTime.Now.Ticks,
         StartDate = DateTime.Now,
         EmailBatch = emailBatchSize,
         SmsBatch = smsBatchSize,
         StatusId = (int)JobStatus.JobStarted
     };
     var id =  (int)unitOfWork.Session.Save(job);
     unitOfWork.Commit();
     return id;
 }