示例#1
0
        private void compMatrixGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DBDriver myDB=new DBDriver();
              //retrieve the new values from the datagrid
              TextBox tb;
              tb=(TextBox)e.Item.Cells[1].Controls[0];
              string low=tb.Text;
              tb=(TextBox)e.Item.Cells[2].Controls[0];
              string med=tb.Text;
              tb=(TextBox)e.Item.Cells[3].Controls[0];
              string high=tb.Text;
              string level = e.Item.Cells[0].Text;

              //store new values to DB
              myDB.Query="update compMatrix set lowComplexity=@low, medComplexity=@med, highComplexity=@high where compLevel=@level;";
              myDB.addParam("@low", low);
              myDB.addParam("@med", med);
              myDB.addParam("@high", high);
              myDB.addParam("@level", level);
              myDB.nonQuery();

              //make sure nothing is being edited, and reload the page
              this.compMatrixGrid.EditItemIndex=-1;
              Response.Redirect(Request.Url.AbsolutePath);
        }
示例#2
0
        private void CommitButton_Click(object sender, System.EventArgs e)
        {
            DBDriver db = new DBDriver();

            foreach (DataGridItem itm in DataGrid1.Items)
            {
                CheckBox cb = (CheckBox)itm.FindControl("CompleteCheckBox");
                if(cb.Enabled)
                {
                    db.Query = "update tasks set complete=@complete\n"
                        + "where id=@id;";
                    db.addParam("@complete", cb.Checked?TaskStatus.COMPLETE:TaskStatus.INPROGRESS);
                    db.addParam("@id", itm.Cells[0].Text);
                    db.nonQuery();
                }
            }
            Server.Transfer(Request.Url.AbsolutePath);
        }
示例#3
0
        private void CommitButton_Click(object sender, System.EventArgs e)
        {
            DBDriver db = new DBDriver();

            foreach (DataGridItem itm in DataGrid1.Items)
            {
                CheckBox cb = (CheckBox)itm.FindControl("CompleteCheckBox");
                if (cb.Enabled)
                {
                    db.Query = "update tasks set complete=@complete\n"
                               + "where id=@id;";
                    db.addParam("@complete", cb.Checked?TaskStatus.COMPLETE:TaskStatus.INPROGRESS);
                    db.addParam("@id", itm.Cells[0].Text);
                    db.nonQuery();
                }
            }
            Server.Transfer(Request.Url.AbsolutePath);
        }
        private void Button_Click(object sender, System.EventArgs e)
        {
            if (sender.Equals(this.SaveButton))
            {
                //initialize the DB object
                DBDriver myDB=new DBDriver();
                //set the appropriate SQL query
                myDB.Query="update compLevels"
                    +" set competence=@compLevel"
                    +" where ID=@devID;";
                myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);
                myDB.addParam("@compLevel", CompetenceDropDownList.SelectedValue);
                myDB.nonQuery();
                this.syncCompetenceText();//sync back both inputs to database values.
            }
            else
                syncCompetenceText();

                return;
        }
示例#5
0
        private void CommitButton_Click(object sender, System.EventArgs e)
        {
            DBDriver db = new DBDriver();

            foreach (DataGridItem itm in DataGrid2.Items)
            {
                CheckBox cb = (CheckBox)itm.FindControl("ApproveCheckBox");
                if (cb.Enabled)
                {
                    db.Query =
                        "update tasks\n"
                        + "set complete=@complete, actEndDate=@date\n"
                        + "where id=@id;";
                    db.addParam("@complete", cb.Checked?TaskStatus.APPROVED:TaskStatus.COMPLETE);
                    db.addParam("@date", cb.Checked?Convert.ToString(DateTime.Now):"");
                    db.addParam("@id", itm.Cells[1].Text);
                    db.nonQuery();
                }
            }
            Server.Transfer(Request.Url.AbsolutePath);
        }
