protected void UpdateRunStat() { String StatLabel; try { //IAsyncResult MRPStarter; //MRPStarter = (IAsyncResult)Session["MRPChecker"]; DateTime RunStartTime = (DateTime)Session["RunStartTime"]; if (StatusCd.Value.ToString() == "XX") { AllowProcess(true); MRPTimer.Enabled = false; RunStatPanel.Visible = false; StatLabel = "Process complete."; RunStatLabel.Text = StatLabel; RunStatUpdatePanel.Update(); FillGrid(); FillStats(); LoadPreviousDDL(); MainUpdatePanel.Update(); } else { DateTime.Now.Subtract(RunStartTime); StatLabel = "Process '" + ProcessID.Value + "' started at " + RunStartTime.ToString(); StatLabel += ". Process is still running (" + StatusCd.Value.ToString() + ")."; ExecuteLabel.Text = " Process has been executing " + DateTime.Now.Subtract(RunStartTime).Minutes.ToString() + " minutes and " + DateTime.Now.Subtract(RunStartTime).Seconds.ToString() + " seconds. "; dt = CheckError(mrpCalc.GetProcessStatus(ProcessID.Value)); if (dt != null) { StatusCd.Value = dt.Rows[0]["StatusCd"].ToString(); ExecuteGrid.Visible = true; ExecuteGrid.DataSource = dt; ExecuteGrid.DataBind(); } RunStatLabel.Text = StatLabel; RunStatUpdatePanel.Update(); } } catch (Exception ex) { StatLabel = "Process Error " + ex.Message.ToString(); MRPTimer.Enabled = false; } }
protected void RunService() { DateTime RunStartTime; String StatLabel; ResultPanel.Visible = false; MainUpdatePanel.Update(); RunStatPanel.Visible = true; MRPTimer.Enabled = true; ExecuteGrid.DataBind(); ProcessLabel.Text = "MRP now starting. Your Process is number " + ProcessID.Value + "."; RunStatLabel.Text = "Running MRP Process......."; RunStatUpdatePanel.Update(); Session["RunStartTime"] = DateTime.Now; MRPWebReference.MRPWebService mrpWebService = new MRPWebReference.MRPWebService(); MRPStarter = mrpWebService.BeginStartMRPProcess(ProcessID.Value, null, null); //RunStatLabel.Text = MRPStarter.IsCompleted.ToString(); //RunStatLabel.Text = mrpWebService.StartMRPProcess(ProcessID.Value); RunStatUpdatePanel.Update(); }