예제 #1
0
        public ActionResult Login()
        {
            string     role       = new Business.AccountBusiness().currentMember();
            string     cookieName = FormsAuthentication.FormsCookieName;     //Find cookie name
            HttpCookie authCookie = HttpContext.Request.Cookies[cookieName]; //Get the cookie by it's name

            try
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                if ((role == "U" || role == "A" || role == "O") && FormsAuthentication.Decrypt(authCookie.Value) != null)
                {
                    return(RedirectToAction("Index", "Arama"));
                }
            }
            catch (Exception)
            {
                return(View());
            }
            //TempData["Message"] = "Lütfen kullanıcı adı ve şifrenizle giriş yapınız.";
            return(View());
        }
예제 #2
0
        // GET: Facilities
        public ActionResult Index(int?page)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role == "U")
            {
                return(RedirectToAction("Login", "Account"));
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            picturesPath.Clear();
            string     cookieName            = FormsAuthentication.FormsCookieName;           //Find cookie name
            HttpCookie authCookie            = HttpContext.Request.Cookies[cookieName];       //Get the cookie by it's name
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); //Decrypt it
            string UserName   = ticket.Name;                                                  //You have the UserName!
            var    user       = webApi.GetUser(UserName);
            var    facilities = webApi.GetFacilitiesByUserId(user.USER_ID).ToPagedList(pageNumber, pageSize);

            return(View(facilities));
        }
예제 #3
0
        private void nudId_ValueChanged(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(nudId.Value);

            Business.AccountBusiness     busaccount = new Business.AccountBusiness();
            Database.Entities.tb_account account    = busaccount.ConsultarPorID(id);

            if (account == null)
            {
                txtNome.Text           = string.Empty;
                mtxtIdentificação.Text = string.Empty;
                nudValor.Value         = Convert.ToDecimal("0,00");
                rtxtDescrição.Text     = string.Empty;
            }
            else
            {
                txtNome.Text           = account.nm_account;
                mtxtIdentificação.Text = account.nr_identification;
                nudValor.Value         = Convert.ToDecimal(account.vl_value);
                rtxtDescrição.Text     = account.ds_note;
            }
        }
예제 #4
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                Database.Entities.tb_account account = new Database.Entities.tb_account();
                account.nm_account        = txtNome.Text.Trim();
                account.nr_identification = mtxtIdentificação.Text.Trim();
                account.ds_note           = rtxtDescrição.Text;
                account.vl_value          = nudValor.Value;

                Business.AccountBusiness busaccount = new Business.AccountBusiness();
                busaccount.Inserir(account);

                MessageBox.Show("Conta cadastrado com sucesso", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        public ActionResult Login(FormCollection form)
        {
            string userName = form["username"].ToString();
            string pass     = form["password"].ToString();
            var    result   = new Business.AccountBusiness().Login(userName, pass);

            if (result == "Basarili")
            {
                FormsAuthentication.SetAuthCookie(userName, false);
                return(RedirectToAction("Index", "Dashboard"));
            }
            else if (result == null)
            {
                TempData["Message"] = "Kullanıcı adı ve şifrenizi giriniz.";
            }
            else
            {
                TempData["Message"] = result;
            }



            return(View());
        }
예제 #6
0
        // GET: ReservationApprove
        public ActionResult Index(int?pageRes, int?pageSub, int?pageAllRes, int?pageAllSub, int?selectedTab)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role == "U")
            {
                return(RedirectToAction("Login", "Account"));
            }
            if (selectedTab != null)
            {
                TempData["selectedTab"] = selectedTab;
            }

            int pageSize         = 10;
            int pageNumberRes    = (pageRes ?? 1);
            int pageNumberSub    = (pageSub ?? 1);
            int pageNumberAllRes = (pageAllRes ?? 1);
            int pageNumberAllSub = (pageAllSub ?? 1);

            TempData["selectedTab"] = TempData["selectedTab"] == null ? 1 : TempData["selectedTab"];
            string     cookieName            = FormsAuthentication.FormsCookieName;           //Find cookie name
            HttpCookie authCookie            = HttpContext.Request.Cookies[cookieName];       //Get the cookie by it's name
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); //Decrypt it
            string UserName = ticket.Name;                                                    //You have the UserName!
            var    user     = webApi.GetUser(UserName);

            ApproveModel model = new ApproveModel();

            model.Reservations    = webApi.GetReservationsForApprove(user.USER_ID).ToPagedList(pageNumberRes, pageSize);
            model.Subscribers     = webApi.GetSubscribersForApprove(user.USER_ID).ToPagedList(pageNumberSub, pageSize);
            model.AllReservations = webApi.GetAllReservationsForFacilityOwner(user.USER_ID).ToPagedList(pageNumberAllRes, pageSize);
            model.AllSubscibers   = webApi.GetAllSubscribersForFacilityOwner(user.USER_ID).ToPagedList(pageNumberAllSub, pageSize);
            model.selectedTab     = TempData["selectedTab"].ToString();

            return(View(model));
        }
