Ejemplo n.º 1
0
        public async Task <IActionResult> ManageHubUser(string roomNo)
        {
            var userMaster  = new Entities.Models.User();
            var groupMaster = _manageHubUser.GetGroupMaster(roomNo);

            if (groupMaster != null)
            {
                userMaster = _repo.User.FindByCondition(u => u.Id == groupMaster.First().UserId).FirstOrDefault();
            }

            var connectedUsers = new List <HubUserVM>();

            GenerateHubUserVM(connectedUsers, _manageHubUser.GetConnectedUsers(roomNo));

            var waitingUsers = new List <HubUserVM>();

            GenerateHubUserVM(waitingUsers, _manageHubUser.GetWaitingUsers(roomNo));

            ManageHubUserVM = new ManageHubUserViewModel()
            {
                GroupName      = roomNo,
                ConnectedUsers = connectedUsers,
                WaitingUsers   = waitingUsers,
                GroupMaster    = _mapper.Map <WebApp.Models.User>(userMaster)
            };

            return(View(ManageHubUserVM));
        }
 public static FormsAuthenticationTicket CreateAuthenticationTicket(User user)
 {
     UserInfo userInfo = CreateUserContextFromUser(user);
     var ticket = new FormsAuthenticationTicket(
         1, 
         user.UserName, 
         DateTime.Now, 
         DateTime.Now.Add(FormsAuthentication.Timeout), 
         false, 
         userInfo.ToString());
     return ticket;
 }     
Ejemplo n.º 3
0
        public async Task <IdentityResult> ChangePasswordAsync(Entities.Models.User userIn, string newPassword)
        {
            var user = userIn as IdentityUser;

            var passResult = await this.ValidatePasswordAsync(user, newPassword);

            if (!passResult.Succeeded)
            {
                return(passResult);
            }

            return(await UpdatePasswordHash(user, newPassword, false));
        }
 public User GetUser([RouteData("id")]long? id)
 {
     _useRepository = new UserRepository();
     using (_useRepository)
     {
         var user = _useRepository.GetByLazyLoading(id);
         if (user != null)
         {
             userInRoute = user;
             return user;
         }
         Response.Error404();
         return null;
     }
 }
        public static UserInfo CreateUserContextFromUser(User user)
        {
            var userContext = new UserInfo
            {
                Id = user.UserId,
                UserName = user.UserName,
                //FirstName = user.FirstName,
                //LastName = user.LastName,
                //RegionName = user.Region.Name,
                //UserIdentifier = user.Email,
                //UserType = user.UserType,
                //RegionID = user.RegionID,
           //  RegionName = region.Name,
               // RegionName = region.Name.Where(region.RegionID == user.RegionID).ToString().FirstOrDefault(),

            };
            return userContext;
        }
Ejemplo n.º 6
0
        // This is the Insert method to insert the entered User item
        // USAGE: <asp:FormView InsertMethod="InsertItem">
        public void InsertItem()
        {
            using (_db)
            {
                var item = new Entities.Models.User();

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes
                    _db.Users.Add(item);
                    _db.SaveChanges();

                    Response.Redirect("Default");
                }
            }
        }
Ejemplo n.º 7
0
 private void checkforurlcommand()
 {
     if (Request["openproject"] != null)
     {
         int idproject             = int.Parse(Request["openproject"].ToString());
         Entities.Models.Project p = Entities.Models.Project.GetProjectById(idproject);
         Entities.Models.User    u = Session[Entities.Constants.Key_Sessions.UserKey] as Entities.Models.User;
         if (p != null)
         {
             if (u != null)
             {
                 if (p.CheckUserAuth(u) == true)
                 {
                     removeProjectFromSession();
                     Session.Add(Entities.Constants.Key_Sessions.ProjectKey, p);
                     RedirectTome();
                 }
                 else
                 {
                     Estado.InnerText = "No esta autorizado para este proyecto";
                     removeProjectFromSession();
                 }
             }
             else
             {
                 Estado.InnerText = "Usted no esta autenticado en el sistema";
                 removeProjectFromSession();
             }
         }
         else
         {
             Estado.InnerText = "el proyecto no existe";
             removeProjectFromSession();
         }
     }
 }