示例#6
0
        private void CommitButton_Click(object sender, System.EventArgs e)
        {
            DBDriver db = new DBDriver();

            foreach (DataGridItem itm in DataGrid2.Items)
            {
                CheckBox cb = (CheckBox)itm.FindControl("ApproveCheckBox");
                if(cb.Enabled)
                {
                    db.Query =
                        "update tasks\n"
                        + "set complete=@complete, actEndDate=@date\n"
                        + "where id=@id;";
                    db.addParam("@complete", cb.Checked?TaskStatus.APPROVED:TaskStatus.COMPLETE);
                    db.addParam("@date", cb.Checked?Convert.ToString(DateTime.Now):"");
                    db.addParam("@id", itm.Cells[1].Text);
                    db.nonQuery();
                }
            }
            Server.Transfer(Request.Url.AbsolutePath);
        }
示例#7
0
        private void Button_Click(object sender, System.EventArgs e)
        {
            if (sender.Equals(this.SaveButton))
            {
                //initialize the DB object
                DBDriver myDB = new DBDriver();
                //set the appropriate SQL query
                myDB.Query = "update compLevels"
                             + " set competence=@compLevel"
                             + " where ID=@devID;";
                myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);
                myDB.addParam("@compLevel", CompetenceDropDownList.SelectedValue);
                myDB.nonQuery();
                this.syncCompetenceText();                //sync back both inputs to database values.
            }
            else
            {
                syncCompetenceText();
            }

            return;
        }
示例#8
0
        /// <summary>
        /// Send the message
        /// </summary>
        private void SendButton_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            //string from = user.Name;

            ArrayList toList = new ArrayList();

            foreach (ListItem item in ToListBox.Items)
            {
                toList.Add(item.Value);
            }

            //Message msg = new Message(from, toList, message);

            string time = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
            // insert into database
            DBDriver myDB = new DBDriver();

            myDB.Query =
                "insert into messages (SenderID, Subject, Body, timestamp)\n"
                + "values (@sender, @subject, @body, @time);";
            myDB.addParam("@sender", Request.Cookies["user"]["id"]);
            myDB.addParam("@subject", this.SubjectTextBox.Text);
            myDB.addParam("@body", this.MessageTextBox.InnerText);
            myDB.addParam("@time", time);
            myDB.nonQuery();

            myDB.Query = "select id from messages where timestamp=@time;";
            myDB.addParam("@time", time);
            int mID = Convert.ToInt32(myDB.scalar());

            //insert into the recipients table as well
            for (int i = 0; i < this.ToListBox.Items.Count; i++)
            {
                myDB.Query = "insert into recipients (MessageID, RecipientID, Timestamp) values (@id, @recipient, @time);";
                myDB.addParam("@id", mID);
                myDB.addParam("@recipient", this.ToListBox.Items[i].Value);
                myDB.addParam("@time", time);
                myDB.nonQuery();
            }

            Server.Transfer(Request.Url.AbsolutePath);
        }
示例#9
0
        private void DeveloperDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            /*
             * get developer info and display it ...
             *
             * */


            //initialize the DB object
            DBDriver myDB = new DBDriver();

            //set the appropriate SQL query
            myDB.Query = "select person.ID, firstName, lastName, competence"
                         + " from person, compLevels"
                         + " where person.ID = compLevels.ID and person.ID=@devID;";
            myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);

            //initialize the datareader
            SqlDataReader dr = myDB.createReader();

            //fill the datareader
            dr.Read();

            this.CancelButton.Visible           = true;   //reset buttons
            this.SaveButton.Visible             = true;
            this.CompetenceDropDownList.Visible = true;


            try
            {
                this.devFirstLabel.Text = Convert.ToString(dr["firstName"]);
                this.devLastLabel.Text  = Convert.ToString(dr["lastName"]);
                this.CompetenceDropDownList.SelectedValue = dr["competence"].ToString();
            }
            catch
            {
                this.devFirstLabel.Text = "ERROR";
                this.devLastLabel.Text  = "ERROR";
            }

            myDB.close();



            DeveloperPanel.Visible = true;
        }
