private void LoadWorkstation() { string strName = oFunction.decryptQueryString(Request.QueryString["n"]); txtName.Text = strName; DataSet ds = oWorkstation.GetName(strName); if (ds.Tables[0].Rows.Count > 0) { int intName = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); DataSet dsWorkstation = oWorkstation.GetVirtualName(intName); if (dsWorkstation.Tables[0].Rows.Count > 0) { bool boolAlready = false; int intID = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["id"].ToString()); lblName.Text = oWorkstation.GetName(Int32.Parse(dsWorkstation.Tables[0].Rows[0]["nameid"].ToString())); DataSet dsRebuild = oWorkstation.GetVirtualRebuild(intID); foreach (DataRow drRebuild in dsRebuild.Tables[0].Rows) { if (drRebuild["submitted"].ToString() != "" && drRebuild["scheduled"].ToString() != "" && drRebuild["completed"].ToString() == "" && drRebuild["cancelled"].ToString() == "") { // Submitted, has not completed, is scheduled and is not cancelled DateTime datPower = DateTime.Parse(drRebuild["scheduled"].ToString()); lblAlreadyOn.Text = drRebuild["submitted"].ToString(); lblAlreadyBy.Text = oUser.GetFullName(oRequest.GetUser(Int32.Parse(drRebuild["requestid"].ToString()))); lblAlreadyPower.Text = txtDate.Text = datPower.ToShortDateString(); // status - to do if (drRebuild["started"].ToString() != "") { lblAlreadyStatus.Text = "Powered off on " + DateTime.Parse(drRebuild["turnedoff"].ToString()).ToLongDateString(); lblAlreadyStatus.Text += "<br/>Rebuild started on " + DateTime.Parse(drRebuild["started"].ToString()).ToLongDateString(); } else if (drRebuild["rebuild"].ToString() != "") { lblAlreadyStatus.Text = "Powered off on " + DateTime.Parse(drRebuild["turnedoff"].ToString()).ToLongDateString(); lblAlreadyStatus.Text += "<br/>Will be rebuilt on " + DateTime.Parse(drRebuild["rebuild"].ToString()).ToLongDateString(); } else if (drRebuild["turnedoff"].ToString() != "") { lblAlreadyStatus.Text = "Powered off on " + DateTime.Parse(drRebuild["turnedoff"].ToString()).ToLongDateString(); } else { lblAlreadyStatus.Text = "Will be powered off on " + DateTime.Parse(drRebuild["scheduled"].ToString()).ToLongDateString(); } boolAlready = true; break; } } if (boolAlready == false) { panFound.Visible = true; lblId.Text = intID.ToString(); btnNext.Attributes.Add("onclick", "return ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')" + " && ValidateDateToday('" + txtDate.ClientID + "','The date must occur after today')" + " && ProcessButton(this) && LoadWait()" + ";"); } else { panAlready.Visible = true; btnNext.Enabled = false; } } } else { panWorkstation.Visible = true; btnNext.Enabled = false; } }