using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class tabs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["ProjectID"] != null) { // Get the ProjectID from the QueryString int projectID = Convert.ToInt32(Request.QueryString["ProjectID"]); // Get project details for this project from DB dsProjectTableAdapters.tblProjectTableAdapter projectTableAdapter = new dsProjectTableAdapters.tblProjectTableAdapter(); dsProject.tblProjectDataTable dtProject = new dsProject.tblProjectDataTable(); dsProject.tblProjectRow projectRow; dtProject = projectTableAdapter.GetByID(projectID); // We have a single row of data projectRow = (dsProject.tblProjectRow)dtProject.Rows[0]; // Set controls coeRefNumValueLabel.Text = projectRow.COENumber; if (!projectRow.IsGLCodeNull()) { glCodeValueLabel.Text = projectRow.GLCode.ToString(); glCodeTextBox.Text = projectRow.GLCode.ToString(); } else { glCodeValueLabel.Text = "None"; } // Determine if GLCode textbox & button should be displayed // Enable/Disable controls based on role and status ReadWriteManager.SetGLCodeControlPermissions(projectRow.PPStatus, form1); proposalStatusValueLabel.Text = projectRow.PPStatus; projectTitleValueLabel.Text = projectRow.ProjectTitle; } } } protected void updateGLCodeButton_Click(object sender, EventArgs e) { if (Request.QueryString["ProjectID"] != null) { string glCode = glCodeTextBox.Text; // Get the current logged user string modifiedBy = User.Identity.Name; //string modifiedBy = Request.ServerVariables["LOGON_USER"]; int projectID = Convert.ToInt32(Request.QueryString["ProjectID"]); // Get table adapter for Project table dsProjectTableAdapters.tblProjectTableAdapter projectTableAdapter = new dsProjectTableAdapters.tblProjectTableAdapter(); // Call the method to update the database projectTableAdapter.UpdateGLCodeByID(glCode, modifiedBy, projectID); } } }