示例#10
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
              DBDriver myDB=new DBDriver();
              string mID=Request.QueryString["id"];
              myDB.Query="select u.userName sender, m.subject subject, m.timestamp date, m.body body from users u, messages m where m.ID=@mID and u.ID=m.senderID;";
              myDB.addParam("@mID", mID);

              SqlDataReader dr=myDB.createReader();
              dr.Read();

              this.subjectLabel.Text=Convert.ToString(dr["subject"]);
              this.senderLabel.Text=Convert.ToString(dr["sender"]);
              this.dateLabel.Text=Convert.ToString(dr["date"]);
              this.messageLabel.Text=Convert.ToString(dr["body"]);
              myDB.close();
        }
示例#11
0
        private void syncCompetenceText()
        {
            //initialize the DB object
            DBDriver myDB = new DBDriver();

            //set the appropriate SQL query
            myDB.Query = "select ID, competence"
                         + " from compLevels"
                         + " where compLevels.ID=@devID;";
            myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);
            //initialize the datareader
            SqlDataReader dr = myDB.createReader();

            //fill the datareader
            dr.Read();
            this.CompetenceDropDownList.SelectedValue = Convert.ToString(dr["competence"]);
            myDB.close();
        }
示例#12
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            DBDriver myDB = new DBDriver();
            string   mID  = Request.QueryString["id"];

            myDB.Query = "select u.userName sender, m.subject subject, m.timestamp date, m.body body from users u, messages m where m.ID=@mID and u.ID=m.senderID;";
            myDB.addParam("@mID", mID);

            SqlDataReader dr = myDB.createReader();

            dr.Read();

            this.subjectLabel.Text = Convert.ToString(dr["subject"]);
            this.senderLabel.Text  = Convert.ToString(dr["sender"]);
            this.dateLabel.Text    = Convert.ToString(dr["date"]);
            this.messageLabel.Text = Convert.ToString(dr["body"]);
            myDB.close();
        }
示例#13
0
        private void DeveloperDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            /*
             * get developer info and display it ...
             *
             * */

            //initialize the DB object
            DBDriver myDB=new DBDriver();
            //set the appropriate SQL query
            myDB.Query = "select person.ID, firstName, lastName, competence"
                       + " from person, compLevels"
                       + " where person.ID = compLevels.ID and person.ID=@devID;";
            myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);

            //initialize the datareader
            SqlDataReader dr = myDB.createReader();
            //fill the datareader
            dr.Read();

            this.CancelButton.Visible = true; //reset buttons
            this.SaveButton.Visible = true;
            this.CompetenceDropDownList.Visible= true;

            try
            {
                this.devFirstLabel.Text=Convert.ToString(dr["firstName"]);
                this.devLastLabel.Text=Convert.ToString(dr["lastName"]);
                this.CompetenceDropDownList.SelectedValue = dr["competence"].ToString();
            }
            catch
            {
                this.devFirstLabel.Text="ERROR";
                this.devLastLabel.Text="ERROR";
            }

            myDB.close();

            DeveloperPanel.Visible = true;
        }
示例#14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            clientID = Request.Cookies["user"]["id"];

            if (!Page.IsPostBack)
            {
                // show the projects datagrid
                DBDriver db = new DBDriver();
                db.Query =
                    "select p.ID as projectID, p.Name as projectName, u.ID as managerID, u.userName as managerName\n"
                    + "from projects p, users u, clients c\n"
                    + "where p.ID = c.projectID\n"
                    + "and u.ID = c.managerID\n"
                    + "and c.clientID = @clientID;";
                db.addParam("@clientID", clientID);

                DataSet ds = new DataSet();

                db.createAdapter().Fill(ds);

                DataGrid1.DataSource = ds;
                DataGrid1.DataBind();
            }
        }
示例#15
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            clientID = Request.Cookies["user"]["id"];

            if (!Page.IsPostBack)
            {
                // show the projects datagrid
                DBDriver db = new DBDriver();
                db.Query =
                    "select p.ID as projectID, p.Name as projectName, u.ID as managerID, u.userName as managerName\n"
                    + "from projects p, users u, clients c\n"
                    + "where p.ID = c.projectID\n"
                    + "and u.ID = c.managerID\n"
                    + "and c.clientID = @clientID;";
                db.addParam("@clientID", clientID);

                DataSet ds = new DataSet();

                db.createAdapter().Fill(ds);

                DataGrid1.DataSource = ds;
                DataGrid1.DataBind();
            }
        }
