private void PopulateStepDataset() { if (this.stepDataset.GetRollYearManagement.Rows.Count > 0) { this.UserControlPanel.Controls.Clear(); int Yaxis = 0; for (int i = 0; i < this.stepDataset.GetRollYearManagement.Rows.Count; i++) { F9080RollYearManagementData.GetRollYearManagementRow GetRollYearRow = (F9080RollYearManagementData.GetRollYearManagementRow) this.stepDataset.GetRollYearManagement.Rows[i]; RollYearStepUserControl rollYearControl = new RollYearStepUserControl(); //rollYearControl = new RollYearStepUserControl(); rollYearControl.Name = "RollYearUserControl" + i; int IsCurrentStep; int.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["IsCurrentStep"].ToString(), out IsCurrentStep); if (IsCurrentStep > 0) { rollYearControl.CurrentStep = true; } else { rollYearControl.CurrentStep = false; } //rollYearControl.CurrentStep = IsCurrentStep; int IsComplete; int.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["IsComplete"].ToString(), out IsComplete); if (this.stepDataset.GetRollYearManagement.Rows[i]["IsComplete"].Equals(true)) { rollYearControl.Complete = true; } else { rollYearControl.Complete = false; } rollYearControl.StepNumbertextbox = this.stepDataset.GetRollYearManagement.Rows[i]["Step"].ToString(); rollYearControl.StepDescriptiontextbox = this.stepDataset.GetRollYearManagement.Rows[i]["Description"].ToString(); rollYearControl.StepRunDatetextbox = this.stepDataset.GetRollYearManagement.Rows[i]["RunDate"].ToString(); rollYearControl.StepRunBytextbox = this.stepDataset.GetRollYearManagement.Rows[i]["RunBy"].ToString(); short rollOver; short.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["RollOverID"].ToString(), out rollOver); rollYearControl.RollOverID = rollOver; rollYearControl.WarningMsg = this.stepDataset.GetRollYearManagement.Rows[i]["WarningText"].ToString(); rollYearControl.StepButtonHandler += new RollYearStepUserControl.StepClickEventHandler(rollYearControl_StepButtonHandler); this.UserControlPanel.Controls.Add(rollYearControl); rollYearControl.Location = new System.Drawing.Point(-1, Yaxis); Yaxis = Yaxis + rollYearControl.Height - 1; } } this.ScrollBarVisibility(); }
/// <summary> /// Handles the StepClickEventHandler event of the withPoints control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void rollYearControl_StepButtonHandler(object sender, short rollOverId, RollYearStepUserControl tempControl) { try { this.RollYearInterimControl = tempControl; this.rollOverID = rollOverId; this.StepTimer.Tick += new EventHandler(StepTimer_Tick); this.StepTimer.Start(); this.Closeform = true; } catch (Exception ex) { ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }
private void StepTimer_Tick(object sender, EventArgs e) { try { if (this.Closeform) { DataRow[] clickbutton = this.stepDataset.GetRollYearManagement.Select("RollOverId=" + this.rollOverID); if (clickbutton.Length > 0) { //int CONTROL = this.form9080Control.WorkItem.F9080_ExecRollYearStep(this.rollOverID, TerraScanCommon.UserId); string returnMessage = this.form9080Control.WorkItem.F9080_ExecRollYearStep(this.rollOverID, TerraScanCommon.UserId); //if (CONTROL.Equals(1)) if (returnMessage != null && !string.IsNullOrEmpty(returnMessage)) { this.StepTimer.Stop(); MessageBox.Show(returnMessage, "TerraScan – Roll Over Step Result", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.StepTimer.Stop(); } DateTime dt = DateTime.Now; String.Format("{0:d}", dt); string date = dt.ToString(); string user = TerraScanCommon.UserName; String.Format("{0:M/d/yyyy}", dt); //RollYearInterimControl.StepRunDatetextbox RollYearInterimControl.StepRunBytextbox = user; RollYearInterimControl.StepRunDatetextbox = dt.ToShortDateString(); RollYearInterimControl.StepButtontext = "Step Complete"; this.LastCompleteMethod(); //this.StepTimer.Stop(); short stepYear; int UserControlCount; int.TryParse(RollYearInterimControl.Name.Replace("RollYearUserControl", "").Trim(), out UserControlCount); if (this.stepDataset.GetRollYearManagement.Rows.Count > UserControlCount + 1) { int Count = UserControlCount + 1; //RollYearStepUserControl sa = new RollYearStepUserControl(); string sas = "RollYearUserControl" + Count; // RollYearInterimControl = sas; Control[] ctrl = this.Controls.Find(sas, true); ((TerraScan.RollYearStep.RollYearStepUserControl)(ctrl[0])).CurrentStep = true; } short.TryParse(this.RollYearCombobox.Text.ToString(), out stepYear); this.stepDataset = this.form9080Control.WorkItem.F9080_GetRollYearManagement(stepYear, TerraScanCommon.UserId); //this.PopulateStepDataset(); for (int i = 0; i < this.stepDataset.GetRollYearManagement.Rows.Count; i++) { //F9080RollYearManagementData.GetRollYearManagementRow GetRollYearRow = (F9080RollYearManagementData.GetRollYearManagementRow)this.stepDataset.GetRollYearManagement.Rows[i]; //RollYearStepUserControl rollYearControl = new RollYearStepUserControl(); // int Count = UserControlCount + 1; //RollYearStepUserControl sa = new RollYearStepUserControl(); string sas = "RollYearUserControl" + i; Control[] ctrl = this.Controls.Find(sas, true); RollYearStepUserControl rollYearControl = ((TerraScan.RollYearStep.RollYearStepUserControl)(ctrl[0])); rollYearControl.Name = "RollYearUserControl" + i; int IsCurrentStep; int.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["IsCurrentStep"].ToString(), out IsCurrentStep); if (IsCurrentStep > 0) { rollYearControl.CurrentStep = true; } else { rollYearControl.CurrentStep = false; } //rollYearControl.CurrentStep = IsCurrentStep; int IsComplete; int.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["IsComplete"].ToString(), out IsComplete); if (this.stepDataset.GetRollYearManagement.Rows[i]["IsComplete"].Equals(true)) { rollYearControl.Complete = true; } else { rollYearControl.Complete = false; } rollYearControl.StepNumbertextbox = this.stepDataset.GetRollYearManagement.Rows[i]["Step"].ToString(); rollYearControl.StepDescriptiontextbox = this.stepDataset.GetRollYearManagement.Rows[i]["Description"].ToString(); rollYearControl.StepRunDatetextbox = this.stepDataset.GetRollYearManagement.Rows[i]["RunDate"].ToString(); rollYearControl.StepRunBytextbox = this.stepDataset.GetRollYearManagement.Rows[i]["RunBy"].ToString(); short rollOver; short.TryParse(this.stepDataset.GetRollYearManagement.Rows[i]["RollOverID"].ToString(), out rollOver); rollYearControl.RollOverID = rollOver; rollYearControl.WarningMsg = this.stepDataset.GetRollYearManagement.Rows[i]["WarningText"].ToString(); } // this.StepTimer.Stop(); this.Closeform = false; // else // { // this.StepTimer.Stop(); // this.Closeform = false; // } } else { this.StepTimer.Stop(); this.Closeform = false; } } } catch (Exception ex) { this.StepTimer.Stop(); this.Closeform = false; ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm); } }