public ActionResult ForgotPasswordPost(UserEntity userEntity)
        {
            try
            {
                userEntity = userHelper.GetPassword(userEntity);
                if (userEntity != null && !string.IsNullOrEmpty(userEntity.Password))
                {
                    EmailSetting emailSetting = new EmailSetting();
                    string       Body         = System.IO.File.ReadAllText(System.Web.Hosting.HostingEnvironment.MapPath("~/EmailTemplates/ForgotPasswordMail.html"));

                    bool isMailSend = emailSetting.SendMail(userEntity.Email, "", "Forgot Password Notification", Body.Replace("newpassword", userEntity.Password).Replace("currDate", DateTime.Now.ToString("MMMM dd, yyyy")));
                    if (isMailSend)
                    {
                        TempData["Message"] = "Your password sent on your email.";
                    }
                }
                else
                {
                    TempData["Message"] = "Your email does not exists.";
                }
            }
            catch (Exception ex) { TempData["Message"] = "some issue occured. please try again."; }
            return(RedirectToAction("ForgotPassword", "Home"));
        }
        public ActionResult UploadExcel(HttpPostedFileBase FileUpload)
        {
            ServiceProviderHelper serviceProviderHelper = new ServiceProviderHelper();
            string viewName = "";

            try
            {
                if (FileUpload != null)
                {
                    if (FileUpload.ContentType == "application/vnd.ms-excel" || FileUpload.ContentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
                    {
                        string filename = Path.GetFileName(FileUpload.FileName);

                        if (filename.EndsWith(".xlsx") || filename.EndsWith(".xls"))
                        {
                            string targetpath = Server.MapPath("~/UploadExcel/");
                            FileUpload.SaveAs(targetpath + filename);
                            string pathToExcelFile = targetpath + filename;

                            var excelFile    = new ExcelQueryFactory(pathToExcelFile);//
                            var providerList = from provider in excelFile.Worksheet <ServiceProviderEntity>("ProviderList") select provider;
                            var issueList    = from issue in excelFile.Worksheet <IssuesEntity>("IssueList") select issue;

                            //ValidateExcelFile();
                            List <ServiceProviderEntity> serviceProviderEntityList = new List <ServiceProviderEntity>();

                            foreach (var provider in providerList)
                            {
                                if (provider.Name != null)
                                {
                                    ServiceProviderEntity serviceProviderEntity = new ServiceProviderEntity();

                                    serviceProviderEntity.VendorCode     = provider.VendorCode;
                                    serviceProviderEntity.Name           = provider.Name;
                                    serviceProviderEntity.Status         = provider.Status;
                                    serviceProviderEntity.GoLiveDate     = provider.GoLiveDate;
                                    serviceProviderEntity.ProjectManager = provider.ProjectManager;
                                    serviceProviderEntity.Phase          = provider.Phase;
                                    serviceProviderEntity.Fees           = provider.Fees;
                                    serviceProviderEntity.Type           = provider.Type;
                                    serviceProviderEntity.Update         = provider.Update;
                                    //serviceProviderEntity.IssuesList = issueList == null ? null : new List<IssuesEntity>() { new IssuesEntity() { Item = issueList.Where(x => x.ServiceProviderCode == provider.ServiceProviderCode).Select(y => y.Item).FirstOrDefault(), Issue = issueList.Where(x => x.ServiceProviderCode == provider.ServiceProviderCode).Select(y => y.Issue).FirstOrDefault(), Owner = issueList.Where(x => x.ServiceProviderCode == provider.ServiceProviderCode).Select(y => y.Owner).FirstOrDefault() } };

                                    List <IssuesEntity> IssuesEntityList = new List <IssuesEntity>();
                                    foreach (var issue in issueList.Where(i => i.VendorCode == provider.VendorCode))
                                    {
                                        if (issue.Issue != null)
                                        {
                                            IssuesEntity issuesEntity = new IssuesEntity();
                                            issuesEntity.VendorCode = issue.VendorCode;
                                            issuesEntity.Item       = issue.Item;
                                            issuesEntity.Issue      = issue.Issue;
                                            issuesEntity.Owner      = issue.Owner;

                                            IssuesEntityList.Add(issuesEntity);
                                        }
                                    }

                                    if (IssuesEntityList.Count > 0)
                                    {
                                        serviceProviderEntity.IssuesList = IssuesEntityList;
                                    }
                                    serviceProviderEntityList.Add(serviceProviderEntity);
                                }
                            }

                            if (serviceProviderEntityList.Count > 0)
                            {
                                serviceProviderHelper.AddProvider(serviceProviderEntityList);

                                EmailSetting emailSetting = new EmailSetting();
                                string       Body         = System.IO.File.ReadAllText(System.Web.Hosting.HostingEnvironment.MapPath("~/EmailTemplates/ExcelUploadMail.html"));

                                bool isMailSend = emailSetting.SendMail(Convert.ToString(Session["EmailID"]), "", "Provider Details Upload Notification", Body.Replace("currDate", DateTime.Now.ToString("MMMM dd, yyyy")));
                                viewName = "uploadconfirmation";
                            }
                        }
                        else
                        {
                            TempData["Message"] = "Only Excel file format is allowed";
                            viewName            = "AdminDashboard";
                        }
                    }
                    else
                    {
                        TempData["Message"] = "Only Excel file format is allowed";
                        viewName            = "AdminDashboard";
                    }
                }
                else
                {
                    TempData["Message"] = "Please select file.";
                    viewName            = "AdminDashboard";
                }
            }
            catch (Exception ex) { TempData["Message"] = "some issue occured. please try again"; viewName = "AdminDashboard"; }
            return(RedirectToAction(viewName));
        }