示例#16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            DBDriver myDB=new DBDriver();
            // Put user code to initialize the page here

            string role = Request.Cookies["user"]["role"];
            string userID = Request.Cookies["user"]["id"];

            // fill the contact list
            if (!this.IsPostBack)
            {
                if (role.Equals(PMT.User.Security.CLIENT))
                {
                    myDB.Query=
                        "select u.userName as userName, u.id as ID\n"
                        + "from users u, clients c\n"
                        + "where u.id = c.managerID\n"
                        + "and c.clientID = @clientID;";
                    myDB.addParam("@clientID", userID);
                }
                else
                {
                    myDB.Query="select userName, id from users;";
                }
                DataSet ds2=new DataSet();
                myDB.createAdapter().Fill(ds2);
                //create a datatable to fill the dropdown list from
                DataTable dt=ds2.Tables[0];
                //fill the Contacts list box
                ContactsListBox.DataSource=dt.DefaultView;
                ContactsListBox.DataTextField="userName";
                ContactsListBox.DataValueField="id";
                ContactsListBox.DataBind();

                // fill the inbox
                myDB.Query="select m.ID messID, u.userName sender, m.subject subject, m.timestamp date, m.ID id from users u, messages m, recipients r"
                    +" where r.recipientID=@me and m.ID=r.messageID and u.ID=m.senderID;";
                myDB.addParam("@me", Request.Cookies["user"]["id"]);

                DataSet ds=new DataSet();
                //initialize the data adapter
                //fill the dataset
                myDB.createAdapter().Fill(ds);
                //fill the display grid
                this.MessagesDataGrid.DataSource=ds;
                this.MessagesDataGrid.DataBind();
            }
        }
示例#17
0
 private void MessagesDataGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     //add appropriate warning popup and Database delete statement here
       string delID=this.MessagesDataGrid.Items[e.Item.ItemIndex].Cells[0].Text;
       DBDriver myDB=new DBDriver();
       myDB.Query="delete from recipients where recipientID=@rID and MessageID=@mID;";
       myDB.addParam("@rID", Request.Cookies["user"]["id"]);
       myDB.addParam("@mID", delID);
       myDB.nonQuery();
       Response.Redirect(Request.Url.AbsolutePath);
 }
示例#18
0
        /// <summary>
        /// Send the message
        /// </summary>
        private void SendButton_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
                return;

            //string from = user.Name;

            ArrayList toList = new ArrayList();
            foreach (ListItem item in ToListBox.Items)
            {
                toList.Add(item.Value);
            }

            //Message msg = new Message(from, toList, message);

            string time=DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");
            // insert into database
            DBDriver myDB=new DBDriver();
            myDB.Query=
                "insert into messages (SenderID, Subject, Body, timestamp)\n"
                + "values (@sender, @subject, @body, @time);";
            myDB.addParam("@sender", Request.Cookies["user"]["id"]);
            myDB.addParam("@subject", this.SubjectTextBox.Text);
            myDB.addParam("@body", this.MessageTextBox.InnerText);
            myDB.addParam("@time", time);
            myDB.nonQuery();

            myDB.Query="select id from messages where timestamp=@time;";
            myDB.addParam("@time", time);
            int mID=Convert.ToInt32(myDB.scalar());

            //insert into the recipients table as well
            for(int i=0;i<this.ToListBox.Items.Count;i++)
            {
                myDB.Query="insert into recipients (MessageID, RecipientID, Timestamp) values (@id, @recipient, @time);";
                myDB.addParam("@id", mID);
                myDB.addParam("@recipient", this.ToListBox.Items[i].Value);
                myDB.addParam("@time", time);
                myDB.nonQuery();
            }

            Server.Transfer(Request.Url.AbsolutePath);
        }
