private void cleanPeople_Click(object sender, System.EventArgs e) { DBDriver myDB=new DBDriver(); myDB.Query="create table temp(id int);"; myDB.nonQuery(); myDB.Query="insert into temp (id) select id from users;"; myDB.nonQuery(); myDB.Query="insert into temp (id) select id from newUsers;"; myDB.nonQuery(); myDB.Query="delete from person where id not in (select id from temp);"; myDB.nonQuery(); myDB.Query="drop table temp;"; myDB.nonQuery(); }
private void cleanPeople_Click(object sender, System.EventArgs e) { DBDriver myDB = new DBDriver(); myDB.Query = "create table temp(id int);"; myDB.nonQuery(); myDB.Query = "insert into temp (id) select id from users;"; myDB.nonQuery(); myDB.Query = "insert into temp (id) select id from newUsers;"; myDB.nonQuery(); myDB.Query = "delete from person where id not in (select id from temp);"; myDB.nonQuery(); myDB.Query = "drop table temp;"; myDB.nonQuery(); }
private void cleanMail_Click(object sender, System.EventArgs e) { DBDriver myDB = new DBDriver(); myDB.Query = "delete from messages where ID not in (select messageID from recipients);"; myDB.nonQuery(); }
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); }
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); }
/// <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); }
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); }
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 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; }
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); }
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); }
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; }
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); }
/// <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); }
private void cleanMail_Click(object sender, System.EventArgs e) { DBDriver myDB=new DBDriver(); myDB.Query="delete from messages where ID not in (select messageID from recipients);"; myDB.nonQuery(); }