예제 #7
0
        // GET: Member
        public ActionResult Index(int?pageActive, int?pageHistory, int?pageSub, int?selectedTab)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role != "U" && role != "A" && role != "O")
            {
                return(RedirectToAction("Login", "Account"));
            }
            if (selectedTab != null)
            {
                TempData["selectedTab"] = selectedTab;
            }
            int pageSize          = 10;
            int pageNumberActive  = (pageActive ?? 1);
            int pageNumberHistory = (pageHistory ?? 1);
            int pageNumberSub     = (pageSub ?? 1);

            TempData["selectedTab"] = TempData["selectedTab"] == null ? 0 : TempData["selectedTab"];

            DatabaseEntities db = new DatabaseEntities();

            string     cookieName            = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie            = HttpContext.Request.Cookies[cookieName];
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
            string userName         = ticket.Name;
            var    user             = webApi.GetUser(userName);
            var    liveReservations = webApi.liveReservations(user.USER_ID);
            var    subscribers      = webApi.GetSubscribersByUserId(user.USER_ID);
            var    oldReservations  = webApi.oldReservations(user.USER_ID);
            List <SportsSide.DAL.RESERVATION> newLiveReservations = new List <SportsSide.DAL.RESERVATION>();
            List <SportsSide.DAL.RESERVATION> newOldReservations  = new List <SportsSide.DAL.RESERVATION>();

            foreach (var item in liveReservations)
            {
                if (item.DT_BEGIN.Date > DateTime.Now.Date || (item.DT_BEGIN.Date == DateTime.Now.Date && item.DT_BEGIN.Hour > DateTime.Now.Hour))
                {
                    newLiveReservations.Add(item);
                }
            }
            foreach (var item in oldReservations)
            {
                if (item.DT_BEGIN.Date < DateTime.Now.Date || (item.DT_BEGIN.Date == DateTime.Now.Date && item.DT_BEGIN.Hour < DateTime.Now.Hour))
                {
                    newOldReservations.Add(item);
                }
            }
            MemberBigModel model = new MemberBigModel();

            model.User             = user;
            model.LiveReservations = newLiveReservations.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberActive, pageSize);
            model.oldReservations  = newOldReservations.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberHistory, pageSize);
            model.Subscribers      = subscribers.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberSub, pageSize);
            model.selectedTab      = TempData["selectedTab"].ToString();

            model.Date = System.DateTime.Now.Date;


            ViewBag.Areas     = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME", user.DISTRICT.CITY.AREA.AREA_ID);
            ViewBag.Cities    = new SelectList(webApi.GetCitiesByAreas(user.DISTRICT.CITY.AREA.AREA_ID), "CITY_ID", "CITY_NAME");
            ViewBag.Districts = new SelectList(webApi.GetDistrictsByCities(user.DISTRICT.CITY.CITY_ID), "DISTRICT_ID", "DISTRICT_NAME");

            return(View(model));
        }