示例#19
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            string taskID = Request["taskID"];
            string error  = Request["error"];

            if (error != null)
            {
                //Response.Write("<script type=\"text/javascript\">alert(\""+ error +"\");</script>");
                ErrorLabel.Text = error;
            }

            if (taskID != null)
            {
                AvailDevLabel.Text = "Choose Developer to be assigned to Task " + taskID;
            }

            // fill available developers data grid
            //TODO: FINISH THIS

//			int Threshold = Convert.ToInt32(ThresholdTextBox.Text);

            DBDriver myDB = new DBDriver();
            string   s    = "select p.ID as ID, p.lastName as lastName, p.firstName as firstName,\n"
                            + "u.username as username, c.competence as competence, count(a.devID) as taskCount\n"
                            + "from person p, compLevels c, assignments a, users u\n"
                            + "where p.ID = u.ID\n"
                            + "and u.security = 'Developer'\n"
                            + "and p.ID = a.devID\n"
                            + "and p.ID = c.ID\n"
                            + "group by p.ID, p.lastName, p.firstName, u.userName, c.competence\n"
                            + "having count(a.devID) < 10" // set to 10 for testing
                            + "order by p.lastName;";


//				if(Threshold != -1 )
//					s +="having count(a.devID) < @Threshold";
//
//                    s += "order by p.lastName;";

            myDB.Query = s;
//			if( Threshold != -1 )
//				myDB.addParam( "@Threshold", Threshold );


            DataSet ds = new DataSet();

            myDB.createAdapter().Fill(ds);
            DataGrid1.DataSource = ds;
            DataGrid1.DataBind();

            // fill assignments data grid
            DBDriver myDB2 = new DBDriver();

            s = "select assignments.taskID as taskID, users.ID as devID, users.username as username, tasks.name as taskName, \n"
                + "modules.name as moduleName, projects.name as projectName, assignments.dateAss as date, tasks.complete as complete\n"
                + "from assignments, users, tasks, modules, projects\n"
                + "where users.ID = assignments.devID\n"
                + "and users.security = 'Developer'\n"
                + "and assignments.taskID = tasks.ID\n"
                + "and tasks.moduleID = modules.ID\n"
                + "and modules.projectID = projects.ID\n"
                + "and projects.managerID = @mgrID \n"
                + "order by projects.name, modules.name, tasks.name, users.username;";

            myDB2.Query = s;
            myDB2.addParam("@mgrID", Request.Cookies["user"]["id"]);
            DataSet ads = new DataSet();

            myDB2.createAdapter().Fill(ads);
            DataGrid2.DataSource = ads;
            if (!Page.IsPostBack)
            {
                DataGrid2.DataBind();
            }
        }
示例#20
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            string taskID = Request["taskID"];
            string error = Request["error"];

            if (error != null)
            {
                //Response.Write("<script type=\"text/javascript\">alert(\""+ error +"\");</script>");
                ErrorLabel.Text = error;
            }

            if (taskID != null)
                AvailDevLabel.Text = "Choose Developer to be assigned to Task " + taskID;

            // fill available developers data grid
            //TODO: FINISH THIS

            //			int Threshold = Convert.ToInt32(ThresholdTextBox.Text);

            DBDriver myDB = new DBDriver();
            string s = "select p.ID as ID, p.lastName as lastName, p.firstName as firstName,\n"
                + "u.username as username, c.competence as competence, count(a.devID) as taskCount\n"
                + "from person p, compLevels c, assignments a, users u\n"
                + "where p.ID = u.ID\n"
                + "and u.security = 'Developer'\n"
                + "and p.ID = a.devID\n"
                + "and p.ID = c.ID\n"
                + "group by p.ID, p.lastName, p.firstName, u.userName, c.competence\n"
                + "having count(a.devID) < 10"  // set to 10 for testing
                + "order by p.lastName;";

            //				if(Threshold != -1 )
            //					s +="having count(a.devID) < @Threshold";
            //
            //                    s += "order by p.lastName;";

            myDB.Query = s;
            //			if( Threshold != -1 )
            //				myDB.addParam( "@Threshold", Threshold );

            DataSet ds = new DataSet();
            myDB.createAdapter().Fill(ds);
            DataGrid1.DataSource = ds;
            DataGrid1.DataBind();

            // fill assignments data grid
            DBDriver myDB2 = new DBDriver();
            s = "select assignments.taskID as taskID, users.ID as devID, users.username as username, tasks.name as taskName, \n"
                + "modules.name as moduleName, projects.name as projectName, assignments.dateAss as date, tasks.complete as complete\n"
                + "from assignments, users, tasks, modules, projects\n"
                + "where users.ID = assignments.devID\n"
                + "and users.security = 'Developer'\n"
                + "and assignments.taskID = tasks.ID\n"
                + "and tasks.moduleID = modules.ID\n"
                + "and modules.projectID = projects.ID\n"
                + "and projects.managerID = @mgrID \n"
                + "order by projects.name, modules.name, tasks.name, users.username;";

            myDB2.Query = s;
            myDB2.addParam("@mgrID", Request.Cookies["user"]["id"]);
            DataSet ads = new DataSet();
            myDB2.createAdapter().Fill(ads);
            DataGrid2.DataSource = ads;
            if( !Page.IsPostBack )
                DataGrid2.DataBind();
        }
