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


C# dataAccess.sqlGetDataRow方法代码示例

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


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

示例1: LoadAccount

        public static string LoadAccount(string sID)
        {
            dataAccess dc = new dataAccess();
            string sSql = null;
            string sErr = null;

            string sAccountName = null;
            string sAccountNumber = null;
            string sProvider = null;
            string sIsDefault = null;
            string sAutoManage = null;
            string sLoginID = null;
            string sLoginPassword = null;

            sSql = "select account_id, account_name, account_number, provider, login_id, is_default, auto_manage_security" +
                " from cloud_account where account_id = '" + sID + "'";

            StringBuilder sb = new StringBuilder();
            DataRow dr = null;
            if (!dc.sqlGetDataRow(ref dr, sSql, ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (dr != null)
                {
                    sAccountName = (object.ReferenceEquals(dr["account_name"], DBNull.Value) ? "" : dr["account_name"].ToString());
                    sAccountNumber = (object.ReferenceEquals(dr["account_number"], DBNull.Value) ? "" : dr["account_number"].ToString());
                    sProvider = (object.ReferenceEquals(dr["provider"], DBNull.Value) ? "" : dr["provider"].ToString());
                    sIsDefault = (object.ReferenceEquals(dr["is_default"], DBNull.Value) ? "0" : (dc.IsTrue(dr["is_default"].ToString()) ? "1" : "0"));
                    sAutoManage = (object.ReferenceEquals(dr["auto_manage_security"], DBNull.Value) ? "" : dr["auto_manage_security"].ToString());
                    sLoginID = (object.ReferenceEquals(dr["login_id"], DBNull.Value) ? "" : dr["login_id"].ToString());
                    sLoginPassword = "($%#[email protected]!&";

                    // Return the object as a JSON

                    sb.Append("{");
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sAccountName", sAccountName);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sAccountNumber", sAccountNumber);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sProvider", sProvider);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sIsDefault", sIsDefault);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sAutoManage", sAutoManage);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sLoginID", sLoginID);
                    sb.AppendFormat("\"{0}\" : \"{1}\"", "sLoginPassword", sLoginPassword);
                    sb.Append("}");

                }
                else
                {
                    sb.Append("{}");
                }

            }

            return sb.ToString();
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:57,代码来源:cloudAccountEdit.aspx.cs

示例2: wmUpdateStep


//.........这里部分代码省略.........
                {
                    XElement xNode = xRoot.XPathSelectElement(sXPath);
                    if (xNode == null)
                        throw new Exception("XML data for step [" + sStepID + "] does not contain '" + sXPath + "' node.");

                    xNode.SetValue(sValue);
                }
                catch (Exception)
                {
                    try
                    {
                        //here's the deal... given an XPath statement, we simply cannot add a new node if it doesn't exist.
                        //why?  because xpath is a query language.  It doesnt' describe exactly what to add due to wildcards and //foo syntax.

                        //but, what we can do is make an ssumption in our specific case...
                        //that we are only wanting to add because we changed an underlying command XML template, and there are existing commands.

                        //so... we will split the xpath into segments, and traverse upward until we find an actual node.
                        //once we have it, we will need to add elements back down.

                        //string[] nodes = sXPath.Split('/');

                        //foreach (string node in nodes)
                        //{
                        //    //try to select THIS one, and stick it on the backwards stack
                        //    XElement xNode = xRoot.XPathSelectElement("//" + node);
                        //    if (xNode == null)
                        //        throw new Exception("XML data for step [" + sStepID + "] does not contain '" + sXPath + "' node.");

                        //}

                        XElement xFoundNode = null;
                        ArrayList aMissingNodes = new ArrayList();

                        //of course this skips the full path, but we've already determined it's no good.
                        string sWorkXPath = sXPath;
                        while (sWorkXPath.LastIndexOf("/") > -1)
                        {
                            aMissingNodes.Add(sWorkXPath.Substring(sWorkXPath.LastIndexOf("/") + 1));
                            sWorkXPath = sWorkXPath.Substring(0, sWorkXPath.LastIndexOf("/"));

                            xFoundNode = xRoot.XPathSelectElement(sWorkXPath);
                            if (xFoundNode != null)
                            {
                                //Found it! stop looping
                                break;
                            }
                        }

                        //now that we know where to start (xFoundNode), we can use that as a basis for adding
                        foreach (string sNode in aMissingNodes)
                        {
                            xFoundNode.Add(new XElement(sNode));
                        }

                        //now we should be good to stick the value on the final node.
                        XElement xNode = xRoot.XPathSelectElement(sXPath);
                        if (xNode == null)
                            throw new Exception("XML data for step [" + sStepID + "] does not contain '" + sXPath + "' node.");

                        xNode.SetValue(sValue);

                        //xRoot.Add(new XElement(sXPath, sValue));
                        //xRoot.SetElementValue(sXPath, sValue);
                    }
                    catch (Exception)
                    {
                        throw new Exception("Error Saving Step [" + sStepID + "].  Could not find and cannot create the [" + sXPath + "] property in the XML.");
                    }

                }

                sSQL = "update task_step set " +
                    " function_xml = '" + xDoc.ToString(SaveOptions.DisableFormatting).Replace("'", "''") + "'" +
                    " where step_id = '" + sStepID + "';";

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

            }

            sSQL = "select task_id, codeblock_name, step_order from task_step where step_id = '" + sStepID + "'";
            DataRow dr = null;
            if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
                throw new Exception(sErr);

            if (dr != null)
            {
                ui.WriteObjectChangeLog(Globals.acObjectTypes.Task, dr["task_id"].ToString(), sFunction,
                    "Codeblock:" + dr["codeblock_name"].ToString() +
                    " Step Order:" + dr["step_order"].ToString() +
                    " Command Type:" + sFunction +
                    " Property:" + sXPath +
                    " New Value: " + sValue);
            }

            return "";
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs

