Exemple #1
0
        //===================================================Method to Send Reminder Email //Insert reminder email details in email Queue  =========================================================================
        /// <summary>
        /// Method to Send Reminder Email //Insert reminder email details in email Queue
        /// </summary>
        public static void SendReminderEmail()
        {
            ExceptionLogsRepositery exceptionLogsRepositery     = new ExceptionLogsRepositery();
            UsersRepositery         _UsersRepositeryObject      = new UsersRepositery();
            EmailQueueRepositery    _EmailQueueRepositeryObject = new EmailQueueRepositery();
            EmailLogsRepositery     _EmailLogsRepositeryObject  = new EmailLogsRepositery();
            TaskRepositery          _TaskRepositertyObject      = new TaskRepositery();

            List <Users>     usersList             = new List <Users>();
            List <EmailLogs> emailLogsList         = new List <EmailLogs>();
            List <Task>      taskList              = new List <Task>();
            List <EmailLogs> emailLogsListReminder = new List <EmailLogs>();
            string           hostname              = Dns.GetHostName();

            try
            {
                //get all users detail int usersList
                usersList = _UsersRepositeryObject.GetAllUsers();

                //Remove admin details
                usersList.RemoveAll(x => x.RoleId == 1);

                //get detail of user who have submitted there task today from task table
                taskList = _TaskRepositertyObject.GetTaskDetailOfTodaySubmittedTask();

                //list of user who have not submitted there task today //remove the user who have submitted there task
                usersList.RemoveAll(x => taskList.Exists(i => x.Id == i.EmployeeId));

                string logo = "ftp://[email protected]/Content/Image/Logo.jpg";
                if (usersList.Count > 0)
                {
                    //insert email detail into email Queue
                    foreach (Users item in usersList)
                    {
                        _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", item.Email, "Task Reminder", "<html>Dear Employee,<br/><br/><br/>You have not submitted your today's task detail. Don't forget to submit your task.<br/><br/><b>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://demo8.clanstech.com/Content/Image/logo.jpg" + "><br/><br/></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");
                        Console.WriteLine("Email details inserting to Email Queue : " + item.Email);
                    }
                }
            }
            catch (Exception ex)
            {
                string     error = ex.Message;
                MethodBase site  = MethodBase.GetCurrentMethod();
                //HttpRequest request = HttpContext.Current.Request;
                string url = "";// request.Url.AbsoluteUri;
                Console.WriteLine("Exception occurred in inserting into email queue for reminder");
                Console.WriteLine("Message : " + ex.Message);
                Console.WriteLine("StackTrace : " + ex.StackTrace);
                Console.WriteLine("Data : " + ex.Data);
                Console.WriteLine("Source : " + ex.Source);
                Console.WriteLine("Method" + site.Name.ToString());
                exceptionLogsRepositery.InsertException(ex, url, site.Name);
            }
        }
