Example #1
0
        //Register to SkillSwap Website
        public void JoinStep(SignUpDetails signUpObj)
        {
            //Click on Join link to register to the SkillSwap Website
            JoinLink.Click();

            //Enter First Name
            FirstName.SendKeys(signUpObj.FirstName);

            //Enter Last Name
            LastName.SendKeys(signUpObj.LastName);

            //Enter Email address
            EmailAddress.SendKeys(signUpObj.EmailAddress);

            //Enter Password
            Password.SendKeys(signUpObj.Password);

            //Enter Confirm Password
            ConfirmPassword.SendKeys(signUpObj.ConfirmPassword);

            //Click on Terms and Conditions checkbox
            TermAndCondition.Click();

            //Click on Join button
            JoinButton.Click();
        }
Example #2
0
        public TermAndCondition SaveTermAndCondition(TermAndCondition termAndCondition)
        {
            //For Term And Condition, we always have to create new term and condition in database.

            string shortCode             = string.Empty;
            var    customerCompanyDetail = dbContext.CustomerCompanyDetails.Where(p => p.UserId == termAndCondition.CreatedBy).FirstOrDefault();

            if (customerCompanyDetail != null)
            {
                shortCode = customerCompanyDetail.CompanyName.ToLower().Contains("mex") ? "MEX" : "";
            }

            var OperationZone = UtilityRepository.GetOperationZone();

            TermAndCondition newTermAndCondition = new TermAndCondition();

            newTermAndCondition.TermAndConditionId   = 0;
            newTermAndCondition.Detail               = termAndCondition.Detail;
            newTermAndCondition.CreatedOn            = DateTime.UtcNow;
            newTermAndCondition.OperationZoneId      = termAndCondition.OperationZoneId;
            newTermAndCondition.TermAndConditionType = termAndCondition.TermAndConditionType;
            newTermAndCondition.CreatedBy            = termAndCondition.CreatedBy;
            newTermAndCondition.ConpanyCode          = shortCode;
            dbContext.TermAndConditions.Add(newTermAndCondition);
            dbContext.SaveChanges();

            return(newTermAndCondition);
        }
Example #3
0
        public IActionResult EditTerms(TermAndCondition terms)
        {
            var authorizedUser = new AppUser();

            if (HttpContext.Session.GetString("FrscQuestionLoggedInUser") != null)
            {
                var userString = HttpContext.Session.GetString("FrscQuestionLoggedInUser");
                authorizedUser = JsonConvert.DeserializeObject <AppUser>(userString);
            }

            if (!authorizedUser.Role.AccessAdminConsole || !authorizedUser.Role.ManageApplicationUser)
            {
                return(RedirectToAction("UnauthorizedAccess", "Home"));
            }

            var signedInUserId = Convert.ToInt64(HttpContext.Session.GetString("FrscQuestionLoggedInUserId"));
            var newterms       = new TermAndCondition
            {
                Text             = terms.Text,
                DateLastModified = DateTime.Now,
                LastModifiedBy   = signedInUserId,
                DateCreated      = DateTime.Now,
                CreatedBy        = signedInUserId
            };

            _databaseConnection.TermsAndConditions.Add(newterms);
            _databaseConnection.SaveChanges();
            TempData["display"]          = "You have successfully modified the version of the T&C!";
            TempData["notificationtype"] = NotificationType.Success.ToString();
            return(RedirectToAction("Terms"));
        }
Example #4
0
        public IActionResult Create(CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Title and Description is REQUIRED");
                return(View(model));
            }

            var termAndDescription = new TermAndCondition()
            {
                Id          = Guid.NewGuid(),
                Title       = model.Title,
                Description = model.Description.ToString(),
                IsPublished = true,
                UpdatedAt   = DateTime.UtcNow,
                CreatedAt   = DateTime.UtcNow,
            };

            this._context.TermAndConditions.Add(termAndDescription);
            this._context.SaveChanges();



            return(RedirectToAction("Index"));
        }
        public TermAndCondition GetTermAndCondition(int termConditionId)
        {
            TermAndCondition termAndCondition = new TermAndCondition();

            termAndCondition = new TermAndConditionRepository().GetTermAndCondition(termConditionId);
            return(termAndCondition);
        }