示例3: wmDeleteStep

        public void wmDeleteStep(string sStepID)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sErr = "";
                string sSQL = "";

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

                //you have to know which one we are removing
                string sDeletedStepOrder = "0";
                string sTaskID = "";
                string sCodeblock = "";
                string sFunction = "";
                string sFunctionXML = "";

                sSQL = "select task_id, codeblock_name, step_order, function_name, function_xml" +
                    " from task_step where step_id = '" + sStepID + "'";

                DataRow dr = null;
                if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
                    throw new Exception("Unable to get details for step." + sErr);

                if (dr != null)
                {
                    sDeletedStepOrder = dr["step_order"].ToString();
                    sTaskID = dr["task_id"].ToString();
                    sCodeblock = dr["codeblock_name"].ToString();
                    sFunction = dr["function_name"].ToString();
                    sFunctionXML = dr["function_xml"].ToString();

                    //for logging, we'll stick the whole command XML into the log
                    //so we have a complete record of the step that was just deleted.
                    ui.WriteObjectDeleteLog(Globals.acObjectTypes.Task, sTaskID, sFunction,
                        "Codeblock:" + sCodeblock +
                        " Step Order:" + sDeletedStepOrder +
                        " Command Type:" + sFunction +
                        " Details:" + sFunctionXML);
                }

                //"embedded" steps have a codeblock name referencing their "parent" step.
                //if we're deleting a parent, whack all the children
                sSQL = "delete from task_step where codeblock_name = '" + sStepID + "'";
                oTrans.Command.CommandText = sSQL;
                if (!oTrans.ExecUpdate(ref sErr))
                    throw new Exception("Unable to delete step." + sErr);

                //step might have user_settings
                sSQL = "delete from task_step_user_settings where step_id = '" + sStepID + "'";
                oTrans.Command.CommandText = sSQL;
                if (!oTrans.ExecUpdate(ref sErr))
                    throw new Exception("Unable to delete step user settings." + sErr);

                //now whack the parent
                sSQL = "delete from task_step where step_id = '" + sStepID + "'";
                oTrans.Command.CommandText = sSQL;
                if (!oTrans.ExecUpdate(ref sErr))
                    throw new Exception("Unable to delete step." + sErr);

                sSQL = "update task_step set step_order = step_order - 1" +
                    " where task_id = '" + sTaskID + "'" +
                    " and codeblock_name = '" + sCodeblock + "'" +
                    " and step_order > " + sDeletedStepOrder;
                oTrans.Command.CommandText = sSQL;
                if (!oTrans.ExecUpdate(ref sErr))
                    throw new Exception("Unable to reorder steps after deletion." + sErr);

                oTrans.Commit();

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

