Beispiel #1
0
        public ActionResult ActiveUsers(List <UserProfileVM> lst)
        {
            for (int i = 0; i < lst.Count; i++)
            {
                if (lst[i].IsActive == true)
                {
                    UserRegistration a = db.UserRegistrations.Find(lst[i].UserID);
                    a.IsActive        = false;
                    db.Entry(a).State = System.Data.EntityState.Modified;
                    db.SaveChanges();
                }
            }


            // List<ActiveDeactiveUser> list1 = new List<ActiveDeactiveUser>();

            // var data = db.UserRegistrations.Where(x => x.IsActive == true).ToList();
            //foreach (var i in data)
            //{
            //    ActiveDeactiveUser a = new ActiveDeactiveUser();
            //    a.UserID = i.UserID;
            //    a.FullName = i.FullName;
            //    a.Email = i.Email;
            //    a.Mobile = i.Mobile;
            //    a.City = i.City;
            //    a.IsActive = false;

            //    list1.Add(a);
            //}


            return(RedirectToAction("ActiveUsers"));
        }
Beispiel #2
0
 public void SaveVisitorDetails(LocationModel iLocation)
 {
     try
     {
         ProfileEntities db = new ProfileEntities();
         VisitorDeail    o  = new VisitorDeail();
         o = (from context in db.VisitorDeails
              where context.IP.ToLower() == iLocation.IP.ToLower()
              select context).FirstOrDefault();
         if (o == null)
         {
             o              = new VisitorDeail();
             o.IP           = iLocation.IP;
             o.Country_Code = iLocation.Country_Code;
             o.Country_Name = iLocation.Country_Name;
             o.Region_Code  = iLocation.Region_Code;
             o.Region_Name  = iLocation.Region_Name;
             o.City         = iLocation.City;
             o.Zip_Code     = iLocation.Zip_Code;
             o.Time_Zone    = iLocation.Time_Zone;
             o.Latitude     = iLocation.Latitude;
             o.Longitude    = iLocation.Longitude;
             o.Metro_Code   = iLocation.Metro_Code;
             o.CreatedON    = DateTime.Now;
             o.AccessCount  = 1;
             o.ModifiedON   = DateTime.Now;
             db.VisitorDeails.Add(o);
             db.SaveChanges();
         }
         else
         {
             o.AccessCount = o.AccessCount + 1;
             o.ModifiedON  = DateTime.Now;
             db.SaveChanges();
         }
     }
     catch (Exception)
     {
     }
 }
        public ActionResult Register(UserRegVM obj)
        {
            if (string.IsNullOrEmpty(obj.Password))
            {
                ModelState.AddModelError("Password", "Please Enter Password");
            }

            if (obj.Password != obj.ConfPassword)
            {
                ModelState.AddModelError("ConfPassword", "Password Do Not Match");
            }

            if (!obj.TermsAndConditions)
            {
                ModelState.AddModelError("TermsAndConditions", "Please Select Terms & Conditions Box");
            }

            bool em = db.UserRegistrations.Any(x => x.Email == obj.Email);

            if (em == true)
            {
                ModelState.AddModelError("Email", "Email Already Used");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    UserRegistration o = new UserRegistration();
                    o.Email      = obj.Email;
                    o.Password   = obj.Password;
                    o.Mobile     = obj.Mobile;
                    o.FirstName  = obj.FirstName;
                    o.MiddleName = obj.MiddleName;
                    o.LastName   = obj.LastName;

                    o.IsActive  = false;
                    o.CreatedOn = DateTime.Now;
                    db.UserRegistrations.Add(o);
                    db.SaveChanges();

                    UserProfile oUserProfile = new UserProfile();
                    oUserProfile.Gender = obj.Gender;
                    oUserProfile.UserID = o.UserID;

                    if (oUserProfile.Gender == 1)
                    {
                        oUserProfile.MyAppID = "SAAJB" + o.UserID;
                    }
                    else if (oUserProfile.Gender == 2)
                    {
                        oUserProfile.MyAppID = "SAAJG" + o.UserID;
                    }


                    db.UserProfiles.Add(oUserProfile);
                    db.SaveChanges();

                    //  var profile = db.UserProfiles.ToList().Where(ite => ite.UserID == oUserProfile.UserID).FirstOrDefault();
                    Session["MyAppId"]   = oUserProfile.MyAppID;
                    Session["UserID"]    = oUserProfile.UserID;
                    Session["Email"]     = o.Email;
                    Session["Phone"]     = o.Mobile;
                    Session["FirstName"] = o.FirstName;
                    Session["MyAppId"]   = oUserProfile.MyAppID;
                    //  SendMail(o.Email);

                    return(RedirectToAction("LandingPage"));
                }
                catch (Exception)
                {
                    return(RedirectToAction("Login"));
                }
            }
            else
            {
                ViewBag.Genders = db.Genders.ToList();
                //ViewBag.Country = db.Countries.ToList();
                //ViewBag.States = db.States.OrderBy(x => x.StateName).ToList();
                //ViewBag.Cities = db.Cities.Where(x => x.StateID == 0).OrderBy(x => x.CityName).ToList();
                return(View(obj));
            }
        }