示例#21
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            if (!this.IsPostBack)
            {
                role = Request.Cookies["user"]["role"];
                userID = Request.Cookies["user"]["id"];

                if (role.Equals(PMT.User.Security.PROJECT_MANAGER))
                {
                    // get all projectes assigned to a project manager
                    DataSet ds = Project.getProjectsDataSet(userID);

                    //create a datatable to fill the dropdown list from
                    DataTable dt=new DataTable();
                    dt=ds.Tables[0];
                    //fill the dropdown list
                    ProjectDropDownList.DataSource=dt.DefaultView;
                    ProjectDropDownList.DataTextField="name";
                    ProjectDropDownList.DataValueField="ID";
                    ProjectDropDownList.DataBind();
                    ProjectDropDownList.Items.Insert(0,"");

                    enableModuleControls(false);
                    enableTaskControls(false);
                }
                else if (role.Equals(PMT.User.Security.DEVELOPER))
                {
                    // get all tasks assigned to a developer
                    DBDriver db = new DBDriver();
                    db.Query = "select t.id, t.name from assignments a, tasks t \n"
                        +"where a.devID = @devID and t.id = a.taskID";
                    db.addParam("@devID", userID);

                    DataSet ds = new DataSet();
                    db.createAdapter().Fill(ds);

                    DataTable dt = new DataTable();
                    dt = ds.Tables[0];

                    // display tasks in the drop down list
                    TaskDropDownList.DataSource=dt.DefaultView;
                    TaskDropDownList.DataTextField="name";
                    TaskDropDownList.DataValueField="id";
                    TaskDropDownList.DataBind();
                    TaskDropDownList.Items.Insert(0,"");

                    enableModuleControls(false);
                    enableProjectControls(false);
                }
                else if (role.Equals(PMT.User.Security.CLIENT))
                {
                    // get all projectes assigned to a client
                    DBDriver db = new DBDriver();
                    db.Query =
                        "select * from projects p, clients c\n"
                        + "where p.id = c.projectID\n"
                        + "and c.clientID = @id;";
                    db.addParam("@id", userID);

                    DataSet ds = new DataSet();
                    db.createAdapter().Fill(ds);

                    //create a datatable to fill the dropdown list from
                    DataTable dt=new DataTable();
                    dt=ds.Tables[0];
                    //fill the dropdown list
                    ProjectDropDownList.DataSource=dt.DefaultView;
                    ProjectDropDownList.DataTextField="name";
                    ProjectDropDownList.DataValueField="ID";
                    ProjectDropDownList.DataBind();
                    ProjectDropDownList.Items.Insert(0,"");

                    enableModuleControls(false);
                    enableTaskControls(false);
                }
            }

            ReportPanel.Visible = false;
        }
示例#22
0
 private void syncCompetenceText()
 {
     //initialize the DB object
     DBDriver myDB=new DBDriver();
     //set the appropriate SQL query
     myDB.Query="select ID, competence"
         +" from compLevels"
         +" where compLevels.ID=@devID;";
     myDB.addParam("@devID", DeveloperDropDownList.SelectedValue);
     //initialize the datareader
     SqlDataReader dr = myDB.createReader();
     //fill the datareader
     dr.Read();
     this.CompetenceDropDownList.SelectedValue = Convert.ToString(dr["competence"]);
     myDB.close();
 }