示例4: LoadAssetData

        public static string LoadAssetData(string sAssetID)
        {
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();

            string sSql = null;
            string sErr = null;

            string sAssetName = null;
            string sPort = null;
            string sDbName = null;
            string sAddress = null;
            string sConnectionType = null;
            string sUserName = null;
            string sSharedOrLocal = null;
            string sCredentialID = null;
            string sPassword = null;
            string sDomain = null;
            string sAssetStatus = null;
            string sPrivilegedPassword = null;
            string sSharedCredName = null;
            string sSharedCredDesc = null;
            string sConnString = null;

            DataRow dr = null;
            sSql = "select a.asset_name, a.asset_status, a.port, a.db_name, a.conn_string," +
                   " a.address, a.connection_type, ac.username, ac.password, ac.privileged_password, ac.domain, ac.shared_cred_desc, ac.credential_name, a.credential_id," +
                   " case when ac.shared_or_local = '0' then 'Shared' else 'Local' end as shared_or_local" +
                   " from asset a " +
                   " left outer join asset_credential ac on ac.credential_id = a.credential_id " +
                   " where a.asset_id = '" + sAssetID + "'";

            if (!dc.sqlGetDataRow(ref dr, sSql, ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (dr != null)
                {
                    sAssetName = dr["asset_name"].ToString();
                    sPort = (object.ReferenceEquals(dr["port"], DBNull.Value) ? "" : dr["port"].ToString());
                    sDbName = (object.ReferenceEquals(dr["db_name"], DBNull.Value) ? "" : dr["db_name"].ToString());
                    sAddress = (object.ReferenceEquals(dr["address"], DBNull.Value) ? "" : dr["address"].ToString().Replace("\\\\", "||"));
                    sAddress = sAddress.Replace("\\", "|");
                    sConnectionType = (object.ReferenceEquals(dr["connection_type"], DBNull.Value) ? "" : dr["connection_type"].ToString());
                    sUserName = (object.ReferenceEquals(dr["username"], DBNull.Value) ? "" : dr["username"].ToString());
                    sConnString = (object.ReferenceEquals(dr["conn_string"], DBNull.Value) ? "" : dr["conn_string"].ToString());
                    sSharedOrLocal = (object.ReferenceEquals(dr["shared_or_local"], DBNull.Value) ? "" : dr["shared_or_local"].ToString());
                    sCredentialID = (object.ReferenceEquals(dr["credential_id"], DBNull.Value) ? "" : dr["credential_id"].ToString());
                    sPassword = (object.ReferenceEquals(dr["password"], DBNull.Value) ? "" : "($%#[email protected]!&");
                    sDomain = (object.ReferenceEquals(dr["domain"], DBNull.Value) ? "" : dr["domain"].ToString());
                    sAssetStatus = dr["asset_status"].ToString();
                    sPrivilegedPassword = (object.ReferenceEquals(dr["privileged_password"], DBNull.Value) ? "" : "($%#[email protected]!&");
                    sSharedCredName = (object.ReferenceEquals(dr["credential_name"], DBNull.Value) ? "" : dr["credential_name"].ToString());
                    sSharedCredDesc = (object.ReferenceEquals(dr["shared_cred_desc"], DBNull.Value) ? "" : dr["shared_cred_desc"].ToString());
                }
            }

            // Return the asset object as a JSON
            StringBuilder sbAssetValues = new StringBuilder();
            sbAssetValues.Append("{");
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sAssetName", ui.packJSON(sAssetName));
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sPort", sPort);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sDbName", sDbName);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sAddress", sAddress);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sConnectionType", sConnectionType);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sUserName", sUserName);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sConnString", ui.packJSON(sConnString));
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sSharedOrLocal", sSharedOrLocal);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sCredentialID", sCredentialID);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sPassword", sPassword);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sDomain", sDomain);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sPriviledgedPassword", sPrivilegedPassword);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sSharedCredName", sSharedCredName);
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sSharedCredDesc", ui.packJSON(sSharedCredDesc));

            //last value, no comma on the end
            sbAssetValues.AppendFormat("\"{0}\" : \"{1}\"", "sAssetStatus", sAssetStatus);
            sbAssetValues.Append("}");

            return sbAssetValues.ToString();
        }
