Ejemplo n.º 1
0
 public AssetSharedEnvOrder(int _user, string _dsnCV, string _dsnCVAsset, int _environment)
 {
     intUser        = _user;
     dsnCV          = _dsnCV;
     dsnCVAsset     = _dsnCVAsset;
     intEnvironment = _environment;
     oVariable      = new Variables(intEnvironment);
     oFunction      = new Functions(0, dsnCV, intEnvironment);
     oModelProperty = new ModelsProperties(intUser, dsnCV);
     oModel         = new Models(intUser, dsnCV);
     oAsset         = new Asset(intUser, dsnCVAsset);
 }
Ejemplo n.º 2
0
        public void SystemError(int _serverid, int _workstationid, int _stepid, string _error, int _assetid, int _modelid, bool _is_vmware, VMWare _vmware, int _environment, string _dsn_asset)
        {
            int intError = 0;

            if (_stepid > 0)
            {
                string   strName   = "";
                string   strType   = "";
                int      intID     = 0;
                OnDemand oOnDemand = new OnDemand(0, dsn);
                if (_serverid > 0)
                {
                    oOnDemand.UpdateStepDoneServer(_serverid, _stepid, _error, 1, false, false);
                    Servers oServer = new Servers(0, dsn);
                    intError = oServer.AddError(0, 0, 0, _serverid, _stepid, _error);
                    strName  = oServer.GetName(_serverid, true);
                    strType  = "server";
                    intID    = _serverid;
                }
                if (_workstationid > 0)
                {
                    oOnDemand.UpdateStepDoneWorkstation(_workstationid, _stepid, _error, 1, false, false);
                    Workstations oWorkstation = new Workstations(0, dsn);
                    intError = oWorkstation.AddVirtualError(0, 0, 0, _workstationid, _stepid, _error);
                    int intName = 0;
                    if (Int32.TryParse(oWorkstation.GetVirtual(_workstationid, "nameid"), out intName) == true)
                    {
                        strName = oWorkstation.GetName(intName);
                    }
                    strType = "workstation";
                    intID   = _workstationid;
                }
                if (_serverid > 0 || _workstationid > 0)
                {
                    ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
                    Functions        oFunction         = new Functions(0, dsn, _environment);
                    Variables        oVariable         = new Variables(_environment);
                    Asset            oAsset            = new Asset(0, _dsn_asset);

                    int     intType = oModelsProperties.GetType(_modelid);
                    DataSet dsSteps = oOnDemand.GetSteps(intType, 1);
                    string  strStep = "N / A";
                    if (dsSteps.Tables[0].Rows.Count > 0)
                    {
                        strStep = dsSteps.Tables[0].Rows[_stepid - 1]["name"].ToString();
                    }
                    string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_SUPPORT");
                    try
                    {
                        if (_is_vmware == true)
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>DataCenter: " + _vmware.DataCenter() + "<br/>Virtual Center: " + _vmware.VirtualCenter() + "</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                        else
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>ILO: <a href=\"https://" + oAsset.GetServerOrBlade(_assetid, "ilo") + "\" target=\"_blank\">" + oAsset.GetServerOrBlade(_assetid, "ilo") + "</a></p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>Notification Error: (Error Message: " + ex.Message + ") (Source: " + ex.Source + ") (Stack Trace: " + ex.StackTrace + ")</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                    }
                }
            }
            UpdateError(_error);
        }