Ejemplo n.º 8
0
        //
        // GET: /CheckOut/

        public ActionResult Index()
        {
            EcommerceContext db = new EcommerceContext();

            string[] WorkingHour = null;


            if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Sat.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Sun.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Mon.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Tue.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Wed.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Thur.ToString().Split('-');
            }
            else if (DateTime.Now.DayOfWeek == DayOfWeek.Friday)
            {
                WorkingHour = db.Settings.AsNoTracking().ToList()[0].Fri.ToString().Split('-');
            }



            DateTime FromDateTime = DateTime.Parse(DateTime.Now.ToString("MM/dd/yyyy") + " " + WorkingHour[0]);
            DateTime ToDateTime   = DateTime.Parse(DateTime.Now.ToString("MM/dd/yyyy") + " " + WorkingHour[1]);

            if (FromDateTime.ToString("tt").ToLower() == "pm" && ToDateTime.ToString("tt").ToLower() == "am")
            {
                ToDateTime = ToDateTime.AddDays(1);
            }


            double iWorkingHour     = (ToDateTime - FromDateTime).TotalHours;
            double CurrentTotalHour = (DateTime.Now - FromDateTime).TotalHours;

            bool IsClosed = false;

            if ((CurrentTotalHour >= iWorkingHour) || (DateTime.Now < FromDateTime))
            {
                IsClosed = true;
            }


            CheckOutViewModel chkOut = new CheckOutViewModel();
            var assignedProductList  = new List <AddToCart>();

            var productList   = _productBusiness.GetListWT();
            var currentUserId = Convert.ToInt32(GlobalUser.getGlobalUser().UserId);

            CookieStore mycookie = new CookieStore();
            var         products = mycookie.GetCookie(Enumerator.CustomerAction.AddToCart.ToString());

            if (!string.IsNullOrEmpty(products))
            {
                assignedProductList = (from p in products.Split(',')
                                       select new AddToCart
                {
                    ProductId = Convert.ToInt32(p.Split('~')[0]),
                    Quantity = Convert.ToInt32(p.Split('~')[1]),
                    Size = Convert.ToInt32(p.Split('~')[2]),
                    Attributes = p.Split('~')[3]
                }).ToList();
            }
            else
            {
                //Can't place order if cart empty
                // display message here
            }

            //assignedProductList = _AddToCartBusiness.GetListWT(c => c.UserId == currentUserId);


            //showing cartdata to checkout
            var imgList       = _ImageBusiness.GetListWT();
            var vmProductList = (from c in productList
                                 join ap in assignedProductList
                                 on c.ProductID equals ap.ProductId
                                 select new CartWishlistViewModel
            {
                ProductID = c.ProductID,
                ProductCode = c.ProductCode,
                ProductName = c.ProductName,
                TokenKey = c.TokenKey,
                ShortDescription = c.ShortDescription,
                Price = _productBusiness.GetSelectedPrice(c.ProductID, ap.Size.GetValueOrDefault(), ap.Attributes),
                DiscountPercent = c.DiscountPercent,
                DiscountedPrice = 0,                     //Math.Round(_productBusiness.GetSelectedPrice(c.ProductID, ap.Size.Value, ap.Attributes) - Decimal.Divide(c.DiscountPercent ?? 0, 100) * _productBusiness.GetSelectedPrice(c.ProductID, ap.Size.Value, ap.Attributes)),
                SizeId = ap.Size.Value,
                Size = _productBusiness.GetSizeName(c.ProductID, ap.Size.GetValueOrDefault()),
                AttributeId = ap.Attributes,
                Attributes = _productBusiness.GetAttributes(c.ProductID, ap.Attributes),
                quantity = ap.Quantity,
                ImageList = (from il in imgList
                             where (il.ProductId == c.ProductID)
                             select new ImageViewModel
                {
                    ProductId = c.ProductID,
                    Images = "/ProductImage/" + il.Images
                }).ToList()
            }).ToList();



            chkOut.OrderList = vmProductList;
            _userBusiness    = new UserBusiness();
            Entities.Models.User CurrentUser = (Entities.Models.User)Session["CurrentUserInfo"];
            var currentUser = _userBusiness.GetUserByemail(CurrentUser.Email);

            chkOut.FirstNameShopper = currentUser.FirstName;
            chkOut.LastNameShopper  = currentUser.LastName;
            chkOut.EmailShopper     = currentUser.Email;
            chkOut.IsBlocked        = currentUser.IsBlocked;
            chkOut.IsStoreClosed    = IsClosed;


            return(View(chkOut));
        }