Esempio n. 1
0
        public ActionResult Changepassword(ChangepasswordModel model)
        {
            if (ModelState.IsValid)
            {
                var account = db.wf_emp.Where(i => i.Email == model.Email && i.Password == model.Password).FirstOrDefault();
                if (account != null)
                {
                    wf_emp wfemp = db.wf_emp.Where(i => i.Email == model.Email).FirstOrDefault();
                    wfemp.Password = model.Newpassword;
                    db.SaveChanges();


                    TempData["Success"] = "You have change Password Successfully!!";
                    return(RedirectToAction("Emploggin", "Home"));
                }

                else
                {
                    TempData["Success"] = "Invalid User!!";
                    return(RedirectToAction("Changepassword", "Home"));
                }
            }
            else
            {
                TempData["Success"] = "All field is require!!";
                return(RedirectToAction("Changepassword", "Home"));
            }
        }
Esempio n. 2
0
        public ActionResult RemoveEmployee(int id)
        {
            wf_emp wfemp = db.wf_emp.Where(i => i.Id == id).FirstOrDefault();

            db.wf_emp.Remove(wfemp);
            db.SaveChanges();
            return(RedirectToAction("Employeelist", "Home"));
        }
Esempio n. 3
0
        public ActionResult UpdateEmployee(AddemployeeModel model)
        {
            string ResumeName      = Path.GetFileNameWithoutExtension(model.ResumeFile.FileName);
            string ResumeExtension = Path.GetExtension(model.ResumeFile.FileName);

            //Add Current Date and time To Attached File Name
            ResumeName = DateTime.Now.ToString("yyyyMMddhhmmss") + "-" + ResumeName.Trim() + ResumeExtension;
            string Resumepath = Path.Combine(Server.MapPath("~/Resume"), ResumeName);

            model.ResumeFile.SaveAs(Resumepath);

            string PhotoName      = Path.GetFileNameWithoutExtension(model.PhotoFile.FileName);
            string PhotoExtension = Path.GetExtension(model.PhotoFile.FileName);

            //Add Current Date and time To Attached File Name
            PhotoName = DateTime.Now.ToString("yyyyMMddhhmmss") + "-" + PhotoName.Trim() + PhotoExtension;
            string PhotoPath = Path.Combine(Server.MapPath("~/Image"), PhotoName);

            model.PhotoFile.SaveAs(PhotoPath);

            wf_emp wfemp = db.wf_emp.Where(i => i.Id == model.id).FirstOrDefault();

            wfemp.Id         = model.id;
            wfemp.Photo      = PhotoName;
            wfemp.Resume     = ResumeName;
            wfemp.Employeeid = model.Eemployeeid;
            wfemp.Name       = model.Name;
            wfemp.Dob        = model.Dob;
            wfemp.Gender     = model.Gender;
            wfemp.Address    = model.Address;
            wfemp.City       = model.City;
            wfemp.Email      = model.Email;
            wfemp.Mobile     = model.Mobile;
            wfemp.Position   = model.Positon;
            wfemp.HireDate   = model.HireDate;
            wfemp.Experience = model.Experience;
            wfemp.Password   = model.Password;
            db.SaveChanges();

            return(RedirectToAction("Employeelist", "Home"));
        }
Esempio n. 4
0
        public ActionResult Addemployee(AddemployeeModel model)
        {
            string ResumeName      = Path.GetFileNameWithoutExtension(model.ResumeFile.FileName);
            string ResumeExtension = Path.GetExtension(model.ResumeFile.FileName);

            //Add Current Date and time To Attached File Name
            ResumeName = DateTime.Now.ToString("yyyyMMddhhmmss") + "-" + ResumeName.Trim() + ResumeExtension;
            string Resumepath = Path.Combine(Server.MapPath("~/Resume"), ResumeName);

            model.ResumeFile.SaveAs(Resumepath);

            string PhotoName      = Path.GetFileNameWithoutExtension(model.PhotoFile.FileName);
            string PhotoExtension = Path.GetExtension(model.PhotoFile.FileName);

            //Add Current Date and time To Attached File Name
            PhotoName = DateTime.Now.ToString("yyyyMMddhhmmss") + "-" + PhotoName.Trim() + PhotoExtension;
            string PhotoPath = Path.Combine(Server.MapPath("~/Image"), PhotoName);

            model.PhotoFile.SaveAs(PhotoPath);

            wf_emp wfemp = new wf_emp
            {
                Photo      = PhotoName,
                Resume     = ResumeName,
                Id         = model.id,
                Employeeid = model.Eemployeeid,
                Name       = model.Name,
                Dob        = model.Dob,
                Gender     = model.Gender,
                Address    = model.Address,
                City       = model.City,
                Email      = model.Email,
                Mobile     = model.Mobile,
                Position   = model.Positon,
                HireDate   = model.HireDate,
                Experience = model.Experience,
                Password   = model.Password
            };

            db.wf_emp.Add(wfemp);
            db.SaveChanges();

            //using (MailMessage mm = new MailMessage(new MailAddress("*****@*****.**", "Highfive Rewards"), new MailAddress(model.Email)))
            //	//customise name here
            //{
            //	try
            //	{
            //		//customise subject here
            //		mm.Subject = "Welcome to Highfive Reward!";
            //		//customise mail body here
            //		mm.Body = "<a href='http://xyz.com/account/verify/code'>Hello, Thanks for Register with us!!</a>";
            //		mm.IsBodyHtml = true;
            //		SmtpClient smtp = new SmtpClient();
            //		smtp.Host = /*"smtp-mail.outlook.com";*/"smtp.gmail.com";
            //		smtp.EnableSsl = true;
            //		NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "dotnetmvc");
            //		smtp.UseDefaultCredentials = false;                   //email & password
            //		smtp.Credentials = NetworkCred;
            //		smtp.Port = 587;
            //		smtp.Send(mm);
            //	}
            //	catch (Exception ex)
            //	{
            //		throw ex;
            //	}
            //}

            TempData["Success"] = "Employee data added successfully.";
            return(RedirectToAction("Addemployee", "Home"));
        }