当前位置: 首页>>代码示例>>C#>>正文


C# acUI.acUI.WriteObjectAddLog方法代码示例

本文整理汇总了C#中acUI.acUI.WriteObjectAddLog方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.WriteObjectAddLog方法的具体用法?C# acUI.acUI.WriteObjectAddLog怎么用?C# acUI.acUI.WriteObjectAddLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在acUI.acUI的用法示例。


在下文中一共展示了acUI.acUI.WriteObjectAddLog方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: wmCreateTask

        public string wmCreateTask(object[] oObj)
        {
            try
            {

                dataAccess dc = new dataAccess();
                acUI.acUI ui = new acUI.acUI();
                string sSql = null;
                string sErr = null;

                // we are passing in 8 elements, if we have 8 go
                //if (oObj.Length != 8) return "Incorrect list of attributes";

                string sTaskName = oObj[0].ToString().Replace("'", "''").Trim();
                string sTaskCode = oObj[1].ToString().Replace("'", "''").Trim();
                string sTaskDesc = oObj[2].ToString().Replace("'", "''").Trim();

                //string sTaskOrder = "";

                //if (oObj.Length > 4)
                //    sTaskOrder = oObj[4].ToString().Trim();

                // checks that cant be done on the client side
                // is the name unique?
                sSql = "select task_id from task " +
                        " where (task_code = '" + sTaskCode + "' or task_name = '" + sTaskName + "')";

                string sValueExists = "";
                if (!dc.sqlGetSingleString(ref sValueExists, sSql, ref sErr))
                {
                    throw new Exception("Unable to check for existing names." + sErr);
                }

                if (sValueExists != "")
                {
                    return "Another Task with that Code or Name exists, please choose another value.";
                }

                // passed client and server validations, create the user
                string sNewID = ui.NewGUID();

                try
                {
                    dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                    // all good, save the new user and redirect to the user edit page.
                    sSql = "insert task" +
                        " (task_id, original_task_id, version, default_version," +
                        " task_name, task_code, task_desc, created_dt)" +
                           " values " +
                           "('" + sNewID + "', '" + sNewID + "', 1.0000, 1, '" +
                           sTaskName + "', '" + sTaskCode + "', '" + sTaskDesc + "', now())";
                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                    // every task gets a MAIN codeblock... period.
                    sSql = "insert task_codeblock (task_id, codeblock_name)" +
                           " values ('" + sNewID + "', 'MAIN')";
                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                    oTrans.Commit();
                }
                catch (Exception ex)
                {
                    throw new Exception("Error updating the DB." + ex.Message);
                }

                // add security log
                ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sNewID, sTaskName, "");

                // success, return the new task_id
                return "task_id=" + sNewID;

            }
            catch (Exception ex)
            {
                throw new Exception("One or more invalid or missing AJAX arguments." + ex.Message);
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:86,代码来源:taskMethods.asmx.cs

示例2: SaveAccount

        public static string SaveAccount(string sMode, string sAccountID, string sAccountName, string sAccountNumber, string sProvider, 
			string sLoginID, string sLoginPassword, string sLoginPasswordConfirm, string sIsDefault, string sAutoManageSecurity)
        {
            // for logging
            string sOriginalName = "";

            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sSql = "";
            string sErr = "";

            //if we are editing get the original values
            if (sMode == "edit")
            {
            }

            try
            {
                dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                // update the user fields.
                if (sMode == "edit")
                {
                    sSql = "select account_name from cloud_account " +
                           "where account_id = '" + sAccountID + "'";
                    if (!dc.sqlGetSingleString(ref sOriginalName, sSql, ref sErr))
                        throw new Exception("Error getting original account name:" + sErr);

                    // only update the passwword if it has changed
                    string sNewPassword = "";
                    if (sLoginPassword != "($%#[email protected]!&")
                    {
                        sNewPassword = ", login_password = '" + dc.EnCrypt(sLoginPassword) + "'";
                    }

                    sSql = "update cloud_account set" +
                        " account_name = '" + sAccountName + "'," +
                        " account_number = '" + sAccountNumber + "'," +
                        " provider = '" + sProvider + "'," +
                        " is_default = '" + sIsDefault + "'," +
                        " auto_manage_security = '" + sAutoManageSecurity + "'," +
                        " login_id = '" + sLoginID + "'" +
                        sNewPassword +
                        " where account_id = '" + sAccountID + "'";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception("Error updating account: " + sErr);

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.CloudAccount, sAccountID, sAccountName, sOriginalName, sAccountName);}
                else
                {
                    //now, for some reason we were having issues with the initial startup of apache
                    //not able to perform the very first database hit.
                    //this line serves as an inital db hit, but we aren't trapping it or showing the error
                    dc.TestDBConnection(ref sErr);

                    //if there are no rows yet, make this one the default even if the box isn't checked.
                    if (sIsDefault == "0")
                    {
                        int iExists = -1;

                        sSql = "select count(*) as cnt from cloud_account";
                        if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
                        {
                            System.Threading.Thread.Sleep(300);
                            if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
                            {
                                System.Threading.Thread.Sleep(300);
                                if (!dc.sqlGetSingleInteger(ref iExists, sSql, ref sErr))
                                    throw new Exception("Unable to count Cloud Accounts: " + sErr);
                            }
                        }

                        if (iExists == 0)
                            sIsDefault = "1";
                    }

                    sAccountID = ui.NewGUID();
                    sSql = "insert into cloud_account (account_id, account_name, account_number, provider, is_default, login_id, login_password, auto_manage_security)" +
                    " values ('" + sAccountID + "'," +
                    "'" + sAccountName + "'," +
                    "'" + sAccountNumber + "'," +
                    "'" + sProvider + "'," +
                    "'" + sIsDefault + "'," +
                    "'" + sLoginID + "'," +
                    "'" + dc.EnCrypt(sLoginPassword) + "'," +
                    "'" + sAutoManageSecurity + "')";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception("Error creating account: " + sErr);

                    ui.WriteObjectAddLog(Globals.acObjectTypes.CloudAccount, sAccountID, sAccountName, "Account Created");
                }

                //if "default" was selected, unset all the others
                if (dc.IsTrue(sIsDefault))
                {
                    oTrans.Command.CommandText = "update cloud_account set is_default = 0 where account_id <> '" + sAccountID + "'";
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:cloudAccountEdit.aspx.cs

示例3: wmCopyTask

        public string wmCopyTask(string sCopyTaskID, string sTaskCode, string sTaskName)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sErr = null;

            // checks that cant be done on the client side
            // is the name unique?
            string sTaskNameInUse = "";
            if (!dc.sqlGetSingleString(ref sTaskNameInUse, "select task_id from task where task_name = '" + sTaskName.Replace("'", "''") + "' limit 1", ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (!string.IsNullOrEmpty(sTaskNameInUse))
                {
                    return "Task Name [" + sTaskName + "] already in use.  Please choose another name.";
                }
            }

            // checks that cant be done on the client side
            // is the name unique?
            string sTaskCodeInUse = "";
            if (!dc.sqlGetSingleString(ref sTaskCodeInUse, "select task_id from task where task_code = '" + sTaskCode.Replace("'", "''") + "' limit 1", ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (!string.IsNullOrEmpty(sTaskCodeInUse))
                {
                    return "Task Code [" + sTaskCode + "] already in use.  Please choose another code.";
                }
            }

            string sNewTaskGUID = CopyTask(0, sCopyTaskID, sTaskName.Replace("'", "''"), sTaskCode.Replace("'", "''"));

            if (!string.IsNullOrEmpty(sNewTaskGUID))
            {
                ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sNewTaskGUID, sTaskName, "Copied from " + sCopyTaskID);
            }

            // success, return the new task_id
            return sNewTaskGUID;
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:46,代码来源:taskMethods.asmx.cs

示例4: wmCreateNewTaskVersion

        public string wmCreateNewTaskVersion(string sTaskID, string sMinorMajor)
        {
            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sNewVersionGUID = CopyTask((sMinorMajor == "Major" ? 1 : 2), sTaskID, "", "");

                if (!string.IsNullOrEmpty(sNewVersionGUID))
                {
                    ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sNewVersionGUID, sNewVersionGUID, "");
                }

                return sNewVersionGUID;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:20,代码来源:taskMethods.asmx.cs

示例5: SaveAsset


//.........这里部分代码省略.........
            if (sCredentialType == "new")
            {
                if (sPrivilegedPassword.Length == 0)
                    sPriviledgedPasswordUpdate = "NULL";
                else
                    sPriviledgedPasswordUpdate = "'" + dc.EnCrypt(sPrivilegedPassword) + "'";

                //if it's a local credential, the credential_name is the asset_id.
                //if it's shared, there will be a name.
                if (sShared == "1")
                {
                    sCredentialName = sAssetID;

                    //whack and add - easiest way to avoid conflicts
                    sSql = "delete from asset_credential where credential_name = '" + sCredentialName + "' and shared_or_local = '1'";
                    if (!dc.sqlExecuteUpdate(sSql, ref sErr))
                        throw new Exception(sErr);
                }

                //now we're clear to add
                sCredentialID = "'" + ui.NewGUID() + "'";
                sSql = "insert into asset_credential " +
                    "(credential_id,credential_name,username,password,domain,shared_or_local,shared_cred_desc,privileged_password) " +
                        "values (" + sCredentialID + ",'" + sCredentialName + "','" + sCredUsername + "','" + dc.EnCrypt(sCredPassword) + "','" + sDomain + "','" + sShared + "','" + sCredentialDescr + "'," + sPriviledgedPasswordUpdate + ")";
                if (!dc.sqlExecuteUpdate(sSql, ref sErr))
                {
                    if (sErr == "key_violation")
                        throw new Exception("A Credential with that name already exists.  Please select another name.");
                    else
                        throw new Exception(sErr);
                }

                // add security log
                ui.WriteObjectAddLog(Globals.acObjectTypes.Credential, sCredentialID, sCredentialName, "");

            }
            else if (sCredentialType == "existing")
            {
                sCredentialID = "'" + sCredentialID + "'";
                // bugzilla 1126 if the password has not changed leave it as is.
                string sPasswordUpdate = null;
                if (sCredPassword == "($%#[email protected]!&")
                    // password has not been touched
                    sPasswordUpdate = "";
                else
                    // updated password
                    sPasswordUpdate = ",password = '" + dc.EnCrypt(sCredPassword) + "'";

                // bugzilla 1260
                // same for privileged_password

                if (sPrivilegedPassword == "($%#[email protected]!&")
                    // password has not been touched
                    sPriviledgedPasswordUpdate = "";
                else
                {
                    // updated password
                    // bugzilla 1352 priviledged password can be blank, so if it is, set it to null
                    if (sPrivilegedPassword.Length == 0)
                        sPriviledgedPasswordUpdate = ",privileged_password = null";
                    else
                        sPriviledgedPasswordUpdate = ",privileged_password = '" + dc.EnCrypt(sPrivilegedPassword) + "'";
                }

                sSql = "update asset_credential " +
                        "set username = '" + sCredUsername + "'" + sPasswordUpdate + sPriviledgedPasswordUpdate + ",domain = '" + sDomain + "'," +
开发者ID:you8,项目名称:cato,代码行数:67,代码来源:assetEdit.aspx.cs

示例6: wmUpdateTaskParam

        public string wmUpdateTaskParam(string sType, string sID, string sParamID,
            string sName, string sDesc,
            string sRequired, string sPrompt, string sEncrypt, string sPresentAs, string sValues)
        {
            dataAccess dc = new dataAccess();

            acUI.acUI ui = new acUI.acUI();
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();

            if (!ui.IsGUID(sID))
                throw new Exception("Invalid or missing ID.");

            string sErr = "";
            string sSQL = "";

            //we encoded this in javascript before the ajax call.
            //the safest way to unencode it is to use the same javascript lib.
            //(sometimes the javascript and .net libs don't translate exactly, google it.)
            sDesc = ui.unpackJSON(sDesc).Trim();

            //normalize and clean the values
            sRequired = (dc.IsTrue(sRequired) ? "true" : "false");
            sPrompt = (dc.IsTrue(sPrompt) ? "true" : "false");
            sEncrypt = (dc.IsTrue(sEncrypt) ? "true" : "false");
            sName = sName.Trim().Replace("'", "''");

            string sTable = "";
            string sXML = "";
            string sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]";  //using this to keep the code below cleaner.

            if (sType == "ecosystem")
                sTable = "ecosystem";
            else if (sType == "task")
                sTable = "task";

            bool bParamAdd = false;
            //bool bParamUpdate = false;

            //if sParamID is empty, we are adding
            if (string.IsNullOrEmpty(sParamID))
            {
                sParamID = "p_" + ui.NewGUID();
                sParameterXPath = "//parameter[@id = \"" + sParamID + "\"]";  //reset this if we had to get a new id

                //does the task already have parameters?
                sSQL = "select parameter_xml from " + sTable + " where " + sType + "_id = '" + sID + "'";
                if (!dc.sqlGetSingleString(ref sXML, sSQL, ref sErr))
                    throw new Exception(sErr);

                string sAddXML = "<parameter id=\"" + sParamID + "\" required=\"" + sRequired + "\" prompt=\"" + sPrompt + "\" encrypt=\"" + sEncrypt + "\">" +
                    "<name>" + sName + "</name>" +
                    "<desc>" + sDesc + "</desc>" +
                    "</parameter>";

                if (string.IsNullOrEmpty(sXML))
                {
                    //XML doesn't exist at all, add it to the record
                    sAddXML = "<parameters>" + sAddXML + "</parameters>";

                    sSQL = "update " + sTable + " set " +
                        " parameter_xml = '" + sAddXML + "'" +
                        " where " + sType + "_id = '" + sID + "'";

                    if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                        throw new Exception(sErr);

                    bParamAdd = true;
                }
                else
                {
                    //XML exists, add the node to it
                    ft.AddNodeToXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", "//parameters", sAddXML);
                    bParamAdd = true;
                }
            }
            else
            {
                //update the node values
                ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/name", sName);
                ft.SetNodeValueinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath + "/desc", sDesc);
                //and the attributes
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "required", sRequired);
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "prompt", sPrompt);
                ft.SetNodeAttributeinXMLColumn(sTable, "parameter_xml", sType + "_id = '" + sID + "'", sParameterXPath, "encrypt", sEncrypt);

                bParamAdd = false;
            }

            // not clean at all handling both tasks and ecosystems in the same method, but whatever.
            if (bParamAdd)
            {
                if (sType == "task") { ui.WriteObjectAddLog(Globals.acObjectTypes.Task, sID, "Parameter", "Added Parameter:" + sName ); };
                if (sType == "ecosystem") { ui.WriteObjectAddLog(Globals.acObjectTypes.Ecosystem, sID, "Parameter", "Added Parameter:" + sName); };
            }
            else
            {
                // would be a lot of trouble to add the from to, why is it needed you have each value in the log, just scroll back
                // so just add a changed message to the log
                if (sType == "task") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Task, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
                if (sType == "ecosystem") { dc.addSecurityLog(ui.GetSessionUserID(), Globals.SecurityLogTypes.Object, Globals.SecurityLogActions.ObjectModify, Globals.acObjectTypes.Ecosystem, sID, "Parameter Changed:[" + sName + "]", ref sErr); };
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs

示例7: SaveCredential


//.........这里部分代码省略.........
            if (sMode == "edit")
            {
                sSql = "select username from asset_credential " +
                       "where credential_id = '" + sCredentialID + "'";

                if (!dc.sqlGetSingleString(ref sOriginalUserName, sSql, ref sErr))
                {
                    throw new Exception(sErr);
                }
            }

            try
            {
                dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                // update the user fields.
                if (sMode == "edit")
                {
                    // only update the passwword if it has changed
                    string sNewPassword = "";
                    if (sPassword != "($%#[email protected]!&")
                    {
                        sNewPassword = ",password = '" + dc.EnCrypt(sPassword) + "'";
                    }

                    // bugzilla 1260
                    // same for privileged_password
                    string sPriviledgedPasswordUpdate = null;
                    if (sPrivilegedPassword == "($%#[email protected]!&")
                    {
                        // password has not been touched
                        sPriviledgedPasswordUpdate = "";
                    }
                    else
                    {
                        // updated password
                        sPriviledgedPasswordUpdate = ",privileged_password = '" + dc.EnCrypt(sPrivilegedPassword) + "'";

                    }

                    sSql = "update asset_credential set" +
                        " credential_name = '" + sCredentialName + "'," +
                        " username = '" + sUserName + "'," +
                        " domain = '" + sDomain.Replace("'", "''") + "'," +
                        " shared_cred_desc = '" + sCredentialDesc + "'" +
                        sNewPassword +
                        sPriviledgedPasswordUpdate +
                        " where credential_id = '" + sCredentialID + "'";
                }
                else
                {
                    // if the priviledged password is empty just set it to null
                    string sPrivilegedPasswordUpdate = "NULL";
                    if (sPrivilegedPassword.Length != 0)
                    {
                        sPrivilegedPasswordUpdate = "'" + dc.EnCrypt(sPrivilegedPassword) + "'";
                    };

                    sSql = "insert into asset_credential (credential_id, credential_name, username, password, domain, shared_cred_desc, shared_or_local, privileged_password)" +
                    " values (" + "'" + ui.NewGUID() + "'," +
                    "'" + sCredentialName.Replace("'", "''") + "'," +
                    "'" + sUserName.Replace("'", "''") + "'," +
                    "'" + dc.EnCrypt(sPassword) + "'," +
                    "'" + sDomain.Replace("'", "''") + "'," +
                    "'" + sCredentialDesc.Replace("'", "''") + "'," +
                    "'0'," + sPrivilegedPasswordUpdate + ")";
                }
                oTrans.Command.CommandText = sSql;
                if (!oTrans.ExecUpdate(ref sErr))
                {
                    if (sErr == "key_violation")
                        throw new Exception("A Credential with that name already exists.  Please select another name.");
                    else
                        throw new Exception(sErr);
                }

                oTrans.Commit();
            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }

            // add security log
            // since this is not handled as a page postback, theres no "Viewstate" settings
            // so 2 options either we keep an original setting for each value in hid values, or just get them from the db as part of the
            // update above, since we are already passing in 15 or so fields, lets just get the values at the start and reference them here
            if (sMode == "edit")
            {
                ui.WriteObjectChangeLog(Globals.acObjectTypes.Credential, sCredentialID, sUserName.Replace("'", "''"), sOriginalUserName, sUserName.Replace("'", "''"));
            }
            else
            {
                ui.WriteObjectAddLog(Globals.acObjectTypes.Credential, sCredentialID, sUserName.Replace("'", "''"), "Credential Created");
            }

            // no errors to here, so return an empty string
            return "";
        }
开发者ID:you8,项目名称:cato,代码行数:101,代码来源:sharedCredentialEdit.aspx.cs

示例8: wmCreateTag

        public string wmCreateTag(string sTagName, string sDescription)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sSQL = null;
            string sErr = null;

            try
            {
                sSQL = "select tag_name from lu_tags where tag_name = '" + sTagName + "'";
                string sTagExists = "";
                if (!dc.sqlGetSingleString(ref sTagExists, sSQL, ref sErr))
                {
                    throw new Exception(sErr);
                }
                else
                {
                    if (!string.IsNullOrEmpty(sTagExists))
                    {
                        return "Tag exists - choose another name.";
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            try
            {
                sSQL = "insert into lu_tags (tag_name, tag_desc)" +
                    " values ('" + sTagName + "'," +
                    "'" + sDescription + "')";

                if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                    throw new Exception(sErr);

                ui.WriteObjectAddLog(acObjectTypes.None, sTagName, sTagName, "Tag created.");
            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }

            // no errors to here, so return an empty string
            return "";
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:48,代码来源:uiMethods.asmx.cs

示例9: wmCreateEcotemplate

        public string wmCreateEcotemplate(string sName, string sDescription)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sSQL = null;
            string sErr = null;

            try
            {
                sSQL = "select ecotemplate_name from ecotemplate where ecotemplate_name = '" + sName + "'";
                string sExists = "";
                if (!dc.sqlGetSingleString(ref sExists, sSQL, ref sErr))
                {
                    throw new Exception(sErr);
                }
                else
                {
                    if (!string.IsNullOrEmpty(sExists))
                    {
                        return "Eco Template exists - choose another name.";
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            try
            {
                string sNewID = ui.NewGUID();

                sSQL = "insert into ecotemplate (ecotemplate_id, ecotemplate_name, ecotemplate_desc)" +
                    " values ('" + sNewID + "'," +
                    " '" + sName + "'," +
                    (string.IsNullOrEmpty(sDescription) ? " null" : " '" + sDescription + "'") + ")";

                if (!dc.sqlExecuteUpdate(sSQL, ref sErr))
                    throw new Exception(sErr);

                ui.WriteObjectAddLog(acObjectTypes.Ecosystem, sNewID, sName, "Ecotemplate created.");

                return sNewID;
            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:50,代码来源:uiMethods.asmx.cs

示例10: SaveCloud

        public static string SaveCloud(string sMode, string sCloudID, string sCloudName, string sProvider, string sAPIUrl)
        {
            // for logging
            string sOriginalName = null;

            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sSql = null;
            string sErr = null;

            //if we are editing get the original values
            if (sMode == "edit")
            {
            }

            try
            {
                dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                // update the user fields.
                if (sMode == "edit")
                {
                    sSql = "select cloud_name from clouds " +
                           "where cloud_id = '" + sCloudID + "'";
                    if (!dc.sqlGetSingleString(ref sOriginalName, sSql, ref sErr))
                        throw new Exception("Error getting original cloud name:" + sErr);

                    sSql = "update clouds set" +
                        " cloud_name = '" + sCloudName + "'," +
                        " provider = '" + sProvider + "'," +
                        " api_url = '" + sAPIUrl + "'" +
                        " where cloud_id = '" + sCloudID + "'";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception("Error updating cloud: " + sErr);

                    ui.WriteObjectChangeLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, sOriginalName, sCloudName);}
                else
                {
                    sCloudID = ui.NewGUID();
                    sSql = "insert into clouds (cloud_id, cloud_name, provider, api_url)" +
                    " values ('" + sCloudID + "'," +
                    "'" + sCloudName + "'," +
                    "'" + sProvider + "'," +
                    "'" + sAPIUrl + "')";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception("Error creating cloud: " + sErr);

                    ui.WriteObjectAddLog(Globals.acObjectTypes.Cloud, sCloudID, sCloudName, "Cloud Created");
                }

                oTrans.Commit();

                //update the cloud providers class in the session
                CloudProviders cp = ui.GetCloudProviders();
                cp[sProvider].RefreshClouds();
                ui.UpdateCloudProviders(cp);
               }
            catch (Exception ex)
            {
                throw new Exception("Error: General Exception: " + ex.Message);
            }

            // no errors to here, so return an empty string
            return "{'cloud_id':'" + sCloudID + "'}";
        }
开发者ID:you8,项目名称:cato,代码行数:69,代码来源:cloudEdit.aspx.cs

示例11: SaveDomain

        public static string SaveDomain(object[] oAsset)
        {
            // we are passing in 4 elements, if we have 16 go
            if (oAsset.Length != 4) return "Incorrect list of attributes:" + oAsset.Length.ToString();

            string sEditDomain = oAsset[0].ToString();
            string sDomain = oAsset[1].ToString().Replace("'", "''");
            string sAddress = oAsset[2].ToString().Replace("'", "''");
            string sMode = oAsset[3].ToString();

            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();
            string sSql = null;
            string sErr = null;

            // before updating or adding make sure the domain name is available
            if (sEditDomain != sDomain)
            {
                try
                {
                    sSql = "select ldap_domain from ldap_domain where ldap_domain = '" + sDomain + "'";
                    string sDomainExists = "";
                    if (!dc.sqlGetSingleString(ref sDomainExists, sSql, ref sErr))
                    {
                        throw new Exception(sErr);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(sDomainExists))
                        {
                            return "Domain name exists, choose another name.";
                        }

                    }
                }
                catch (Exception ex)
                {

                    throw new Exception(ex.Message);
                }
            }

            try
            {
                dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

                // update the user fields.
                if (sMode == "edit")
                {
                    // if the domain name changed update all of the asset_credential's using this domain
                    if (sDomain != sEditDomain){
                        sSql = "update asset_credential set domain = '" + sDomain + "' where domain = '" + sEditDomain + "'";
                        oTrans.Command.CommandText = sSql;
                        if (!oTrans.ExecUpdate(ref sErr))
                        {
                            throw new Exception(sErr);
                        }
                    }

                    sSql = "update ldap_domain set ldap_domain = '" + sDomain + "'," + "address = '" + sAddress + "' where ldap_domain = '" + sEditDomain + "'";
                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                }
                else
                {
                    sSql = "insert into ldap_domain (ldap_domain,address)" +
                    " values ('" + sDomain + "'," +
                    "'" + sAddress + "')";

                    oTrans.Command.CommandText = sSql;
                    if (!oTrans.ExecUpdate(ref sErr))
                    {
                        throw new Exception(sErr);
                    }

                }

                oTrans.Commit();
            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }

            // add security log
            if (sMode == "edit")
            {
                ui.WriteObjectChangeLog(Globals.acObjectTypes.Domain, sEditDomain, sEditDomain, sEditDomain, sDomain);
            }
            else
            {
                ui.WriteObjectAddLog(Globals.acObjectTypes.Domain, sDomain, sDomain, "Domain Created");
            }

            // no errors to here, so return an empty string
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:ldapEdit.aspx.cs


注:本文中的acUI.acUI.WriteObjectAddLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。