开发者ID:you8,项目名称:cato,代码行数:83,代码来源:assetEdit.aspx.cs

示例5: SaveAsset

        public static string SaveAsset(object[] oAsset)
        {
            // check the # of elements in the array
            if (oAsset.Length != 19) return "Incorrect number of Asset Properties:" + oAsset.Length.ToString();

            string sAssetID = oAsset[0].ToString();
            string sAssetName = oAsset[1].ToString().Replace("'", "''");
            string sDbName = oAsset[2].ToString().Replace("'", "''");
            string sPort = oAsset[3].ToString();
            string sConnectionType = oAsset[4].ToString();
            string sIsConnection = "0"; // oAsset[5].ToString();

            string sAddress = oAsset[5].ToString().Replace("'", "''");
            // mode is edit or add
            string sMode = oAsset[6].ToString();
            string sCredentialID = oAsset[7].ToString();
            string sCredUsername = oAsset[8].ToString().Replace("'", "''");
            string sCredPassword = oAsset[9].ToString().Replace("'", "''");
            string sShared = oAsset[10].ToString();
            string sCredentialName = oAsset[11].ToString().Replace("'", "''");
            string sCredentialDescr = oAsset[12].ToString().Replace("'", "''");
            string sDomain = oAsset[13].ToString().Replace("'", "''");
            string sCredentialType = oAsset[14].ToString();

            string sAssetStatus = oAsset[15].ToString();
            string sPrivilegedPassword = oAsset[16].ToString();
            string sTagArray = oAsset[17].ToString();

            string sConnString = oAsset[18].ToString().Replace("'", "''");

            // for logging
            string sOriginalAssetName = "";
            string sOriginalPort = "";
            string sOriginalDbName = "";
            string sOriginalAddress = "";
            string sOriginalConnectionType = "";
            string sOriginalUserName = "";
            string sOriginalConnString = "";
            string sOriginalCredentialID = "";
            string sOriginalAssetStatus = "";

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

            //if we are editing get the original values
            //this is getting original values for logging purposes
            if (sMode == "edit")
            {
                DataRow dr = null;
                sSql = "select a.asset_name, a.asset_status, a.port, a.db_name, a.address, a.db_name, a.connection_type, a.conn_string, ac.username, a.credential_id," +
                    " case when a.is_connection_system = '1' then 'Yes' else 'No' end as is_connection_system " +
                    " from asset a " +
                    " left outer join asset_credential ac on ac.credential_id = a.credential_id " +
                    " where a.asset_id = '" + sAssetID + "'";

                if (!dc.sqlGetDataRow(ref dr, sSql, ref sErr))
                    throw new Exception(sErr);
                else
                {
                    if (dr != null)
                    {
                        sOriginalAssetName = dr["asset_name"].ToString();
                        sOriginalPort = (object.ReferenceEquals(dr["port"], DBNull.Value) ? "" : dr["port"].ToString());
                        sOriginalDbName = (object.ReferenceEquals(dr["db_name"], DBNull.Value) ? "" : dr["db_name"].ToString());
                        sOriginalAddress = (object.ReferenceEquals(dr["address"], DBNull.Value) ? "" : dr["address"].ToString());
                        sOriginalConnectionType = (object.ReferenceEquals(dr["connection_type"], DBNull.Value) ? "" : dr["connection_type"].ToString());
                        sOriginalUserName = (object.ReferenceEquals(dr["username"], DBNull.Value) ? "" : dr["username"].ToString());
                        sOriginalConnString = (object.ReferenceEquals(dr["conn_string"], DBNull.Value) ? "" : dr["conn_string"].ToString());
                        sOriginalCredentialID = (object.ReferenceEquals(dr["credential_id"], DBNull.Value) ? "" : dr["credential_id"].ToString());
                        sOriginalAssetStatus = dr["asset_status"].ToString();
                    }
                }
            }

            //NOTE NOTE NOTE!
            //the following is a catch 22.
            //if we're adding a new asset, we will need to figure out the credential first so we can save the credential id on the asset
            //but if it's a new local credential, it gets the asset id as it's name.
            //so.........
            //if it's a new asset, go ahead and get the new guid for it here so the credential add will work.
            if (sMode == "add")
                sAssetID = ui.NewGUID();
            //and move on...

            // there are three CredentialType's
            // 1) 'selected' = user selected a different credential, just save the credential_id
            // 2) 'new' = user created a new shared or local credential
            // 3) 'existing' = same credential, just update the username,description ad password
            string sPriviledgedPasswordUpdate = null;
            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.
//.........这里部分代码省略.........
开发者ID:you8,项目名称:cato,代码行数:101,代码来源:assetEdit.aspx.cs

示例6: LoadCredential

        public static string LoadCredential(string sCredentialID)
        {
            dataAccess dc = new dataAccess();
            string sSQL = null;
            string sErr = null;

            string sCredName = null;
            string sCredUsername = null;
            string sCredDomain = null;
            string sCredPassword = null;
            string sPriviledgedPassword = null;
            string sCredDesc = null;

            sSQL = "select credential_id, credential_name, username, domain, shared_cred_desc, privileged_password" +
                " from asset_credential" +
                " where credential_id = '" + sCredentialID + "'";

            StringBuilder sbAssetValues = new StringBuilder();
            DataRow dr = null;
            if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (dr != null)
                {
                    sCredName = (object.ReferenceEquals(dr["credential_name"], DBNull.Value) ? "" : dr["credential_name"].ToString());
                    sCredUsername = (object.ReferenceEquals(dr["username"], DBNull.Value) ? "" : dr["username"].ToString());
                    sCredDomain = (object.ReferenceEquals(dr["domain"], DBNull.Value) ? "" : dr["domain"].ToString());
                    sCredDesc = (object.ReferenceEquals(dr["shared_cred_desc"], DBNull.Value) ? "" : dr["shared_cred_desc"].ToString());
                    sCredPassword = "($%#[email protected]!&";
                    sPriviledgedPassword = (object.ReferenceEquals(dr["privileged_password"], DBNull.Value) ? "" : dr["privileged_password"].ToString());
                    // if the password is blank, its been cleared at some point
                    if (sPriviledgedPassword.Length > 0)
                    {
                        sPriviledgedPassword = "($%#[email protected]!&";
                    }
                    else
                    {
                        sPriviledgedPassword = "";
                    }

                    // Return the asset object as a JSON

                    sbAssetValues.Append("{");
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sCredName", sCredName);
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sCredUsername", sCredUsername);
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sCredDomain", sCredDomain);
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sCredPassword", sCredPassword);
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\",", "sPriviledgedPassword", sPriviledgedPassword);
                    sbAssetValues.AppendFormat("\"{0}\" : \"{1}\"", "sCredDesc", sCredDesc);
                    sbAssetValues.Append("}");

                }
                else
                {
                    sbAssetValues.Append("{}");
                }

            }

            return sbAssetValues.ToString();
        }