Beispiel #4
0
        public ActionResult Register(UserRegVM obj)
        {
            bool em = db.UserRegistrations.Any(x => x.Email == obj.Email);

            if (em == true)
            {
                ModelState.AddModelError("Email", "Email Already Used");
            }
            if (obj.Caste == "")
            {
                ModelState.AddModelError("Caste", "Please select caste");
            }
            if (!obj.TermsAndConditions)
            {
                ModelState.AddModelError("TermsAndConditions", "Please Select Terms & Conditions Box");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    OtherCasteUserRegistration o = new OtherCasteUserRegistration();
                    o.Email        = obj.Email;
                    o.Mobile       = obj.Mobile;
                    o.FirstName    = obj.FirstName;
                    o.MiddleName   = obj.MiddleName;
                    o.LastName     = obj.LastName;
                    o.IsActive     = false;
                    o.Gender       = obj.Gender;
                    o.CasteName    = obj.Caste;
                    o.SubCasteName = obj.SubCaste;
                    o.DOB          = Convert.ToDateTime(obj.BirthDateDisplay);

                    o.CreatedOn = DateTime.Now;
                    db.OtherCasteUserRegistrations.Add(o);
                    db.SaveChanges();



                    return(View("LandingPage"));
                }
                catch (Exception)
                {
                    return(RedirectToAction("Login"));
                }
            }
            else
            {
                var selectlist = new SelectList(
                    new List <SelectListItem>
                {
                    new SelectListItem {
                        Selected = true, Text = "Leva Patil", Value = "Leva Patil"
                    },
                    new SelectListItem {
                        Selected = true, Text = "GujarPatil", Value = "GujarPatil"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Mali", Value = "Mali"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Marwadi", Value = "Marwadi"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Gujarathi", Value = "Gujarathi"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Bramhan", Value = "Bramhan"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Wani", Value = "Wani"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Shimpi", Value = "Shimpi"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Sonar", Value = "Sonar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Dhobi", Value = "Dhobi"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Badgujar", Value = "Badgujar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Nhavi", Value = "Nhavi"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Kasar", Value = "Kasar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Kumbhar", Value = "Kumbhar"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Teli", Value = "Teli"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Bhavsar", Value = "Bhavsar"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Sutar", Value = "Sutar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Mali", Value = "Mali"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Bari", Value = "Bari"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Gurav", Value = "Gurav"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Manbhav", Value = "Manbhav"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Lohar", Value = "Lohar"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Thakur", Value = "Thakur"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Gosavi", Value = "Gosavi"
                    },

                    new SelectListItem {
                        Selected = true, Text = "Beldar", Value = "Beldar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Otaari", Value = "Otaari"
                    },


                    new SelectListItem {
                        Selected = true, Text = "Gawali", Value = "Gawali"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Ramoshi", Value = "Ramoshi"
                    },


                    new SelectListItem {
                        Selected = true, Text = "Banjara", Value = "Banjara"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Dhangar", Value = "Dhangar"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Vanjari", Value = "Vanjari"
                    },
                    new SelectListItem {
                        Selected = true, Text = "Other Caste", Value = "OtherCaste"
                    },
                }, "Value", "Text", 1);


                ViewBag.CasteList = selectlist;
                ViewBag.Genders   = db.Genders.ToList();
                return(View(obj));
            }
        }
Beispiel #5
0
        public ActionResult EditProfile(UserProfileVM obj)
        {
            try
            {
                UserRegistration u = db.UserRegistrations.Find(obj.UserID);
                if (u != null)
                {
                    u.FirstName  = obj.FirstName;
                    u.MiddleName = obj.MiddleName;
                    u.LastName   = obj.LastName;

                    u.Email = obj.Email;
                }
                UserProfile o = db.UserProfiles.Find(obj.UserID);
                o.MritalStatus         = obj.MaritalStatusID;
                o.DateOfBirth          = Convert.ToDateTime(obj.BirthDateDisplay); //obj.DateOfBirth;
                o.BirthName            = obj.BirthName;
                o.BirthPlace           = obj.BirthPlace;
                o.BirthTime            = obj.BirthTime;
                o.Gotra                = obj.Gotra;
                o.SubCasteID           = obj.SubCasteID;
                o.ComplexionID         = obj.ComplexionID;
                o.HeightID             = obj.HeightID;
                o.WeightID             = obj.WeightID;
                o.PhysicallyChalengeID = obj.PhysicalChalengeID;
                o.BloodGroupID         = obj.BloodGroupID;
                o.SpectacleID          = obj.SpectacleID;
                o.RAddress             = obj.RAddress;
                o.MulGaon              = obj.MulGaon;
                o.StateID              = obj.StateID;
                o.DistrictID           = obj.CityID;
                o.TalukaID             = obj.TalukaID;

                o.DegreeID        = obj.SchoolID;
                o.EducationDetail = obj.EducationDetail;
                o.CareerID        = obj.ServiceBusinessID;
                o.ServiceDetail   = obj.ServiceDetail;
                o.SalaryAnual     = obj.SalaryAnual;

                o.FatherName       = obj.FatherName;
                o.MotherName       = obj.MotherName;
                o.FatherOccupation = obj.FatherOccupation;
                o.ContactNo        = obj.FatherContactNo;
                o.MamaName         = obj.MamaSurName;
                o.MamaPlace        = obj.MamaPlace;

                HttpPostedFileBase b = Request.Files["ImageFile"] as HttpPostedFileBase;
                if (b != null)
                {
                    string pic = System.IO.Path.GetFileName(b.FileName);
                    if (pic != "")
                    {
                        string path = Path.Combine(Server.MapPath("~/Images"),
                                                   Session["UserID"].ToString() + ".jpg");
                        string ipath = "/Images/" + Session["UserID"].ToString() + ".jpg";

                        b.SaveAs(path);

                        int uid = Convert.ToInt32(Session["UserID"].ToString());

                        o.ImagePath = ipath;
                    }
                }


                db.Entry(o).State = System.Data.EntityState.Modified;
                db.SaveChanges();

                db.Entry(u).State = System.Data.EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception)
            {
            }

            return(RedirectToAction("ViewProfile"));
        }