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


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

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


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

示例1: 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


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