Exemple #2
0
        public ActionResult ForgotPassword(Login login)
        {
            Guid guid = Guid.NewGuid();

            user = _UsersRepositeryObject.GetUserDetailUsingEmail(login.Email);
            if (user == null)
            {
                TempData["Message"] = "Invalid Email Id: Resend password reset link";
                return(RedirectToAction("ForgotPassword"));
            }
            string from    = "*****@*****.**";
            string to      = login.Email;
            string subject = "Password Reset";
            string body    = string.Format("<html>Dear User,<br/><br/><br/> please click the following link to reset your password.<br/><br/> <a href = http://" + Request.Url.Host + ":" + Request.Url.Port + Url.Action("ResetPassword", "Home", new { id = user.Password }) + ">" + "Click Here to Reset" + "</a><br/><br/>Thanks & regards<br/><br/><img width=196 height=153 src=" + "https://" + Request.Url.Authority + "/Content/Image/Logo.jpg" + "></b><br/><br/><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");

            //_EmailObject.SendEmail(from, to, subject, body);
            _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue(from, to, subject, body);
            TempData["Message"] = "Password reset link has been successfully send to your Email Id";
            return(RedirectToAction("ForgotPassword"));
        }
        public ActionResult CreateUser([Bind(Include = "Id,Name,Phone,Email,Password,RoleId,CreatedOn,ModifiedOn,DeletedOn,IsDeleted,EmployeeId")] Users users)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //validate if user all ready registered
                    Users sucess = _UsersRepositeryObject.GetUserDetailUsingEmailAndEmployeeId(users.Email, users.EmployeeId);
                    if (sucess == null)
                    {
                        users.CreatedOn  = DateTime.Now;
                        users.ModifiedOn = DateTime.Now;
                        //To get the hash password
                        string password     = users.Password;
                        string hashPassword = _HashPasswordObject.GetHashPassword(users.Password);
                        users.Password = hashPassword;
                        _UsersRepositeryObject.CreateUser(users);
                        //Send Email to emplyee //With login credentials for task tracker
                        _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", users.Email, "Task Tracker Login Credentials", "<html>Dear " + users.Name + ",<br/><br/><br/>Your account for Task Tracker has been created. Please submit your task details befor leaving the office.<br/><br/><b>Login Id: </b>" + users.Email + "<br/><b>Password: </b>" + password + "<br/><br/><br/>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://" + Request.Url.Authority + "/Content/Image/logo.jpg" + "></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");
                        TempData["Message"] = "Employee Created Successfully";
                        return(RedirectToAction("UserIndex"));
                    }
                    else
                    {
                        TempData["Message"] = "Error : User All ready registered : Try Again";
                        return(RedirectToAction("CreateUser"));
                    }
                }
            }
            catch (Exception ex)
            {
                MethodBase site = MethodBase.GetCurrentMethod();
                string     url  = Request.Url.ToString();
                _ExceptionLogsRepositeryObject.InsertException(ex, url, site.Name);
            }


            ViewBag.RoleId = new SelectList(db.Role, "Id", "Type", users.RoleId);
            return(View(users));
        }
