Пример #1
0
        public async Task FetchUsers()
        {
            if (this.loading)
            {
                return;
            }

            this.loading = true;
            Debug.WriteLine("fetch");
            this.session = await this.repository.GetByKeyAsync(this.Key);

            Device.BeginInvokeOnMainThread(() =>
            {
                try
                {
                    this.UpdateItemCollection(this.session.Items);

                    this.UpdateUserCollection(this.session.Users);
                }
                catch (Exception e)
                {
                    e.ToString();
                }
            });

            this.loading = false;
        }
Пример #2
0
        // GET api/price
        public PriceDTO Post([FromBody] SessionDTO SessionDTO, string id)
        {
            Cookie cookie = new Cookie("JSESSIONID", SessionDTO.sessionId);

            cookie.Domain = "razpisanie.bdz.bg";
            return(BdzWebsiteUtilities.BDZWebsiteUtilities.ParcePrice(id, cookie));
        }
Пример #3
0
        public ActionResult PromotionBatch(StudentVM studView)
        {
            bool     isSuccess = false;
            int      loggedInUser;
            DateTime date;
            string   status;// right now hard coded

            if (studView != null)
            {
                SessionDTO sessionRet = _sessionSvc.GetUserSession();//Get Data from User Seesion
                status       = "Promotion Confirmed";
                loggedInUser = sessionRet.UserMasterId;
                if (status != null && loggedInUser != 0)
                {
                    isSuccess = _studSvc.UpdatePromotedStudents(loggedInUser, status);
                    if (isSuccess)
                    {
                        date = DateTime.Now;
                        studView.SuccessOrFailureMessage = "The students of all classes have been promoted for academic year" + (int)(date.Year - 1) + "/" + (date.Year);
                        studView.MsgColor = "green";
                    }
                    else
                    {
                        studView.SuccessOrFailureMessage = "All students have not been Promoted yet";
                        studView.MsgColor = "red";
                    }
                }
            }
            return(View(studView));
        }
