public List <string> GetPrivateKeys(string password, List <Coin> spentCoins)
        {
            var wallet = WalletDao.GetWalletById(CurrentWallet.Id);

            if (MD5Helper.ToMD5(password) != wallet.Password)
            {
                throw new WTException(ExceptionCode.WrongWalletPassword, "密码错误");
            }

            var network      = NetworkOperator.Instance.Network;
            var addresses    = spentCoins.Select(o => o.ScriptPubKey.GetDestinationAddress(network).ToString()).Distinct().ToList();
            var addressInfos = AddressDao.GetByAddresses(CurrentWallet.Id, addresses);

            if (addressInfos.Count == 0 || addressInfos.Count != addresses.Count)
            {
                throw new WTException(ExceptionCode.AddressNotExisted, "当前钱包找不到相关比特币地址");
            }

            var privateKeys = new List <string>();

            foreach (var addr in addressInfos)
            {
                var keyPath      = new KeyPath(addr.KeyPath);
                var rootXPrivKey = ExtKey.Parse(CurrentWallet.RootXPrivKey, network);
                var xPrivKey     = rootXPrivKey.Derive(keyPath);
                var privKeyWif   = xPrivKey.PrivateKey.GetWif(network).ToString();
                privateKeys.Add(privKeyWif);
            }

            return(privateKeys);
        }
        public ActionResult Add(Customer customer)
        {
            if (customer.Email.Contains("alkoshop.com"))
            {
                TempData["message-no-success"] = "Nemas pravo pridavat zamestnance";
                return(RedirectToAction("Index", "Home"));
            }
            if (customer.BirthDate.Year > DateTime.Today.Year - 18)
            {
                TempData["message-no-success"] = "Pro registraci musíte být starší než 18 let!";
                TempData["addresscontainer"]   = customer.Address;
                return(RedirectToAction("Create", customer));
            }

            customer.Address = (Address)TempData["addresscontainer"];

            if (ModelState.IsValid)
            {
                AddressDao addressDao = new AddressDao();
                addressDao.Create(customer.Address);

                CustomerDao customerDao = new CustomerDao();
                customerDao.Create(customer);

                TempData["message-success"] = "Registrace proběhla úspěšně prosím přihlaste se";
                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("Create", customer));
        }
        private bool CustomerAddressExists(string zipCode, string number, Guid idClientAddress, Guid idAddress, bool isCreation)
        {
            string messageError = "O endereço já está cadastrado para este usuário (zipCode e number já existem)";
            Guid   idAddressDao = AddressDao.CustomerAddressExists(zipCode, number, idClientAddress);

            if (idAddressDao == Guid.Empty)
            {
                return(false);
            }

            if (isCreation)
            {
                httpStatus   = HttpStatusCode.InternalServerError;
                replyMessage = messageError;
                return(true);
            }

            if (!isCreation && idAddressDao.ToString().ToLower() != idAddress.ToString().ToLower())
            {
                httpStatus   = HttpStatusCode.InternalServerError;
                replyMessage = messageError;
                return(true);
            }

            return(false);
        }
Exemple #4
0
        public static object ApiPaySaveAddress(IRequest context)
        {
            var siteId      = context.GetPostInt("siteId");
            var sessionId   = context.GetPostString("sessionId");
            var deliveryId  = context.GetPostInt("deliveryId");
            var addressInfo = context.GetPostObject <AddressInfo>("addressInfo");
            var isEdit      = context.GetPostBool("isEdit");

            addressInfo.UserName  = context.UserName;
            addressInfo.SessionId = sessionId;

            if (isEdit)
            {
                AddressDao.Update(addressInfo);
            }
            else
            {
                addressInfo.Id = AddressDao.Insert(addressInfo);
            }

            AddressDao.SetDefault(context.UserName, sessionId, addressInfo.Id);

            var cartInfoList = CartDao.GetCartInfoList(siteId, context.UserName, sessionId);
            var deliveryInfo = DeliveryDao.GetDeliveryInfo(deliveryId);
            var deliveryFee  = Utils.GetDeliveryFee(cartInfoList, addressInfo, deliveryInfo);

            return(new
            {
                addressInfo,
                deliveryFee
            });
        }
