protected void Button1_Click(object sender, EventArgs e)
        {
            int userId    = Convert.ToInt32(Session["UserLogin"]);
            int ProjectId = Convert.ToInt32(DropDownList1.SelectedValue);

            using (PMTDBContext context = new PMTDBContext())
            {
                Task task = new Task();
                task.TaskDescription = TextBox1.Text.ToString();
                task.DueDate         = Convert.ToDateTime(DropDownList3.SelectedValue);
                task.Priority        = DropDownList4.SelectedItem.Text.ToString();
                task.TaskAssignedTo  = DropDownList2.SelectedItem.Text.ToString();
                task.ProjectID       = Convert.ToInt32(DropDownList1.SelectedValue);

                User user = context.Users.FirstOrDefault(a => a.UserID == userId);
                task.TaskAssignedBy = user.UserName.ToString();

                context.Tasks.Add(task);
                context.SaveChanges();

                Project project = context.Projects.SingleOrDefault(a => a.ProjectID == ProjectId);
                project.NumOfTask += 1;
                context.SaveChanges();
            }
            Response.Redirect("~/ProjectDetails.aspx?ProjectID=" + DropDownList1.SelectedValue.ToString());
        }
Exemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(DropDownList1.SelectedValue) > 0 && Convert.ToInt32(DropDownList2.SelectedValue) > 0)
            {
                int ProjectId = Convert.ToInt32(DropDownList1.SelectedValue);
                using (PMTDBContext context = new PMTDBContext())
                {
                    UsersUnderProject usersUnderProject = new UsersUnderProject();
                    usersUnderProject.ProjectID = Convert.ToInt32(DropDownList1.SelectedValue);
                    usersUnderProject.UserID    = Convert.ToInt32(DropDownList2.SelectedValue);
                    context.UsersUnderProjects.Add(usersUnderProject);
                    context.SaveChanges();

                    Project project = context.Projects.SingleOrDefault(a => a.ProjectID == ProjectId);
                    project.NumOfMember += 1;
                    context.SaveChanges();
                }
                Response.Redirect("/AssignResourcePerson.aspx");
            }
            else
            {
                Response.Write("Please Select Project and User");
            }
            this.loadDropdowns();
            this.loadData();
        }
Exemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(TextBoxName.Text) &&
                !String.IsNullOrWhiteSpace(TextBoxEmail.Text) &&
                !String.IsNullOrWhiteSpace(TextBoxPassword.Text) &&
                RadioButtonList1.SelectedItem != null &&
                ListBox1.SelectedValue != null)
            {
                using (PMTDBContext context = new PMTDBContext())
                {
                    User user = new User();
                    user.UserName      = TextBoxName.Text.ToString();
                    user.Email         = TextBoxEmail.Text.ToString();
                    user.Password      = TextBoxPassword.Text.ToString();
                    user.Status        = RadioButtonList1.SelectedItem.ToString();
                    user.DesignationID = Convert.ToInt32(ListBox1.SelectedValue);
                    context.Users.Add(user);
                    context.SaveChanges();
                }
                Response.Redirect("/AddUser.aspx");
            }
            else
            {
                Label6.Text = "Fill All Info";
                //Response.Write("Fill All Info");
            }

            this.loadUser();
        }
 protected void Button1_Click1(object sender, EventArgs e)
 {
     using (PMTDBContext context = new PMTDBContext())
     {
         Comment comment = new Comment();
         comment.Comment1    = TextBox1.Text.ToString();
         comment.CommentDate = DateTime.Now;
         comment.TaskID      = Convert.ToInt32(DropDownList2.SelectedValue);
         comment.UserID      = Convert.ToInt32(Session["UserLogin"]);
         context.Comments.Add(comment);
         context.SaveChanges();
     }
     Response.Redirect("~/ViewComment.aspx?TaskID=" + DropDownList2.SelectedValue.ToString());
 }
Exemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            HttpPostedFile postedFile = FileUpload1.PostedFile;
            string         fileName   = Path.GetFileName(postedFile.FileName);
            int            fileSize   = postedFile.ContentLength;
            string         filepath   = Server.MapPath("~/uploads");

            if (FileUpload1.HasFile)
            {
                if (fileSize < 4000000)
                {
                    FileUpload1.SaveAs(filepath + "\\" + DateTime.Now.ToFileTime() + " " + FileUpload1.FileName);

                    using (PMTDBContext context = new PMTDBContext())
                    {
                        Project project = new Project();
                        project.ProjectName = ProjectName.Text.ToString();
                        project.CodeName    = CodeName.Text.ToString();
                        project.Description = Description.Text.ToString();
                        project.StartDate   = Convert.ToDateTime(StartDate.Text);
                        project.EndDate     = Convert.ToDateTime(EndDate.Text);
                        project.Status      = RadioButtonList1.SelectedValue.ToString();
                        project.FileName    = DateTime.Now.ToFileTime() + " " + FileUpload1.FileName.ToString();
                        project.NumOfMember = 0;
                        project.NumOfTask   = 0;
                        context.Projects.Add(project);
                        context.SaveChanges();
                    }
                    Response.Redirect("~/AddProject.aspx");
                }
                else
                {
                    Label9.Text = "File size is too large";
                }
            }
            else
            {
                Label9.Text = "No file selected";
            }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            var value = Convert.ToInt32(Request.QueryString["UserID"]);

            if (value > 0 || Request.QueryString["UserID"] != null)
            {
                if (RadioButtonList1.SelectedItem != null && ListBox1.SelectedValue != null)
                {
                    if (!String.IsNullOrWhiteSpace(TextBoxName.Text.ToString()) && !String.IsNullOrWhiteSpace(TextBoxEmail.Text.ToString()))
                    {
                        using (PMTDBContext context = new PMTDBContext())
                        {
                            User user = context.Users.FirstOrDefault(a => a.UserID == value);
                            if (user != null)
                            {
                                user.UserName      = TextBoxName.Text.ToString();
                                user.Email         = TextBoxEmail.Text.ToString();
                                user.Password      = TextBoxEmail.Text.ToString() + "123";
                                user.Status        = RadioButtonList1.SelectedItem.ToString();
                                user.DesignationID = Convert.ToInt32(ListBox1.SelectedValue);
                                context.SaveChanges();
                                Response.Redirect("/AddUser.aspx");
                            }
                        }
                    }
                    else
                    {
                        Label6.Text = "No field can be empty";
                    }
                }
                else
                {
                    Label6.Text = "Select Status and Designation";
                }
            }
            else
            {
                Response.Write("URL error");
            }
        }