Пример #4
0
        public JsonResult Visualize(GraphDTO graph)
        {
            ResultDTO result = new ResultDTO();

            try
            {
                var        path    = Path.Combine(Server.MapPath(uploadFolder), graph.excel.name);
                SessionDTO session = new SessionDTO
                {
                    groundItem          = (List <VariableItem>)Session["groundItem"],
                    groundVariable      = (Variable)Session["groundVariable"],
                    resistivityItem     = (List <VariableItem>)Session["resistivityItem"],
                    resistivityVariable = (Variable)Session["resistivityVariable"],
                    rule          = (Rule)Session["rule"],
                    ruleList      = (List <RuleList>)Session["ruleList"],
                    ruleListItem  = (List <RuleListItem>)Session["ruleListItem"],
                    rules         = (List <RuleListText>)Session["rules"],
                    variables     = (List <Variable>)Session["variables"],
                    variableItems = (List <VariableItem>)Session["variableItems"]
                };
                Rule rule = (Rule)Session["rule"];
                List <VariableItem> variableItems = (List <VariableItem>)Session["variableItems"];
                result = _graphManager.VisualizeEDR(graph, path, session);
                //result = _graphManager.Visualize(graph, path, session);
                return(Json(new { Success = result.Success, Message = result.Message, ResultObject = result.ResultObject }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Success = result.Success, Message = ex.Message, ResultObject = result.ResultObject, Exception = ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult PostLogin(User _User)
        {
            try
            {
                SessionDTO dto = new SessionDTO();
                User       obj = new UserBL().GetActiveUserList(db).Where(x => x.Email.ToLower() == _User.Email.ToLower() && x.Password == _User.Password).FirstOrDefault();
                if (obj != null)
                {
                    dto.Id             = obj.Id;
                    dto.Name           = obj.FirstName + " " + obj.LastName;
                    dto.Email          = obj.Email;
                    dto.Role           = (int)obj.Role;
                    Session["Session"] = dto;

                    if (obj.Role == 1)
                    {
                        return(RedirectToAction("AdminDashBoard", "Admin"));
                    }
                    else
                    {
                        return(RedirectToAction("UserDashBoard", "User"));
                    }
                }
                else
                {
                    return(RedirectToAction("Login", new { msg = "Match not found", color = "Red" }));
                }
            }
            catch
            {
                return(RedirectToAction("Error", new { msg = "search for the page was not found", color = "Red" }));
            }
        }
Пример #6
0
        public void AddSession(SessionDTO sessionDTO)
        {
            var session = MapperExtension.mapper.Map <SessionDTO, Session>(sessionDTO);

            _db.Sessions.Add(session);
            _db.SaveChanges();
        }
Пример #7
0
        public void EditSession(SessionDTO sessionDTO)
        {
            var session = MapperExtension.mapper.Map <SessionDTO, Session>(sessionDTO);

            _db.Entry(_db.Sessions.Find(sessionDTO.SessionId)).CurrentValues.SetValues(session);
            _db.SaveChanges();
        }
 /// <summary>
 /// Create Claims based on User data.
 /// </summary>
 /// <param name="session">SessionDTO</param>
 /// <returns>Array of Claim</returns>
 private Claim[] SetClaims(SessionDTO session)
 {
     return(new[]
     {
         new Claim("Session", session.SessionId.ToString())
     });
 }
Пример #9
0
        public ServiceResult SessionDelete(SessionDTO dto)
        {
            var session = _uow.GetRepository <Session>().Get(dto.Id);

            session.IsDeleted = true;
            session.IsActive  = false;
            session.UserId    = Guid.NewGuid();

            ServiceResult result;

            _uow.BeginTran();
            try
            {
                Session islemYapildiMi = _uow.GetRepository <Session>().Update(session);
                if (islemYapildiMi != null)
                {
                    _lc.AddLog <Session>(session, ProcessTypeEnum.Delete, session.Id);
                    _uow.Commit();
                    result = new ServiceResult("İşlem başarılı", ResultState.Success);
                }
                else
                {
                    result = new ServiceResult("Yapılacak bir işlem kaydına rastlanmadı.", ResultState.Warning);
                }
            }
            catch (Exception ex)
            {
                _uow.Rollback();
                result = new ServiceResult("Hata", ResultState.Error);
            }
            return(result);
        }
Пример #10
0
        public async Task <bool> EditSessionAsync(SessionDTO session)
        {
            var path   = Properties.Resources.editSessionPath;
            var result = await _apiHelper.Put(path, session);

            return(result != null && result.ResponseType == ResponseType.Success);
        }
        private void FetchUsers_fetches_session_and_calls_UpdateItemCollection_and_updates_Items()
        {
            var client = new Mock <ISessionClient>();

            var items = new List <ItemDTO>
            {
                new ItemDTO
                {
                    Title       = "Test",
                    Description = "Test"
                }
            };

            var session = new SessionDTO
            {
                Items      = items,
                SessionKey = "1234567"
            };

            client.Setup(s => s.GetByKeyAsync(session.SessionKey)).ReturnsAsync(session);

            var lobbyViewModel = new LobbyViewModel(client.Object);

            lobbyViewModel.UpdateItemCollection(session.Items);

            Assert.Equal(session.Items.Count, lobbyViewModel.Items.Count);
        }
Пример #12
0
        private void dataGrid_Selection(object sender, EventArgs e)
        {
            if (executedFirstTime)
            {
                executedFirstTime = false;
                return;
            }
            try
            {
                //int selectedIndex = ;
                if (dataGridViewSessions.SelectedRows[0].Index != -1)
                {
                    if (dataGridViewSessions.SelectedRows[0].Cells[0].Value != null)
                    {
                        int id = int.Parse(dataGridViewSessions.SelectedRows[0].Cells[0].Value.ToString());
                        selectedSession = new SessionDTO();
                        selectedSession = sessionService.GetSession(id);

                        Console.WriteLine(id);

                        #region Set data to Fields

                        #endregion

                        btnUpdate.Enabled = true;
                        btnDelete.Enabled = true;
                        btnView.Enabled   = true;
                    }
                }
            }
            catch (ArgumentOutOfRangeException es)
            {
                Console.WriteLine(es.Message);
            }
        }
Пример #13
0
        public async Task GetCurrentItem_given_not_started_session_returns_badrequest()
        {
            var cache       = new MemoryCache(new MemoryCacheOptions());
            var sessionRepo = new Mock <ISessionRepository>();

            var token = CreateUserState(cache, 42, "ABC1234");

            var mockSession = new SessionDTO
            {
                Id    = 42,
                Items = new List <ItemDTO>
                {
                    new ItemDTO {
                        Rounds = new List <RoundDTO>()
                    }
                },
                SessionKey = "ABC1234",
                Users      = new List <UserDTO>()
            };

            sessionRepo.Setup(s => s.FindByKeyAsync(It.IsAny <string>()))
            .ReturnsAsync(mockSession);

            var controller = new SessionController(sessionRepo.Object, cache, null);

            var result = await controller.GetCurrentItem(token, "ABC1234");

            Assert.IsType <BadRequestResult>(result.Result);
        }
Пример #14
0
        // adds a Session
        public void Add(SessionDTO sessionDTO)
        {
            Session miSes = new Session();

            miSes.Sessid    = sessionDTO.sessid.ToString();
            miSes.Sesstart  = sessionDTO.sesstart;
            miSes.Sesstoken = sessionDTO.sesstoken;
            miSes.Sessuser  = sessionDTO.sessuser;
            miSes.Sessend   = sessionDTO.sessend;

            _context.Session.Add(miSes);
// modifica firstSession y/o lastsession en usuario
            User miUser = new User();

            miUser = _context.User.Single(u => u.Id == miSes.Sessuser);
            if (miUser.FirstLogin != null)
            {
                miUser.LastLogin = DateTime.Now;
            }
            else
            {
                miUser.FirstLogin = DateTime.Now;
                miUser.LastLogin  = DateTime.Now;
            };
            _context.Update(miUser);
            _context.SaveChanges();
        }
Пример #15
0
        private IList <MenuDTO> GetMenu()
        {
            grdMenu.BlockUI(false);
            IList <MenuDTO> lLstObjResult = null;

            try
            {
                SecurityServicesFactory mObjSecurityServiceFactory = new SecurityServicesFactory();
                SessionDTO lObjSession = StaticSessionUtility.GetCurrentSession() as SessionDTO;

                if (IsActiveSecurity() || !IsTestMode())
                {
                    lLstObjResult = mObjSecurityServiceFactory.GetPermissionService().GetSystemMenu(lObjSession.Id);
                }
                else
                {
                    lLstObjResult = mObjSecurityServiceFactory.GetPermissionService().GetTestSystemMenu();
                }
            }
            catch (Exception lObjException)
            {
                this.Dispatcher.Invoke(() =>
                {
                    CustomMessageBox.Show("Error", lObjException.Message);
                });
            }
            finally
            {
                grdMenu.UnblockUI();
            }

            return(lLstObjResult);
        }
Пример #16
0
        public async Task <SessionDTO> Create(SessionDTO dto)
        {
            var session = new Session()
            {
                DeviceID     = dto.DeviceID,
                SessionStart = DateTime.Now,
                UserID       = dto.UserID,
            };

            var user = await _context.Users.FindAsync(dto.UserID);

            user.IsInSession = true;
            await _context.SaveChangesAsync();

            var device = await _context.Devices.FindAsync(dto.DeviceID);

            device.Available = false;
            await _context.SaveChangesAsync();

            await _context.Sessions.AddAsync(session);

            await _context.SaveChangesAsync();

            return(dto);
        }
        public ActionResult MyTransactions(Models.TransactionViewModel trVM)
        {
            SessionDTO session = _sessionSvc.GetUserSession();

            trVM.User = new UserMasterDTO();
            trVM.User.UserMasterId = session.UserMasterId;
            StatusDTO <List <TransactionLogDTO> > status = _transactionLog.Select(trVM);

            if (status.IsSuccess)
            {
                trVM.SearchResult = new List <Models.TransactionViewModel>();
                if (status.ReturnObj != null && status.ReturnObj.Count > 0)
                {
                    Models.TransactionViewModel trSR = null;
                    for (int i = 0; i < status.ReturnObj.Count; i++)
                    {
                        trSR = new Models.TransactionViewModel();

                        trSR.User                   = new UserMasterDTO();
                        trSR.User.FName             = status.ReturnObj[i].User.FName;
                        trSR.User.MName             = status.ReturnObj[i].User.MName;
                        trSR.User.LName             = status.ReturnObj[i].User.LName;
                        trSR.TransactionLogId       = status.ReturnObj[i].TransactionLogId;
                        trSR.TransactionDate        = status.ReturnObj[i].TransactionDate;
                        trSR.TransactionDueDate     = status.ReturnObj[i].TransactionDueDate;
                        trSR.ParentTransactionLogId = status.ReturnObj[i].ParentTransactionLogId;
                        trSR.IsCompleted            = status.ReturnObj[i].IsCompleted;
                        trSR.CompletedOn            = status.ReturnObj[i].CompletedOn;
                        trSR.AmountImposed          = status.ReturnObj[i].AmountImposed;
                        trSR.AmountGiven            = status.ReturnObj[i].AmountGiven;
                        trSR.DueAmount              = status.ReturnObj[i].DueAmount;
                        trSR.TransferMode           = status.ReturnObj[i].TransferMode;
                        trSR.Location               = status.ReturnObj[i].Location;
                        trSR.TransactionType        = status.ReturnObj[i].TransactionType;
                        trSR.HasPenalty             = status.ReturnObj[i].HasPenalty;
                        trSR.OriginalTransLog       = status.ReturnObj[i].OriginalTransLog;
                        trSR.TransactionRule        = status.ReturnObj[i].TransactionRule;

                        trVM.SearchResult.Add(trSR);
                    }
                }
                else
                {
                    trVM.Message = new MvcHtmlString("No related transaction record found.");
                }
            }
            else
            {
                trVM.SearchResult = null;
                trVM.Message      = new MvcHtmlString("Query returned with error.");
            }

            Helpers.UIDropDownRepo uiDDLRepo = new Helpers.UIDropDownRepo(_ddlRepo);

            trVM.StandardSectionList = uiDDLRepo.getStandardSectionDropDown();
            trVM.TransactionTypeList = uiDDLRepo.getTransactionTypes();

            return(View(trVM));
        }
Пример #18
0
        public async Task <SessionResponse> PostSession(SessionDTO session, string username)
        {
            var response = await _httpClient.PostAsJsonAsync($"/api/sessions/players/{username}", session);

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <SessionResponse>());
        }
Пример #19
0
        public SessionVM GetSession(int id)
        {
            SessionDTO sessionDTO = TMSService.GetSession(id);
            var        mapper     = new MapperConfiguration(cfg => cfg.CreateMap <SessionDTO, SessionVM>()).CreateMapper();
            var        session    = mapper.Map <SessionDTO, SessionVM>(sessionDTO);

            return(session);
        }
Пример #20
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     populateData();
     selectedSession   = new SessionDTO();
     btnDelete.Enabled = false;
     btnView.Enabled   = false;
     btnUpdate.Enabled = false;
 }
Пример #21
0
        public void UpdateSession(SessionDTO session)
        {
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <SessionDTO, Session>()).CreateMapper();
            var item   = mapper.Map <SessionDTO, Session>(session);

            Database.Sessions.Update(item);
            Database.Save();
        }
Пример #22
0
 /// <summary>
 /// Constructor for the EditorModel
 /// </summary>
 /// <param name="sess">Session to load</param>
 public EditorModel(SessionDTO sess)
 {
     _clientChannelHandler = ClientChannelHandler.getInstance();
     _map       = new Map();
     curSession = sess;
     AddListener();
     Width    = 1920;
     _texture = cleanBrush;
 }
Пример #23
0
 private void DtoToSession(SessionDTO dto, Session session)
 {
     session.Id        = dto.Id;
     session.MovieId   = dto.MovieId;
     session.SeanceId  = dto.SeanceId;
     session.TheaterId = dto.TheaterId;
     session.ShowDate  = dto.ShowDate;
     session.IsActive  = dto.IsActive;
 }
Пример #24
0
 public PresentationSession(SessionDTO session)
 {
     InitializeComponent();
     WindowHelper.SmallWindowSettings(this);
     this.session = session;
     core         = new PresentationCore();
     FillSessionBoxes();
     LoadUnassinged();
 }
Пример #25
0
        public async Task <SummaryDTO> BuildSummary(SessionDTO session)
        {
            var summary = new SummaryCreateUpdateDTO
            {
                SessionId     = session.Id,
                ItemEstimates = this.BuildItemEstimates(session).ToList()
            };

            return(await this.CreateAsync(summary));
        }
Пример #26
0
 public static SessionCreateUpdateDTO ToSessionCreateUpdateDto(SessionDTO session)
 {
     return(new SessionCreateUpdateDTO
     {
         Id = session.Id,
         SessionKey = session.SessionKey,
         Items = ToItemCreateUpdateDtos(session.Items),
         Users = ToUserCreateDtos(session.Users)
     });
 }
Пример #27
0
        public void StartSession()
        {
            SessionDTO newSession = new SessionDTO()
            {
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now.AddDays(7)
            };

            _sessionRepository.Add(newSession);
        }
Пример #28
0
        public ActionResult Login(UserMasterDTO data)
        {
            List <EntitlementDTO> lstEntitleMent = new List <EntitlementDTO>();
            List <ActionDTO>      lstAction      = new List <ActionDTO>();
            string unencryptedPass = data.Password;
            string pass            = encrypt.encryption(data.Password);

            data.Password = pass;

            StatusDTO <UserMasterDTO> status = _userSvc.Login(data, out lstEntitleMent, out lstAction);

            if (status.IsSuccess)
            {
                if (data.RememberMe)
                {
                    HttpCookie cookie = new HttpCookie("userDetails");
                    cookie["uid"]  = data.UserName;
                    cookie["pwd"]  = unencryptedPass;
                    cookie.Expires = DateTime.Now + new TimeSpan(1, 0, 0, 0);

                    if (Request.Cookies["userDetails"] != null)
                    {
                        Response.Cookies.Set(cookie);
                    }
                    else
                    {
                        Response.Cookies.Add(cookie);
                    }
                }
                else
                {
                    Response.Cookies.Remove("userDetails");
                }

                SessionDTO session = new SessionDTO();
                session.UserMasterId    = status.ReturnObj.UserMasterId;
                session.UserName        = status.ReturnObj.UserName;
                session.FName           = status.ReturnObj.FName;
                session.MName           = status.ReturnObj.MName;
                session.LName           = status.ReturnObj.LName;
                session.ActionList      = lstAction;
                session.EntitleMentList = lstEntitleMent;


                _sessionSvc.SetUserSession(session);
                SessionDTO sessionRet = _sessionSvc.GetUserSession();
            }
            else
            {
                data.LoginFailedMsg = status.FailureReason;
                return(View(data));
            }

            return(RedirectToAction("Landing", "Login", new { area = "Login" }));;
        }
Пример #29
0
        /// <summary>
        /// Generates a Token with Session information.
        /// When Success a SessionTokenDTO will be produced
        /// </summary>
        /// <param name="session">SessionDTO</param>
        /// <returns>SessionTokenDTO</returns>
        private SessionTokenDTO BuildToken(SessionDTO session)
        {
            this.SetDates();

            var jwtToken = this.PrepareJwtToken(session);

            return(new SessionTokenDTO
            {
                Token = jwtToken
            });
        }
Пример #30
0
        public async Task <ActionResult> StartSession()
        {
            SessionDTO result = await _sessionService.CreateSessionAsync();

            if (result != null)
            {
                return(Ok(result));
            }

            return(BadRequest("There's already active session."));
        }