Exemple #5
0
 public ActionResult Edit(AddressModel addressModel)
 {
     if (ModelState.IsValid)
     {
         var address = new Address
         {
             Id            = addressModel.Id,
             FirstName     = addressModel.FirstName,
             LastName      = addressModel.LastName,
             Email         = addressModel.Email,
             Company       = addressModel.Company,
             City          = addressModel.City,
             Address1      = addressModel.Address1,
             Address2      = addressModel.Address2,
             ZipPostalCode = addressModel.ZipPostalCode,
             PhoneNumber   = addressModel.PhoneNumber,
             FaxNumber     = addressModel.FaxNumber
         };
         var addressDao = new AddressDao();
         var result     = addressDao.UpdateAddress(address);
         if (result)
         {
             SetNotification("Cập nhật Address thành công .", "success");
             return(Redirect("/Admin/Customer/Edit/" + addressModel.CustomerId));
         }
         else
         {
             ModelState.AddModelError("", "Thêm mới Address không thành công");
         }
     }
     return(View());
 }
Exemple #6
0
        public ActionResult AddressEdit(int Id)
        {
            if (Session[Common.CommonConstants.USER_SESSION] != null)
            {
                var address = new AddressDao().GetAddressById(Id);

                var addressModel = new AddressModel();
                addressModel.Id            = address.Id;
                addressModel.FirstName     = address.FirstName;
                addressModel.LastName      = address.LastName;
                addressModel.Email         = address.Email;
                addressModel.Company       = address.Company;
                addressModel.City          = address.City;
                addressModel.Address1      = address.Address1;
                addressModel.Address2      = address.Address2;
                addressModel.ZipPostalCode = address.ZipPostalCode;
                addressModel.PhoneNumber   = address.PhoneNumber;
                address.FaxNumber          = address.FaxNumber;
                return(View(addressModel));
            }
            else
            {
                return(RedirectToAction("Login", "User"));
            }
        }