Exemple #4
0
        public ActionResult CreateTask([Bind(Include = "Id,Title,Description,DateTime,EmployeeId,CreatedOn,ModifiedOn,DeletedOn,IsDeleted")] Task task, HttpPostedFileBase[] files)
        {
            int  taskId;
            bool success;

            try
            {
                if (ModelState.IsValid)
                {
                    task.EmployeeId = Convert.ToInt32(Session["UserId"]);
                    //Check if employee submnitted Today's task
                    success = _TaskRepositeryObject.CheckTodayTaskByEmployeeId(task.EmployeeId);
                    if (success == true)
                    {
                        TempData["Message"] = "Multiple task can't be submitted for a day.";
                        return(RedirectToAction("EmployeeDashboard", "Home"));
                    }
                    taskId = _TaskRepositeryObject.CreateTask(task);

                    //for file upload

                    if (files[0] != null)
                    {
                        foreach (HttpPostedFileBase file in files)
                        {
                            string fileName = Path.GetFileName(file.FileName);
                            //System.Web.Hosting.HostingEnvironment.MapPath("~/SignatureImages/");
                            //server.MapPath();
                            string path = Path.Combine(HostingEnvironment.MapPath("~/UploadedFile"), fileName);
                            //string path = Path.Combine("ftp://[email protected]/UploadedFile", fileName);
                            string extension = Path.GetExtension(path);
                            file.SaveAs(path);

                            //inserting attachement details into attachment table
                            _AttachmentRepositeryObject.AddAttachment(fileName, path, extension, taskId);
                        }

                        //Mail to Employee
                        //Insert email details into emailQueue table
                        string email = Convert.ToString(Session["UserEmail"]);
                        _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", email, "Task Submitted Successfully", "<html>Dear " + Session["UserName"] + ",<br/><br/><br> You have successfully submitted today's task status.<br/><br/><b>Title: </b>" + task.Title + "<br/><b>Description: </b>" + task.Description + "<br><br/><br>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://" + Request.Url.Authority + "/Content/Image/Logo.jpg" + "></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");

                        if (Session["MentorEmail"] != null)
                        {
                            //Mail to Employee Mentor
                            string mentorEmail = Convert.ToString(Session["MentorEmail"]);
                            //Insert email details into emailQueue table
                            _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", mentorEmail, "Trainee Task Update", "<html>Dear Mentor,<br/><br/><br/> Your trainee have successfully submitted today's task status.<br/><br/><br/><b>Trainee Name: </b>" + Session["UserName"] + "< br/><b>Title: </b>" + task.Title + "<br/><b>Description: </b>" + task.Description + "<br/><br/><br/>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://" + Request.Url.Authority + "/Content/Image/Logo.jpg" + "></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");
                        }
                        ////Mail to Admin
                        //string adminEmail = "*****@*****.**";
                        //////Insert email details into emailQueue table
                        //emailQueueRepositeryObj.InsertEmailDeatailsInEmailQueue("*****@*****.**", adminEmail, "Task", "Dear Admin,<br/> Your Employee have successfully submitted today's task status.<br/>Employee Name:" + Session["UserName"] + "< br/>Title:" + task.Title + "<br/>Description:" + task.Description + "<br>Thanks & Regards.");
                    }
                    else
                    {
                        // Mail to Employee
                        string email = Convert.ToString(Session["UserEmail"]);
                        //Insert email details into emailQueue table
                        _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", email, "Task Submitted Successfully", "<html>Dear " + Session["UserName"] + ",<br/><br/><br/> You have successfully submitted today's task status.<br/><br/><b>Title: </b>" + task.Title + "<br/><b>Description: </b>" + task.Description + "<br/><br/><br/>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://" + Request.Url.Authority + "/Content/Image/Logo.jpg" + "></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");

                        if (Session["MentorEmail"] != null)
                        {
                            //Mail to Employee Mentor
                            string mentorEmail = Convert.ToString(Session["MentorEmail"]);
                            //Insert email details into emailQueue table
                            _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", mentorEmail, "Trainee Task Update", "<html>Dear Mentor,<br/><br/><br/> Your trainee have successfully submitted today's task status.<br/><br/><b>Trainee Name: </b>" + Session["UserName"] + "<br/><b>Title: </b>" + task.Title + "<br/><b>Description: </b>" + task.Description + "<br/><br/><br/>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://" + Request.Url.Authority + "/Content/Image/Logo.jpg" + "></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/>   Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>");
                        }
                        ////Mail to Admin
                        ////Insert email details into emailQueue table
                        //string adminEmail = "*****@*****.**";
                        //emailQueueRepositeryObj.InsertEmailDeatailsInEmailQueue("*****@*****.**", adminEmail, "Task", "Dear Admin,<br/> Your Employee have successfully submitted today's task status.<br/>Employee Name:" + Session["UserName"] + "<br/>Title:" + task.Title + "<br/>Description:" + task.Description + "< br>Thanks & Regards.");
                    }

                    if (Convert.ToInt32(Session["RoleId"]) == 4)
                    {
                        TempData["Message"] = "Task submitted successfullly";
                        return(RedirectToAction("Index", "Tasks"));
                    }
                    else
                    {
                        TempData["Message"] = "Task submitted successfullly";
                        return(RedirectToAction("EmployeeDashboard", "Home"));
                    }
                }
            }
            catch (Exception ex)
            {
                MethodBase site = MethodBase.GetCurrentMethod();
                string     url  = Request.Url.ToString();
                _ExceptionLogsRepositeryObject.InsertException(ex, url, site.Name);
            }

            //ViewBag.EmployeeId = new SelectList(db.Users, "Id", "Name", task.EmployeeId);
            return(View(task));
        }