Esempio n. 1
0
        public ActionResult Login(Login_Model lm)
        {
            if (lm.Email == "*****@*****.**" && lm.password == "Admin")
            {
                Session["adminId"] = 1;
                return(RedirectToAction("category", "Default1"));
            }

            MasterHotelRegistration_model hotl = db.MasterHotelRegistrations.Where(x => x.EmailID == lm.Email).Where(x => x.Password == lm.password).Select(x => new MasterHotelRegistration_model()
            {
                HotelID   = x.HotelID,
                HotelName = x.HotelName
            }).SingleOrDefault();

            if (hotl != null)
            {
                Session["HotelId"]   = hotl.HotelID;
                Session["HotelName"] = hotl.HotelName;
                return(RedirectToAction("Edit", "HotelRegistration"));
            }
            else
            {
                ViewBag.Message = "Enter Valid Username Or Password";
                return(View());
            }
        }
Esempio n. 2
0
        public void HotelExistOrNot()
        {
            var hotelReg = new MasterHotelRegistration_model();

            hotelReg.EmailID = "*****@*****.**";
            var validation1            = new Validation();
            var hotelEmailisValidOrNot = validation1.invalidEmailID(hotelReg);

            Assert.IsTrue(hotelEmailisValidOrNot);
        }
        public bool invalidEmailID(MasterHotelRegistration_model mstHotelReg)
        {
            MasterHotelRegistration_model hotl = db.MasterHotelRegistrations.Where(x => x.EmailID.ToLower() == mstHotelReg.EmailID.ToLower()).Select(x => new MasterHotelRegistration_model()
            {
                HotelID   = x.HotelID,
                HotelName = x.HotelName
            }).FirstOrDefault();

            if (hotl == null)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        public ActionResult Edit()
        {
            ViewBag.hoteltype = new SelectList(db.MasterHotelTypes, "HotelTypeID", "HotelTypeName");
            int id = Convert.ToInt32(Session["HotelId"]);
            MasterHotelRegistration_model cat = db.MasterHotelRegistrations.Where(x => x.HotelID == id).Select(x => new MasterHotelRegistration_model()
            {
                HotelTypeID = x.HotelTypeID,
                Address     = x.Address,
                Pincode     = x.Pincode,
                EmailID     = x.EmailID,
                Password    = x.Password
            }).SingleOrDefault();

            return(View(cat));
        }
Esempio n. 5
0
        public ActionResult Edit(MasterHotelRegistration_model cat)
        {
            int id = Convert.ToInt32(Session["HotelId"]);
            MasterHotelRegistration tblcat = db.MasterHotelRegistrations.Where(x => x.HotelID == id).Single <MasterHotelRegistration>();

            tblcat.HotelID     = id;
            tblcat.HotelName   = cat.HotelName;
            tblcat.HotelTypeID = cat.HotelTypeID;
            tblcat.Address     = cat.Address;
            tblcat.Pincode     = cat.Pincode;
            tblcat.EmailID     = cat.EmailID;
            tblcat.Password    = cat.Password;
            db.SubmitChanges();
            return(View());
        }
Esempio n. 6
0
        public ActionResult HotelRegistration(MasterHotelRegistration_model cat)
        {
            HttpPostedFileBase file = Request.Files["file1"];

            if (file.FileName == null || file.FileName == "")
            {
                ModelState.AddModelError("File", "Please Upload Your file");
            }
            else if (file.ContentLength > 0)
            {
                int      MaxContentLenght   = 1024 * 1024 * 3; // 3 Mb Size of photos
                string[] AllowFileExtension = new string[] { ".jpg", ".jpeg", ".png", ".JPG", ".JPEG", ".PNG" };
                if (AllowFileExtension.Contains(file.FileName.Substring(file.FileName.LastIndexOf('.'))))
                {
                    var filename = Path.GetFileName(file.FileName);
                    var path     = Path.Combine(Server.MapPath("~/FileUpload"), filename);
                    file.SaveAs(path);
                }
                else if (file.ContentLength > MaxContentLenght)
                {
                    ModelState.AddModelError("File", "your file is so large, please upload maximum size of" + MaxContentLenght + "MB");
                }
                else
                {
                    ModelState.AddModelError("File", "Please upolad file type like" + string.Join(", ", AllowFileExtension));
                }
            }
            else
            {
            }

            MasterHotelRegistration tblcat = new MasterHotelRegistration();

            tblcat.HotelID     = Convert.ToInt32(Session["HotelId"]);
            tblcat.HotelName   = cat.HotelName;
            tblcat.HotelTypeID = cat.HotelTypeID;
            tblcat.Address     = cat.Address;
            tblcat.Pincode     = cat.Pincode;
            tblcat.EmailID     = cat.EmailID;
            tblcat.Password    = cat.Password;
            tblcat.photo       = file.FileName;
            db.MasterHotelRegistrations.InsertOnSubmit(tblcat);
            ViewBag.HotelType = new SelectList(db.MasterHotelTypes, "HotelTypeID", "Name");
            db.SubmitChanges();
            return(View());
        }
        public bool CheckWhetherAdminHotelIdOrNot(Login_Model lm)
        {
            if (lm.Email == "*****@*****.**" && lm.password == "Admin")
            {
                return(true);
            }
            MasterHotelRegistration_model hotl = db.MasterHotelRegistrations.Where(x => x.EmailID == lm.Email).Where(x => x.Password == lm.password).Select(x => new MasterHotelRegistration_model()
            {
                HotelID   = x.HotelID,
                HotelName = x.HotelName
            }).FirstOrDefault();

            if (hotl != null)
            {
                return(true);
            }
            return(false);
        }