Example #6
0
        public List <TermAndCondition> GetAllTermAndCondition(int OperationZoneId, int userId)
        {
            TermAndCondition result = new TermAndCondition();
            var data = dbContext.TermAndConditions.Where(p => p.TermAndConditionType == "Public" && p.OperationZoneId == OperationZoneId && p.CreatedBy == userId).OrderByDescending(p => p.TermAndConditionId).ToList();

            return(data);
        }
Example #7
0
        public TermAndCondition GetLatestTermAndCondition(int OperationZoneId, string TermAndCondtionType, string shortCode)
        {
            TermAndCondition result = new TermAndCondition();
            var data = (from TAC in dbContext.TermAndConditions
                        where TAC.OperationZoneId == OperationZoneId &&
                        TAC.TermAndConditionType == TermAndCondtionType &&
                        TAC.ConpanyCode == (!string.IsNullOrEmpty(shortCode) ? shortCode : null)
                        select new
            {
                TAC.TermAndConditionId,
                TAC.Detail,
                TAC.CreatedOn,
                TAC.OperationZoneId,
                TAC.TermAndConditionType
            }).OrderByDescending(p => p.TermAndConditionId).FirstOrDefault();             //dbContext.TermAndConditions.OrderByDescending(p => p.TermAndConditionId).FirstOrDefault();

            if (data != null)
            {
                result.TermAndConditionId   = data.TermAndConditionId;
                result.Detail               = data.Detail;
                result.CreatedOn            = data.CreatedOn;
                result.OperationZoneId      = data.OperationZoneId;
                result.TermAndConditionType = data.TermAndConditionType;
            }

            return(result);
        }
        public ActionResult Delete(int id)
        {
            TermAndCondition entity = db.TermAndCondition.FirstOrDefault(a => a.Id == id);

            if (entity != null)
            {
                db.TermAndCondition.Remove(entity);
                db.SaveChanges();
            }
            return(Json(new { Message = "Đã xóa thành công!" }, JsonRequestBehavior.AllowGet));
        }
 public JsonResult Edit(int Id, TermAndCondition data)
 {
     if (data != null)
     {
         data.Id = Id;
         db.Entry(data).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(new { Message = "Đã sửa thành công!" }, JsonRequestBehavior.AllowGet));
     }
     return(null);
 }
        public IHttpActionResult SaveTermAndCondition(TermAndCondition termAndCondition)
        {
            TermAndCondition result = new TermAndConditionRepository().SaveTermAndCondition(termAndCondition);

            if (result == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(result.TermAndConditionId));
            }
        }
Example #11
0
        public int GetTermAndConditionDetail()
        {
            TermAndCondition result = new TermAndCondition();
            var data = dbContext.TermAndConditions.OrderByDescending(p => p.TermAndConditionId).FirstOrDefault();

            if (data != null)
            {
                result.TermAndConditionId = data.TermAndConditionId;
                result.Detail             = data.Detail;
                result.CreatedOn          = data.CreatedOn;
            }

            return(result.TermAndConditionId);
        }
Example #12
0
        public IActionResult CreateTerms(TermAndCondition terms)
        {
            var signedInUserId = Convert.ToInt64(HttpContext.Session.GetString("StudioLoggedInUserId"));

            terms.DateLastModified = DateTime.Now;
            terms.DateCreated      = DateTime.Now;
            terms.LastModifiedBy   = signedInUserId;
            terms.CreatedBy        = signedInUserId;

            _databaseConnection.TermsAndConditions.Add(terms);
            _databaseConnection.SaveChanges();
            TempData["display"]          = "You have successfully added a new version of the T&C!";
            TempData["notificationtype"] = NotificationType.Success.ToString();
            return(RedirectToAction("Terms"));
        }
Example #13
0
        public TermAndCondition GetTermAndCondition(int id)
        {
            TermAndCondition result = new TermAndCondition();
            var data = dbContext.TermAndConditions.Where(p => p.TermAndConditionId == id).FirstOrDefault();

            if (data != null)
            {
                result.TermAndConditionId   = data.TermAndConditionId;
                result.Detail               = data.Detail;
                result.CreatedOn            = data.CreatedOn;
                result.OperationZoneId      = data.OperationZoneId;
                result.TermAndConditionType = data.TermAndConditionType;
            }

            return(result);
        }
 public JsonResult Create(TermAndCondition data)
 {
     db.TermAndCondition.Add(data);
     db.SaveChanges();
     return(Json(new { Message = "Đã thêm thành công!" }, JsonRequestBehavior.AllowGet));
 }