示例#23
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //initialize the DB object
            DBDriver myDB=new DBDriver();
            //set the appropriate SQL query
            myDB.Query = "select t.ID as taskID, t.name as name, m.name as moduleName, p.name as projectName,\n"
                       + "t.actEndDate as actEndDate, t.complete as complete, a.dateAss as dateAss, a.devID, a.taskID\n"
                       + "from tasks t, assignments a, modules m, projects p\n"
                       + "where t.ID = a.taskID and a.devID = @devID\n"
                       + "and t.moduleID = m.ID\n"
                       + "and m.projectID = p.ID\n"
                       + "order by p.name, m.name, t.name;";
            myDB.addParam("@devID", Request.Cookies["user"]["id"]);

            //initialize the dataset
            DataSet ds=new DataSet();
            //initialize the data adapter
            //fill the dataset;this is updated
            myDB.createAdapter().Fill(ds);
            //fill the display grid
            DataGrid1.DataSource=ds;
            if (!Page.IsPostBack)
                DataGrid1.DataBind();
        }
示例#24
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            if (!this.IsPostBack)
            {
                role   = Request.Cookies["user"]["role"];
                userID = Request.Cookies["user"]["id"];

                if (role.Equals(PMT.User.Security.PROJECT_MANAGER))
                {
                    // get all projectes assigned to a project manager
                    DataSet ds = Project.getProjectsDataSet(userID);

                    //create a datatable to fill the dropdown list from
                    DataTable dt = new DataTable();
                    dt = ds.Tables[0];
                    //fill the dropdown list
                    ProjectDropDownList.DataSource     = dt.DefaultView;
                    ProjectDropDownList.DataTextField  = "name";
                    ProjectDropDownList.DataValueField = "ID";
                    ProjectDropDownList.DataBind();
                    ProjectDropDownList.Items.Insert(0, "");

                    enableModuleControls(false);
                    enableTaskControls(false);
                }
                else if (role.Equals(PMT.User.Security.DEVELOPER))
                {
                    // get all tasks assigned to a developer
                    DBDriver db = new DBDriver();
                    db.Query = "select t.id, t.name from assignments a, tasks t \n"
                               + "where a.devID = @devID and t.id = a.taskID";
                    db.addParam("@devID", userID);

                    DataSet ds = new DataSet();
                    db.createAdapter().Fill(ds);

                    DataTable dt = new DataTable();
                    dt = ds.Tables[0];

                    // display tasks in the drop down list
                    TaskDropDownList.DataSource     = dt.DefaultView;
                    TaskDropDownList.DataTextField  = "name";
                    TaskDropDownList.DataValueField = "id";
                    TaskDropDownList.DataBind();
                    TaskDropDownList.Items.Insert(0, "");

                    enableModuleControls(false);
                    enableProjectControls(false);
                }
                else if (role.Equals(PMT.User.Security.CLIENT))
                {
                    // get all projectes assigned to a client
                    DBDriver db = new DBDriver();
                    db.Query =
                        "select * from projects p, clients c\n"
                        + "where p.id = c.projectID\n"
                        + "and c.clientID = @id;";
                    db.addParam("@id", userID);

                    DataSet ds = new DataSet();
                    db.createAdapter().Fill(ds);

                    //create a datatable to fill the dropdown list from
                    DataTable dt = new DataTable();
                    dt = ds.Tables[0];
                    //fill the dropdown list
                    ProjectDropDownList.DataSource     = dt.DefaultView;
                    ProjectDropDownList.DataTextField  = "name";
                    ProjectDropDownList.DataValueField = "ID";
                    ProjectDropDownList.DataBind();
                    ProjectDropDownList.Items.Insert(0, "");

                    enableModuleControls(false);
                    enableTaskControls(false);
                }
            }

            ReportPanel.Visible = false;
        }