protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { // First time initialisation. Page.Title = TXT_PAGETITLE; this.LblPageTitle.Text = TXT_PAGETITLE; if (Request.QueryString["ProjectId"] == null) Response.Redirect("ProjectMenu.aspx", true); ViewState["ProjectId"] = Request.QueryString["ProjectId"].ToString(); int ProjectId = (int) Convert.ToInt32(ViewState["ProjectId"].ToString()); ClassProject oPrj = new ClassProject(ProjectId); ClassTask oTsk = new ClassTask(); this.LblProject.Text = oPrj.ProjectName; this.DdlTasks.DataSource = oTsk.ShowTasksForProject(ProjectId, false); this.DdlTasks.DataTextField = "TaskName"; this.DdlTasks.DataValueField = "TaskId"; this.DdlTasks.DataBind(); if (Request.QueryString["TaskId"] != null) { try { this.DdlTasks.SelectedValue = Request.QueryString["TaskId"].ToString(); } catch (Exception) { // Do nothing. This isn't an error. It just means that the requested // TaskId isn't in the dropdown listbox. } } if (this.DdlTasks.Items.Count == 0) { this.BtnDeleteTask.Enabled = false; this.BtnEditTask.Enabled = false; this.DdlTasks.Enabled = false; } } }
public DataSet GetTasksForProject(string UsrNam, string UsrPwd, Int32 ProjectId, Boolean bActiveOnly) { DataSet oDs = null; try { Int32 UserId = GetUserId(UsrNam, UsrPwd); if (UserId > 0) { ClassTask oTsk = new ClassTask(); oDs = oTsk.ShowTasksForProject(ProjectId, bActiveOnly); } } catch (Exception ex) { Log.LogMsg(ex.Message); } return oDs; }
private void ShowTasks() { this.DdlTasks.Enabled = false; if (this.ddlProjects.Items.Count > 0) { ClassTask oTsk = new ClassTask(); DataSet oDs = oTsk.ShowTasksForProject(Convert.ToInt32(this.ddlProjects.SelectedValue), true); if (oDs != null) { if (oDs.Tables.Count > 0) { if (oDs.Tables[0].Rows.Count > 0) { // We have some tasks. this.DdlTasks.Enabled = true; this.DdlTasks.DataSource = oDs; this.DdlTasks.DataTextField = "TaskName"; this.DdlTasks.DataValueField = "TaskId"; this.DdlTasks.DataBind(); ShowJobs(0); } } } } }