Exemple #7
0
        public ActionResult Delete(int id)
        {
            try
            {
                UserDao     uDao        = new UserDao();
                AddressDao  aDao        = new AddressDao();
                FitnessUser fitnessUser = uDao.GetById(id);
                Address     address     = new Address();
                address = fitnessUser.Address;

                //pokud se jedná o trenéra, je třeba smazat jeho termíny, které vede
                if (fitnessUser.Role.Name == "Trenér")
                {
                    TermDao      tDao  = new TermDao();
                    IList <Term> terms = tDao.GetTermsByTrainer(fitnessUser);

                    foreach (Term t in terms)
                    {
                        tDao.Delete(t);
                    }
                }//pokud se jedna o zakaznika, je treba smazat rezervace, na ktere je zapsan
                else if (fitnessUser.Role.Name == "Zákazník")
                {
                    ReservationDao      rDao         = new ReservationDao();
                    IList <Reservation> reservations = rDao.GetAllReservationsByUser(fitnessUser);

                    foreach (Reservation r in reservations)
                    {
                        rDao.Delete(r);
                    }
                }

                if (fitnessUser.SmallImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/FitnessUser/" + fitnessUser.SmallImageName));
                }
                if (fitnessUser.BigImageName != null)
                {
                    System.IO.File.Delete(Server.MapPath("~/Uploads/FitnessUser/" + fitnessUser.BigImageName));
                }

                uDao.Delete(fitnessUser);
                aDao.Delete(address);


                TempData["succes"] = "Uživatelský účet byl odstraněn.";

                if (fitnessUser.Login == User.Identity.Name)
                {
                    return(RedirectToAction("Logout", "Home"));
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemple #8
0
        private void AddCustomer_Click(object sender, EventArgs e)
        {
            try
            {
                string customerName = CustomerNameTextBox.Text;
                int    addressId    = AddressDao.GetAddressIdByString(Address1TextBox.Text);

                // create the address if one doesn't exist
                if (addressId == -1)
                {
                    var newAddress = AddressDao.CreateAddress(Address1TextBox.Text,
                                                              Address2TextBox.Text,
                                                              Convert.ToInt32(CitySelectBox.SelectedValue),
                                                              ZipTextBox.Text,
                                                              PhoneTextBox.Text,
                                                              DateTime.Now,
                                                              DateTime.Now,
                                                              LoginForm.username,
                                                              LoginForm.username);
                    bool added = AddressDao.SaveNewAddress(newAddress);

                    if (added)
                    {
                        addressId = AddressDao.GetAddressIdByString(Address1TextBox.Text);
                    }
                }

                if (customerName.Trim() != "" && addressId > 0)
                {
                    var  customer = CustomerDao.CreateCustomer(customerName, addressId, LoginForm.username);
                    bool created  = CustomerDao.SaveNewCustomer(customer);

                    // clear out options
                    CustomerNameTextBox.Text = null;
                    Address1TextBox.Text     = null;
                    Address2TextBox.Text     = null;
                    PhoneTextBox.Text        = null;
                    ZipTextBox.Text          = null;

                    if (created == true)
                    {
                        SetDefaults();
                        MessageBox.Show($"Success! You have successfully added {customerName}.");
                    }
                    else
                    {
                        MessageBox.Show($"Something seems to have gone wrong, {customerName} was not created.");
                    }
                }
                else
                {
                    MessageBox.Show("Please make sure both a name and address are selected.");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("Couldn't create customer because: " + err);
            }
        }
Exemple #9
0
        public static object ApiPayRemoveAddress(IRequest context)
        {
            var addressId = context.GetPostInt("addressId");

            AddressDao.Delete(addressId);

            return(new {});
        }
Exemple #10
0
        public static object ApiPayGet(IRequest context)
        {
            var siteId    = context.GetPostInt("siteId");
            var sessionId = context.GetPostString("sessionId");

            if (context.IsUserLoggin)
            {
                CartDao.UpdateUserName(siteId, sessionId, context.UserName);
            }

            var addressInfoList = AddressDao.GetAddressInfoList(context.UserName, sessionId);
            var cartInfoList    = CartDao.GetCartInfoList(siteId, context.UserName, sessionId);

            AddressInfo addressInfo = null;

            foreach (var addInfo in addressInfoList)
            {
                if (addInfo.IsDefault)
                {
                    addressInfo = addInfo;
                }
            }
            if (addressInfo == null && addressInfoList.Count > 0)
            {
                addressInfo = addressInfoList[0];
            }

            var          deliveryInfoList = DeliveryDao.GetDeliveryInfoList(siteId);
            DeliveryInfo deliveryInfo     = null;

            if (deliveryInfoList.Count > 0)
            {
                deliveryInfo = deliveryInfoList[0];
            }

            var     totalCount  = 0;
            decimal totalFee    = 0;
            var     deliveryFee = Utils.GetDeliveryFee(cartInfoList, addressInfo, deliveryInfo);

            foreach (var cartInfo in cartInfoList)
            {
                totalCount += cartInfo.Count;
                totalFee   += cartInfo.Fee * cartInfo.Count;
            }

            return(new
            {
                addressInfoList,
                addressId = addressInfo?.Id ?? 0,
                deliveryInfoList,
                deliveryId = deliveryInfo?.Id ?? 0,
                cartInfoList,
                totalCount,
                totalFee,
                deliveryFee
            });
        }
Exemple #11
0
        public void GetAddressByValuesTest()
        {
            var address = AddressDao.GetAddressByValues("123 Main", 1, "11111");

            Assert.IsInstanceOfType(address, typeof(Address));
            Assert.IsTrue(address.Address1 == "123 Main");
            Assert.IsTrue(address.CityId == 1);
            Assert.IsTrue(address.PostalCode == "11111");
        }
Exemple #12
0
        public ActionResult AddUser(FitnessUser fitnessUser, HttpPostedFileBase picture)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (picture != null)
                    {
                        ImageClass.ImageMethod(picture, "FitnessUser", out string bigImageName, out string smallImageName, out string tempData);

                        if (tempData != null)
                        {
                            TempData["warning"] = tempData;
                        }
                        fitnessUser.BigImageName   = bigImageName;
                        fitnessUser.SmallImageName = smallImageName;
                    }
                    UserDao    uDao = new UserDao();
                    AddressDao aDao = new AddressDao();
                    Address    a    = new Address();

                    fitnessUser.Role     = new RoleDao().GetById(399);
                    fitnessUser.Password = PasswordHash.CreateHash(fitnessUser.Password);
                    a = fitnessUser.Address;

                    if (uDao.LoginExist(fitnessUser.Login) == false)
                    {
                        aDao.Create(a);
                        fitnessUser.Address = a;
                        uDao.Create(fitnessUser);
                    }
                    else
                    {
                        TempData["warning"] = "Uživatel pod tímto loginem již existuje!";
                        return(View("CreateUser", fitnessUser));
                    }
                }
                else
                {
                    return(View("CreateUser", fitnessUser));
                }
                if (TempData["warning"] == null)
                {
                    TempData["succes"] = "Registrace proběhla úspěšně.";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemple #13
0
 public bool DeleteAddress(AddressDao address)
 {
     try
     {
         return(ac.DeleteAddress(emap.MapToData(address)));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #14
0
        public ActionResult UpdateUser(FitnessUser fitnessUser, HttpPostedFileBase picture, int roleId, int addressId)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (picture != null)
                    {
                        ImageClass.ImageMethod(picture, "FitnessUser", out string bigImageName, out string smallImageName, out string tempData);

                        if (tempData != null)
                        {
                            TempData["warning"] = tempData;
                        }

                        if (fitnessUser.SmallImageName != null)
                        {
                            System.IO.File.Delete(Server.MapPath("~/Uploads/FitnessUser/" + fitnessUser.SmallImageName));
                        }
                        if (fitnessUser.BigImageName != null)
                        {
                            System.IO.File.Delete(Server.MapPath("~/Uploads/FitnessUser/" + fitnessUser.BigImageName));
                        }

                        fitnessUser.BigImageName   = bigImageName;
                        fitnessUser.SmallImageName = smallImageName;
                    }
                    UserDao    uDao = new UserDao();
                    RoleDao    rDao = new RoleDao();
                    AddressDao aDao = new AddressDao();

                    fitnessUser.Role    = rDao.GetById(roleId);
                    fitnessUser.Address = aDao.GetById(addressId);

                    uDao.Update(fitnessUser);
                }
                else
                {
                    return(View("EditUser", fitnessUser));
                }
                if (TempData["warning"] == null)
                {
                    TempData["succes"] = "Úprava Vašeho profilu proběhla úspěšně.";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(RedirectToAction("Index", "Home"));
        }
        private Address GetCurrentAddress()
        {
            var dao       = new AddressDao();
            var converter = new AddressConverter();
            var address   = converter.Convert(dao.GetByDraftee(DrafteeId));

            if (address == null)
            {
                address           = new Address();
                address.DrafteeId = DrafteeId;
            }
            return(address);
        }
Exemple #16
0
 public bool Validate(AddressDao a)
 {
     if (StringValidate(a.City, 100) &&
         StringValidate(a.State, 20) &&
         StringValidate(a.Country, 100) &&
         StringValidate(a.Zipcode, 20) &&
         StringValidate(a.Address1, 200) &&
         StringValidate(a.Address2, 200)
         )
     {
         return(true);
     }
     return(false);
 }
Exemple #17
0
 public bool UpdateAddress(AddressDao address)
 {
     try
     {
         if (addressVal.Validate(address))
         {
             return(ac.UpdateAddress(emap.MapToData(address)));
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #18
0
 public bool InsertAddress(AddressDao newaddress)
 {
     try
     {
         if (addressVal.Validate(newaddress))
         {
             return(ac.InsertAddress(emap.MapToData(newaddress)));;
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #19
0
        private void SetDefaults()
        {
            var weekData = AppointmentDao.GetAppointmentsInCurrentWeek()
                           .Select(a => new { a.Title, Start = a.Start.ToLocalTime(), End = a.End.ToLocalTime() });
            var week = new BindingSource();

            week.DataSource = weekData;

            var monthData = AppointmentDao.GetAppointmentsInCurrentMonth()
                            .Select(a => new { a.Title, Start = a.Start.ToLocalTime(), End = a.End.ToLocalTime() });
            var month = new BindingSource();

            month.DataSource = monthData;

            EditAddressComboBox.DataSource = AddressDao.GetAddresses();
            RenameTextBox.Text             = "";
            ApptInCurrentWeek.DataSource   = week;
            ApptInCurrentMonth.DataSource  = month;

            Dictionary <string, int> cities = AddressDao.GetAllCities();

            CitySelectBox.DataSource    = new BindingSource(cities, null);
            CitySelectBox.DisplayMember = "Key";
            CitySelectBox.ValueMember   = "Value";

            Dictionary <string, int> customers = CustomerDao.GetAllCustomers();

            EditCustomerComboBox.DataSource    = new BindingSource(customers, null);
            EditCustomerComboBox.DisplayMember = "Key";
            EditCustomerComboBox.ValueMember   = "Value";

            CustomerAptComboBox.DataSource    = new BindingSource(customers, null);
            CustomerAptComboBox.DisplayMember = "Key";
            CustomerAptComboBox.ValueMember   = "Value";

            CustomerUpdateComboBox.DataSource    = new BindingSource(customers, null);
            CustomerUpdateComboBox.DisplayMember = "Key";
            CustomerUpdateComboBox.ValueMember   = "Value";

            Dictionary <string, int> appts = AppointmentDao.GetAllAppointments();

            if (appts.Count > 0)
            {
                AppointmentsComboBox.DataSource    = new BindingSource(appts, null);
                AppointmentsComboBox.DisplayMember = "Key";
                AppointmentsComboBox.ValueMember   = "Value";
            }
        }
Exemple #20
0
 public JsonResult ListDistricts(int id = 0)
 {
     try
     {
         var address   = new AddressDao();
         var districts = address.getDistricts(id).Select(s => new SelectListItem()
         {
             Value = s.Id.ToString(), Text = s.Name
         }).ToList();
         return(Json(new { status = true, result = districts }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         //send mail to site's manager
         throw;
     }
 }
        public ActionResult Update(DataAccess.Model.Customer customer)
        {
            CustomerDao customerDao = new CustomerDao();
            AddressDao  addressDao  = new AddressDao();

            if (customer.BirthDate.Year > DateTime.Today.Year - 18)
            {
                TempData["message-no-success"] = "Pro objednávání alkoholu musíte být starší než 18 let!";
                return(RedirectToAction("Index", "Home"));
            }

            customerDao.Update(customer);
            addressDao.Update(customer.Address);

            TempData["message-success"] = "Vaše data byla úspěšně změněna";
            return(RedirectToAction("Index", "Home"));
        }
Exemple #22
0
        public static AddressResponse ToResponse(this AddressDao address)
        {
            if (address == null)
            {
                return(null);
            }

            return(new AddressResponse
            {
                Line1 = address.Line1,
                Line2 = address.Line2,
                City = address.City,
                State = address.State,
                Postcode = address.Postcode,
                Country = address.Country
            });
        }
Exemple #23
0
        public static AddressResponse ToResponse(this AddressDao source)
        {
            if (source == null)
            {
                return(null);
            }

            return(new AddressResponse
            {
                Line1 = source.Line1,
                Line2 = source.Line2,
                City = source.City,
                State = source.State,
                Postcode = source.Postcode,
                Country = source.Country,
            });
        }
 /// <summary>
 /// Initialize all the daos
 /// </summary>
 private void RegisterDaos()
 {
     AddressDao           = new AddressDao(_context);
     CouponCodeDao        = new CouponCodeDao(_context);
     CouponCodeProductDao = new CouponCodeProductDao(_context);
     OrderDao             = new OrderDao(_context);
     OrderProductsDao     = new OrderProductsDao(_context);
     ProductDao           = new ProductDao(_context);
     ReviewDao            = new ReviewDao(_context);
     RoleDao               = new RoleDao(_context);
     ShoppingBasketDao     = new ShoppingBasketDao(_context);
     ShoppingBasketItemDao = new ShoppingBasketItemDao(_context);
     SpecificationDao      = new SpecificationDao(_context);
     UserDao               = new UserDao(_context);
     WishlistDao           = new WishlistDao(_context);
     WishlistItemDao       = new WishlistItemDao(_context);
 }
Exemple #25
0
        public ActionResult Create(bool newAddress)
        {
            Address    address;
            AddressDao addressDao = new AddressDao();

            if (newAddress)
            {
                address = TempData["addressOrder"] as Address;
                addressDao.Create(address);
            }
            else
            {
                address = (Session["User"] as DataAccess.Model.Customer).Address;
            }

            Order order = new Order();

            order.Status = "new";
            DateTime dateTime = DateTime.Now;

            order.Customer = (Session["User"] as DataAccess.Model.Customer);
            order.Date     = dateTime;
            order.Address  = address;
            IList <CartItem>     cartItems     = (Session["cart"] as List <CartItem>);
            IList <ProductOrder> productOrders = new List <ProductOrder>();

            int totalPrice = 0;

            foreach (CartItem cartItem in cartItems)
            {
                ProductOrder productOrder = new ProductOrder(cartItem.ProductId, cartItem.PricePerUnit, cartItem.NumberOfUnits, 0);
                productOrders.Add(productOrder);
                totalPrice += (cartItem.PricePerUnit * cartItem.NumberOfUnits);
            }
            order.TotalPrice = totalPrice;

            ViewBag.TotalPrice = totalPrice;
            ViewBag.Order      = order;

            TempData["potentialOrder"]         = order;
            TempData["potentialProductOrders"] = productOrders;
            TempData["potentialAddress"]       = address;
            TempData["newAddress"]             = newAddress;
            return(View(cartItems));
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            var validator = new AddressValidator();

            if (validator.Validate(Address))
            {
                var addressDao = new AddressDao();
                addressDao.InsertUpdate(Address);
                Close();
            }
            else
            {
                MessageBox.Show(
                    this,
                    string.Format("Данные не прошли проверку.\nСообщение об ошибке: \"{0}\"", validator.Message),
                    "Сообщение");
            }
        }
Exemple #27
0
        public ActionResult Delete(int customerId, int addressId)
        {
            var customerDao = new CustomerDao();
            var customer    = customerDao.GetCustomerById(customerId);
            var address     = new AddressDao().GetAddressById(addressId);

            foreach (Address item in customer.Addresses)
            {
                if (item.Id == address.Id)
                {
                    customer.Addresses.Remove(item);
                    break;
                }
            }
            customerDao.UpdateCustomer(customer);

            return(Redirect("/Admin/Customer/Edit/" + customerId));
        }
Exemple #28
0
 /// <summary>
 /// Validates the data coming in from the data layer
 /// </summary>
 public bool ValidateSoapData(AddressDao address)
 {
     if (val.ValidateStandardString(address.Address1) &&
         val.ValidateStandardString(address.Address2) &&
         val.ValidateInt(address.AddressId) &&
         val.ValidateStandardString(address.City) &&
         val.ValidateStandardString(address.Country) &&
         val.ValidateBool(address.Primary) &&
         val.ValidateStandardString(address.State) &&
         val.ValidateStandardString(address.Zipcode))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        //My account / Order details page
        public ActionResult Details(int Id)
        {
            var orderDao   = new OrderDao();
            var addressDao = new AddressDao();

            var order = orderDao.GetOrderByOrderNumber(Id);

            order.Address1 = addressDao.GetAddressById(order.BillingAddressId);
            var shippingAddressId = order.ShippingAddressId.HasValue ? (int)order.ShippingAddressId : 0;

            order.Address2 = addressDao.GetAddressById(shippingAddressId);

            if (order == null || order.Deleted)
            {
                return(null);
            }

            return(View(order));
        }
Exemple #30
0
        public ActionResult Index(int?page, int?item)
        {
            int        itemsOnPage = item ?? 1;
            int        pg          = page ?? 1;
            AddressDao aDao        = new AddressDao();

            UserDao             uDao  = new UserDao();
            IList <FitnessUser> users = uDao.GetUserPage(itemsOnPage, pg);

            ViewBag.Pages       = (int)Math.Ceiling((double)uDao.GetAll().Count / (double)itemsOnPage);
            ViewBag.CurrentPage = pg;
            ViewBag.Items       = itemsOnPage;
            ViewBag.Roles       = new RoleDao().GetAll();
            ViewBag.Mark        = "User";
            if (Request.IsAjaxRequest())
            {
                return(PartialView(users));
            }
            return(View(users));
        }