protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            try
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    Project newProject = new Project();
                    newProject.Department = departmentDDL.SelectedValue.ToString();
                    newProject.StartDate = StartDateDatePicker.SelectedDate;
                    newProject.EndDate = EndDateDatePicker.SelectedDate;
                    newProject.UserID = UserIDLabel.Text;
                    newProject.ProjectName = ProjectNameTextBox.Text;
                    newProject.isCompleted = false;

                    TasksEntities db = new TasksEntities();
                    db.Projects.Add(newProject);
                    db.SaveChanges();
                }

            }
            catch (Exception)
            {

            }
        }
        protected void FinishButton_Click(object sender, EventArgs e)
        {
            try
            {
                int           taskID = Convert.ToInt32(queryString);
                TasksEntities db     = new TasksEntities();


                var taskQuery = from b in db.Tasks where b.TaskID == taskID select b;

                Task selectedTask = taskQuery.Single();

                selectedTask.isCompleted  = true;
                selectedTask.FinishedDate = DateTime.Now;
                selectedTask.Remarks      = NoteTextBox.Text;

                db.SaveChanges();
                DetailsView1.DataBind();

                //todo email the creator of the tasks

                MembershipUser assignedUser = Membership.GetUser(selectedTask.assignedUser);
                MembershipUser TaskCreator  = Membership.GetUser(selectedTask.Creator);



                var message = new MailMessage("*****@*****.**", TaskCreator.Email);
                //// here is an important part:
                message.From = new MailAddress("*****@*****.**", "Tasks Managers");
                message.CC.Add(assignedUser.Email);
                message.IsBodyHtml = true;
                message.Subject    = "Task has finished";



                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.AbsoluteUri +" for more details.<br>"+newTask.TaskID.ToString()+"  "+newTask.TaskName+" <br> " +newTask.TaskDescription;
                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:"+newTask.TaskName+" <br> Task Description: " +newTask.TaskDescription;
                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.Host.ToLower() + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription; ==> this still spew ip address
                message.Body = "Your task created/assigned by/to you has finished. Please access: " + global.DomainName + "/TasksDetails.aspx?TaskID=" + queryString + " for more details.<br>Task Name:" + selectedTask.TaskName + " <br> Task Description: " + selectedTask.TaskDescription;

                var client = new SmtpClient();
                client.EnableSsl = true;
                client.Send(message);
            }
            catch (Exception)
            {
            }
        }
