コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["name"] == null)
            {
                Response.Redirect("/login");
            }
            if (Session["role"] != null && !Session["role"].Equals(Role.Admin))
            {
                Response.Redirect("/login");
            }

            int      userId = Convert.ToInt32(Request.QueryString["id"]);
            UsersDTO user   = UsersBLL.getUserById(userId);

            if (user == null)
            {
                Response.Redirect("/users");
            }

            lbEmail.Text = user.Email;
            lbName.Text  = user.Name;
            lbRole.Text  = user.Role;

            TasksBLL.expiringTask();
        }
コード例 #2
0
        protected void handleUpdateTaskDetail(object sender, EventArgs e)
        {
            // get info task
            string titleTask     = title.Text;
            String startDateTask = startDate.Text;
            String endDateTask   = endDate.Text;
            String statusTask    = status.Value;
            bool   IsPrivate     = privateScope.Checked;

            TasksDTO newTask = new TasksDTO(task.ID, titleTask, startDateTask, endDateTask, statusTask, IsPrivate, task.urlFile);

            // get list partner
            List <int> arr = new List <int>();

            foreach (GridViewRow row in usersGridView.Rows)
            {
                CheckBox checkBox = (CheckBox)row.FindControl("checkbox");
                if (checkBox.Checked)
                {
                    arr.Add(Int32.Parse(usersGridView.DataKeys[row.RowIndex].Value.ToString()));
                }
            }
            TasksBLL.updateTask(newTask, arr);

            Helper.Toast(this, Page.ClientScript, "success", "Update task success");
            TasksBLL.expiringTask();
            renderActionButtons();
            getValueTask();
            initValue();
            renderActionButtons();
            loadDisEnInput();
        }
コード例 #3
0
        private void GridViewTaskBind()
        {
            TasksBLL.expiringTask();

            tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(Convert.ToInt32(Session["id"]));
            tasksGridView.DataBind();

            int userId;

            if (Session["role"].Equals(Role.Admin))
            {
                userId = -1;
                taskListHeader.Text = "ALL TASKS";
                // Change title
                GridViewPublicTasks.Visible  = false;
                taskListPublicHeader.Visible = false;
                // Change grid view
                tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(userId);
                tasksGridView.DataBind();
            }
            else
            {
                userId = Convert.ToInt32(Session["id"]);

                tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(userId);
                tasksGridView.DataBind();

                GridViewPublicTasks.DataSource = TasksBLL.GetAllTasksPublicExcludeUserId(userId);
                GridViewPublicTasks.DataBind();
            }
        }
コード例 #4
0
        private void GridViewTasksDayOfWeek(string datetime, bool onlyMine)
        {
            int userId = -1;

            if (Session["role"] != null && Session["role"].Equals(Role.Admin))
            {
                userId = -1;
            }
            else
            {
                userId = Convert.ToInt32(Session["id"]);
            }

            TasksBLL.expiringTask();

            mondayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 2, datetime, onlyMine);
            mondayDataList.DataBind();

            tuesdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 3, datetime, onlyMine);
            tuesdayDataList.DataBind();

            wednesdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 4, datetime, onlyMine);
            wednesdayDataList.DataBind();

            thursdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 5, datetime, onlyMine);
            thursdayDataList.DataBind();

            fridayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 6, datetime, onlyMine);
            fridayDataList.DataBind();

            saturdayDatList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 7, datetime, onlyMine);
            saturdayDatList.DataBind();
        }
コード例 #5
0
        private void getValueTask()
        {
            TasksBLL.expiringTask();

            int taskId = Convert.ToInt32(Request.QueryString["id"]);

            task = TasksBLL.getTaskByTaskId(taskId);
        }
コード例 #6
0
        protected void HandleCreateTask(object sender, EventArgs e)
        {
            string titleTask     = title.Text;
            String startDateTask = startDate.Text;
            String endDateTask   = endDate.Text;
            String statusTask    = TaskStatus.InProgress;
            bool   IsPrivate     = privateScope.Checked;
            string urlFile       = null;

            if (fileInput.HasFile)
            {
                try
                {
                    string fileName = Path.GetFileName(fileInput.FileName);
                    fileInput.SaveAs(Server.MapPath("~") + "/Upload/" + fileName);
                    urlFile = "/Upload/" + fileName;
                }   catch (Exception ex)
                {
                }
            }

            // find list selected user
            List <int> arr = new List <int>();

            foreach (GridViewRow row in usersGridView.Rows)
            {
                CheckBox checkBox = (CheckBox)row.FindControl("checkbox");
                if (checkBox.Checked)
                {
                    arr.Add(Int32.Parse(usersGridView.DataKeys[row.RowIndex].Value.ToString()));
                }
            }

            TasksDTO task    = new TasksDTO(titleTask, startDateTask, endDateTask, statusTask, IsPrivate, urlFile);
            int      ownerId = Convert.ToInt32(Session["id"].ToString());

            TasksBLL.CreateTask(task, arr, ownerId);

            TasksBLL.expiringTask();
            GridViewTaskBind();
            GridViewUserBind();
            GridViewTasksDayOfWeek(null); // get current date time

            Helper.Toast(this, Page.ClientScript, "success", "Create task sussess");
        }