예제 #8
0
        // GET: Arama
        public ActionResult Index(int?page, string SearchString, string FacilityType, string ddlAreas, string ddlCities, string ddlDistricts, string Price1, string Price2, string enlem, string boylam)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role != "U" && role != "A" && role != "O")
            {
                return(RedirectToAction("Login", "Account"));
            }
            DatabaseEntities          db         = new DatabaseEntities();
            string                    cookieName = FormsAuthentication.FormsCookieName;           //Find cookie name
            HttpCookie                authCookie = HttpContext.Request.Cookies[cookieName];       //Get the cookie by it's name
            FormsAuthenticationTicket ticket     = FormsAuthentication.Decrypt(authCookie.Value); //Decrypt it
            string                    UserName   = ticket.Name;                                   //You have the UserName!
            var                    rowFind       = db.USERS.FirstOrDefault(x => x.USER_NAME == UserName);
            var                    district      = rowFind.USER_DISTRICT;
            List <FACILITY>        facilityList  = db.FACILITies.Where(a => a.DISTRICT_ID == district).ToList();
            IEnumerable <FACILITY> facilityIE    = facilityList;
            var                    facilities    = facilityIE;

            ViewBag.Areas = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME");

            if (enlem != null && boylam != null)
            {
                string         url        = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + enlem + "," + boylam + "&sensor=true";
                HttpWebRequest request    = WebRequest.Create(url) as HttpWebRequest;
                string         jsonVerisi = "";
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    jsonVerisi = reader.ReadToEnd();
                }
                var obj = JObject.Parse(jsonVerisi);

                var user    = JsonConvert.DeserializeObject <GoogleGeoCodeResponse>(jsonVerisi);
                var yer     = user.results[0].address_components[0].long_name;
                var mevki   = user.results[0].address_components[1].long_name;
                var mahalle = user.results[0].address_components[2].long_name;
                var ilce    = user.results[0].address_components[3].long_name;
                var il      = user.results[0].address_components[4].long_name;

                var distList = db.DISTRICTs.FirstOrDefault(a => a.DISTRICT_NAME == ilce);

                var facility = db.FACILITies.Where(a => a.DISTRICT_ID == distList.DISTRICT_ID).ToList();
                //IEnumerable<FACILITY> facilityIE = facility;


                //rowFind.USER_DISTRICT = distList.DISTRICT_ID;

                //db.Entry(rowFind).State = EntityState.Modified;
                //db.SaveChanges();
                return(View(facility));
            }



            if (!String.IsNullOrEmpty(ddlAreas))
            {
                facilities = db.FACILITies.Where(a => a.DISTRICT.CITY.AREA_ID.ToString() == ddlAreas).ToList();
            }
            if (!String.IsNullOrEmpty(ddlCities))
            {
                facilities = db.FACILITies.Where(x => x.DISTRICT.CITY_ID.ToString() == ddlCities).ToList();
            }
            if (!String.IsNullOrEmpty(ddlDistricts))
            {
                facilities = db.FACILITies.Where(x => x.DISTRICT_ID.ToString() == ddlDistricts).ToList();
            }
            if (String.IsNullOrEmpty(ddlAreas) && String.IsNullOrEmpty(ddlCities) && String.IsNullOrEmpty(ddlDistricts) && !String.IsNullOrEmpty(SearchString))
            {
                facilities = db.FACILITies.Where(x => x.FACILITY_NAME.StartsWith(SearchString)).ToList();
            }
            if (Price1 != null && Price1 != "")
            {
                int PriceMin = Int32.Parse(Price1);
                facilities = facilities.Where(a => a.FACILITY_PRICE >= PriceMin);
            }
            if (Price2 != null && Price2 != "")
            {
                int PriceMax = Int32.Parse(Price2);
                facilities = facilities.Where(a => a.FACILITY_PRICE <= PriceMax).ToList();
            }
            if (!String.IsNullOrEmpty(FacilityType) && FacilityType != "Tesis Türü Seç")
            {
                facilities = facilities.Where(x => x.FACILITY_TYPE1.FT_NAME == FacilityType).ToList();
            }
            if ((!String.IsNullOrEmpty(ddlAreas) || !String.IsNullOrEmpty(ddlCities) || !String.IsNullOrEmpty(ddlDistricts)) && !String.IsNullOrEmpty(SearchString))
            {
                var newFacilities = db.FACILITies.Where(x => x.FACILITY_NAME.StartsWith(SearchString));
                facilities = newFacilities.Where(x => x.DISTRICT_ID.ToString() == ddlDistricts).ToList();
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(facilities.ToPagedList(pageNumber, pageSize)));
        }