public void SendForm(int _answerid, bool _san, bool _tsm) { oPDF.CreateDocuments(_answerid, _san, _tsm, null, true, true, true, false, boolUsePNCNaming, false); }
public string InitiateNextStep(int _requestid, int _answerid, int _modelid, int _environment, int _assign_pageid, int _view_pageid, string _dsn_asset, string _dsn_ip, string _dsn_service_editor, bool _initiate_next_step) { string strError = ""; // Generate Next Task... Forecast oForecast = new Forecast(0, dsn); Classes oClass = new Classes(0, dsn); Users oUser = new Users(0, dsn); Variables oVariable = new Variables(_environment); Functions oFunction = new Functions(0, dsn, _environment); Servers oServer = new Servers(0, dsn); Log oLog = new Log(0, dsn); DataSet dsServers = oServer.GetAnswer(_answerid); int intClass = 0; Int32.TryParse(oForecast.GetAnswer(_answerid, "classid"), out intClass); bool boolPNC = (oClass.Get(intClass, "pnc") == "1"); oLog.AddEvent(_answerid, "", "", "InitiateNextStep(" + _answerid + ")", LoggingType.Debug); bool boolStarted = true; bool boolCompleted = true; bool boolFinished = true; bool boolReady = true; int intServer = 0; foreach (DataRow drServer in dsServers.Tables[0].Rows) { intServer = Int32.Parse(drServer["id"].ToString()); if (boolStarted == true) { boolStarted = (drServer["build_started"].ToString() != ""); } if (boolCompleted == true) { boolCompleted = (drServer["build_completed"].ToString() != ""); } DataSet dsSteps = GetStepsDesign(_answerid, 0, intServer); foreach (DataRow drStep in dsSteps.Tables[0].Rows) { //if (drStep["non_transparent"].ToString() != "1" && (drStep["created"].ToString() == "" || drStep["completed"].ToString() == "")) if (drStep["created"].ToString() == "" || drStep["completed"].ToString() == "") { // One or more tasks are still open oLog.AddEvent(_answerid, "", "", "InitiateNextStep...One or more tasks are still open (" + drStep["name"].ToString() + " ~ " + drStep["created"].ToString() + " ~ " + drStep["completed"].ToString() + " ~ " + drStep["username"].ToString() + ")", LoggingType.Debug); boolFinished = false; // Check to see if it is a Non-Transparent task if (drStep["non_transparent"].ToString() != "1") { // drStep["non_transparent"].ToString() == "0" means that Non-Transparent == false meaning the task is Transparent and is required for READY flag to be set. oLog.AddEvent(_answerid, "", "", "InitiateNextStep...A transparent task is open so design is not ready for Birth Certificate", LoggingType.Debug); boolReady = false; } } } } if (_initiate_next_step == true) { if (boolFinished == false) { // Initiate Next Step oServer.GetExecution(intServer, _environment, _dsn_asset, _dsn_ip, _dsn_service_editor, _assign_pageid, _view_pageid); } else { // All tasks have been completed, close the design for future tasks oForecast.UpdateAnswerFinished(_answerid, DateTime.Now.ToString()); } } if (boolReady == true && boolStarted == true && boolCompleted == true) { oLog.AddEvent(_answerid, "", "", "InitiateNextStep...All transparent tasks are completed. Mark the server(s) as READY and send Birth Certificate", LoggingType.Debug); // All TRANSPARENT tasks are completed, mark the server(s) as READY and send Birth Certificate. if (boolPNC == true) { // Assume the workflow is done and notify requestor(s) and implementors if (_answerid > 0) { // Send Birth Certificate try { PDFs oPDF = new PDFs(dsn, _dsn_asset, _dsn_ip, _environment); oPDF.CreateDocuments(_answerid, false, false, null, true, true, true, false, true, true); oLog.AddEvent(_answerid, "", "", "InitiateNextStep...Birth Certificate sent", LoggingType.Debug); } catch (Exception exB) { strError = "There was a problem sending the Birth Certificate ~ " + exB.Message; string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR,EMAILGRP_PROVISIONING_SUPPORT"); oFunction.SendEmail("ERROR: Sending Birth Certificate Form", strEMailIdsBCC, "", "", "ERROR: Sending Birth Certificate Form", "<p>There was a problem sending the BIRTH CERTIFICATE form for Design # " + _answerid.ToString() + "</p><p>Error Message: " + exB.Message + "</p><p>Source: " + exB.Source + "</p><p>Stack Trace: " + exB.StackTrace + "</p>", true, false); } } } // Update the servers - build is ready. foreach (DataRow drServer in dsServers.Tables[0].Rows) { oServer.UpdateBuildReady(Int32.Parse(drServer["id"].ToString()), DateTime.Now.ToString(), false); } } else { oLog.AddEvent(_answerid, "", "", "InitiateNextStep...Birth Certificate NOT sent", LoggingType.Debug); } return(strError); }