开发者ID:you8,项目名称:cato,代码行数:64,代码来源:sharedCredentialEdit.aspx.cs

示例7: wmGetRecurringPlanByPlanID

        public string wmGetRecurringPlanByPlanID(string sPlanID)
        {
            dataAccess dc = new dataAccess();
            string sSQL = null;
            string sErr = null;
            string sOut = "";

            //first, get the schedule that created this plan
            sSQL = "select schedule_id from action_plan where plan_id = '" + sPlanID + "'";
            DataRow dr = null;
            if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
                throw new Exception(sErr);

            if (dr != null)
            {
                sOut = wmGetRecurringPlan(dr["schedule_id"].ToString());
            }

            return sOut;
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:20,代码来源:uiMethods.asmx.cs

示例8: wmGetRecurringPlan

        public string wmGetRecurringPlan(string sScheduleID)
        {
            //tracing this backwards, if the action_plan table has a row marked "schedule" but no schedule_id, problem.
            if (string.IsNullOrEmpty(sScheduleID))
                throw new Exception("Unable to retrieve Reccuring Plan - schedule id argument not provided.");

            dataAccess dc = new dataAccess();
            string sSQL = null;
            string sErr = null;

            StringBuilder sb = new StringBuilder();

            //now we know the details, go get the timetable for that specific schedule
            sSQL = "select schedule_id, months, days, hours, minutes, days_or_weeks, label" +
                " from action_schedule" +
                " where schedule_id = '" + sScheduleID + "'";
            DataRow drSchedule = null;
            if (!dc.sqlGetDataRow(ref drSchedule, sSQL, ref sErr))
                throw new Exception(sErr);

            //GetDataRow returns a message if there are no rows...
            if (string.IsNullOrEmpty(sErr))
            {
                string sMo = drSchedule["months"].ToString();
                string sDa = drSchedule["days"].ToString();
                string sHo = drSchedule["hours"].ToString();
                string sMi = drSchedule["minutes"].ToString();
                string sDW = drSchedule["days_or_weeks"].ToString();
                string sDesc = (string.IsNullOrEmpty(drSchedule["label"].ToString()) ? drSchedule["schedule_id"].ToString() : drSchedule["label"].ToString());

                sb.Append("{");
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sDescription", sDesc);
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sMonths", sMo);
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sDays", sDa);
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sHours", sHo);
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sMinutes", sMi);
                sb.AppendFormat("\"{0}\" : \"{1}\",", "sDaysOrWeeks", sDW);
                sb.Append("}");
            }
            else
            {
                throw new Exception("Unable to find details for Recurring Action Plan. " + sErr);
            }

            return sb.ToString();
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:46,代码来源:uiMethods.asmx.cs

示例9: wmGetEcotemplateAction

        public string wmGetEcotemplateAction(string sActionID)
        {
            dataAccess dc = new dataAccess();

            string sSQL = null;
            string sErr = null;

            string sHTML = "";

            try
            {
                if (!string.IsNullOrEmpty(sActionID))
                {
                    sSQL = "select ea.action_id, ea.action_name, ea.category, ea.action_desc, ea.original_task_id, ea.task_version," +
                        " t.task_id, t.task_name," +
                        " ea.parameter_defaults as action_param_xml, t.parameter_xml as task_param_xml" +
                        " from ecotemplate_action ea" +
                        " join task t on ea.original_task_id = t.original_task_id" +
                        " and t.default_version = 1" +
                        " where ea.action_id = '" + sActionID + "'";

                    DataRow dr = null;
                    if (!dc.sqlGetDataRow(ref dr, sSQL, ref sErr))
                        throw new Exception(sErr);

                    //GetDataRow returns a message if there are no rows...
                    if (string.IsNullOrEmpty(sErr))
                    {
                        sHTML = DrawEcotemplateAction(dr);
                    }
                }
                else
                {
                    throw new Exception("Unable to get Actions - Missing EcoTemplate ID");
                }

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

示例10: LoadCloud

        public static string LoadCloud(string sID)
        {
            dataAccess dc = new dataAccess();
            string sSql = null;
            string sErr = null;

            string sCloudName = null;
            string sProvider = null;
            string sAPIUrl = null;

            sSql = "select cloud_id, cloud_name, provider, api_url" +
                " from clouds where cloud_id = '" + sID + "'";

            StringBuilder sb = new StringBuilder();
            DataRow dr = null;
            if (!dc.sqlGetDataRow(ref dr, sSql, ref sErr))
            {
                throw new Exception(sErr);
            }
            else
            {
                if (dr != null)
                {
                    sCloudName = (object.ReferenceEquals(dr["cloud_name"], DBNull.Value) ? "" : dr["cloud_name"].ToString());
                    sProvider = (object.ReferenceEquals(dr["provider"], DBNull.Value) ? "" : dr["provider"].ToString());
                    sAPIUrl = (object.ReferenceEquals(dr["api_url"], DBNull.Value) ? "" : dr["api_url"].ToString());

                    // Return the object as a JSON

                    sb.Append("{");
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sCloudName", sCloudName);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sProvider", sProvider);
                    sb.AppendFormat("\"{0}\" : \"{1}\",", "sAPIUrl", sAPIUrl);
                    sb.Append("}");

                }
                else
                {
                    sb.Append("{}");
                }

            }

            return sb.ToString();
        }
开发者ID:you8,项目名称:cato,代码行数:45,代码来源:cloudEdit.aspx.cs


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