Exemple #3
0
        protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            try
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    Task newTask = new Task();
                    newTask.ProjectID       = Convert.ToInt32(DdlProjectID.SelectedValue);
                    newTask.TaskName        = TaskTextBox.Text;
                    newTask.TaskDescription = TxtTaskDescription.Text;
                    newTask.StartDate       = StartDateTimePicker.SelectedDate;
                    newTask.EndDate         = EndDateTimePicker.SelectedDate;
                    newTask.assignedUser    = UserIDDDL.SelectedValue;
                    newTask.Creator         = userIDLabel.Text;
                    newTask.isCompleted     = false;

                    TasksEntities db = new TasksEntities();
                    db.Tasks.Add(newTask);
                    db.SaveChanges();

                    MembershipUser selectedMember = Membership.GetUser(newTask.assignedUser);


                    var message = new MailMessage("*****@*****.**", selectedMember.Email);
                    //// here is an important part:
                    message.From       = new MailAddress("*****@*****.**", "Tasks Managers");
                    message.IsBodyHtml = true;
                    message.Subject    = "New task assigned";



                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.AbsoluteUri +" for more details.<br>"+newTask.TaskID.ToString()+"  "+newTask.TaskName+" <br> " +newTask.TaskDescription;
                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:"+newTask.TaskName+" <br> Task Description: " +newTask.TaskDescription;
                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.Host.ToLower() + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription; ==> this still spew ip address
                    message.Body = "You have a new task assigned to you. Please access: " + global.DomainName + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription;

                    var client = new SmtpClient();
                    client.EnableSsl = true;
                    client.Send(message);
                }
            }
            catch (Exception)
            {
            }
        }
        protected void FinishButton_Click(object sender, EventArgs e)
        {
            try
            {
                int taskID = Convert.ToInt32(queryString);
                TasksEntities db = new TasksEntities();

                var taskQuery = from b in db.Tasks where b.TaskID == taskID select b;

                Task selectedTask = taskQuery.Single();

                selectedTask.isCompleted = true;
                selectedTask.FinishedDate = DateTime.Now;
                selectedTask.Remarks = NoteTextBox.Text;

                db.SaveChanges();
                DetailsView1.DataBind();

                //todo email the creator of the tasks

                MembershipUser assignedUser = Membership.GetUser(selectedTask.assignedUser);
                MembershipUser TaskCreator = Membership.GetUser(selectedTask.Creator);

                var message = new MailMessage("*****@*****.**", TaskCreator.Email);
                //// here is an important part:
                message.From = new MailAddress("*****@*****.**", "Tasks Managers");
                message.CC.Add(assignedUser.Email);
                message.IsBodyHtml = true;
                message.Subject = "Task has finished";

                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.AbsoluteUri +" for more details.<br>"+newTask.TaskID.ToString()+"  "+newTask.TaskName+" <br> " +newTask.TaskDescription;
                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:"+newTask.TaskName+" <br> Task Description: " +newTask.TaskDescription;
                //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.Host.ToLower() + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription; ==> this still spew ip address
                message.Body = "Your task created/assigned by/to you has finished. Please access: " + global.DomainName + "/TasksDetails.aspx?TaskID=" + queryString + " for more details.<br>Task Name:" + selectedTask.TaskName + " <br> Task Description: " + selectedTask.TaskDescription;

                var client = new SmtpClient();
                client.EnableSsl = true;
                client.Send(message);

            }
            catch (Exception)
            {

            }
        }
        protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            try
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    Task newTask = new Task();
                    newTask.ProjectID = Convert.ToInt32( DdlProjectID.SelectedValue);
                    newTask.TaskName = TaskTextBox.Text;
                    newTask.TaskDescription = TxtTaskDescription.Text;
                    newTask.StartDate = StartDateTimePicker.SelectedDate;
                    newTask.EndDate = EndDateTimePicker.SelectedDate;
                    newTask.assignedUser = UserIDDDL.SelectedValue;
                    newTask.Creator = userIDLabel.Text;
                    newTask.isCompleted = false;

                    TasksEntities db = new TasksEntities();
                    db.Tasks.Add(newTask);
                    db.SaveChanges();

                    MembershipUser selectedMember = Membership.GetUser(newTask.assignedUser);

                    var message = new MailMessage("*****@*****.**", selectedMember.Email);
                    //// here is an important part:
                    message.From = new MailAddress("*****@*****.**", "Tasks Managers");
                    message.IsBodyHtml = true;
                    message.Subject = "New task assigned";

                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.AbsoluteUri +" for more details.<br>"+newTask.TaskID.ToString()+"  "+newTask.TaskName+" <br> " +newTask.TaskDescription;
                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:"+newTask.TaskName+" <br> Task Description: " +newTask.TaskDescription;
                    //message.Body = "You have a new task assigned to you. Please access: " + HttpContext.Current.Request.Url.Host.ToLower() + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription; ==> this still spew ip address
                    message.Body = "You have a new task assigned to you. Please access: " + global.DomainName  + "/TasksDetails.aspx?TaskID=" + newTask.TaskID.ToString() + " for more details.<br>Task Name:" + newTask.TaskName + " <br> Task Description: " + newTask.TaskDescription;

                    var client = new SmtpClient();
                    client.EnableSsl = true;
                    client.Send(message);

                }
            }
            catch (Exception)
            {

            }
        }
        protected void addNewDepartmentsButton_Click(object sender, EventArgs e)
        {
            try
            {
                Department newDept = new Department();
                newDept.Department1 = DepartmentTextBox.Text;

                // db = new Project();
                TasksEntities db = new TasksEntities();
                db.Departments.Add(newDept);
                db.SaveChanges();

                DepartmentTextBox.Text = "";
                DeptDataGrid.DataBind();
            }
            catch (Exception)
            {
            }
        }
        protected void addNewDepartmentsButton_Click(object sender, EventArgs e)
        {
            try
            {
                Department newDept = new Department();
                newDept.Department1 = DepartmentTextBox.Text;

                // db = new Project();
                TasksEntities db = new TasksEntities();
                db.Departments.Add(newDept);
                db.SaveChanges();

                DepartmentTextBox.Text = "";
                DeptDataGrid.DataBind();

            }
            catch (Exception)
            {

            }
        }
        protected void SubmitRectificationButton_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                try
                {
                    Rectification newRect = new Rectification();
                    newRect.RectificationDate  = DateTime.Now;
                    newRect.TaskID             = Convert.ToInt32(queryString);
                    newRect.RectificationNotes = RectificationTextBox.Text;
                    newRect.userID             = User.Identity.Name.ToString();

                    TasksEntities db = new TasksEntities();
                    db.Rectifications.Add(newRect);
                    db.SaveChanges();
                    RectificationsDataGrid.DataBind();
                }
                catch (Exception)
                {
                }
            }
        }
Exemple #9
0
        protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            try
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    Project newProject = new Project();
                    newProject.Department  = departmentDDL.SelectedValue.ToString();
                    newProject.StartDate   = StartDateDatePicker.SelectedDate;
                    newProject.EndDate     = EndDateDatePicker.SelectedDate;
                    newProject.UserID      = UserIDLabel.Text;
                    newProject.ProjectName = ProjectNameTextBox.Text;
                    newProject.isCompleted = false;

                    TasksEntities db = new TasksEntities();
                    db.Projects.Add(newProject);
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
            }
        }
        protected void SubmitRectificationButton_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                try
                {
                    Rectification newRect = new Rectification();
                    newRect.RectificationDate = DateTime.Now;
                    newRect.TaskID = Convert.ToInt32(queryString);
                    newRect.RectificationNotes = RectificationTextBox.Text;
                    newRect.userID = User.Identity.Name.ToString();

                    TasksEntities db = new TasksEntities();
                    db.Rectifications.Add(newRect);
                    db.SaveChanges();
                    RectificationsDataGrid.DataBind();
                }
                catch (Exception)
                {

                }
            }
        }