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


C# DBManager.ExecuteDataSet方法代码示例

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


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

示例1: de_bug

        static void de_bug()
        {
            DBManager dbManager = new DBManager(DataProvider.SqlServer);
            Console.WriteLine("debug Start");
            string AutoProvision_WS_url = Create_VM_Service.Properties.Settings.Default.Create_VM_Service_AutoProvision_WS_AutoProvision_WS;

            string IsDelImg = ConfigurationManager.AppSettings["IsDelImg"].ToString();//是否刪除VM
            string db_server = ConfigurationManager.AppSettings["SSM"].ToString();
            string EmailAccount = ConfigurationManager.AppSettings["EmailAccount"].ToString();
            string EmailPassword = ConfigurationManager.AppSettings["EmailPassword"].ToString();
            string smtphost = ConfigurationManager.AppSettings["smtphost"].ToString();
            dbManager.ConnectionString = ConfigurationManager.AppSettings["SSM"].ToString();
            Create_VM_Service.AutoProvision_WS.AutoProvision_WS ws = new Create_VM_Service.AutoProvision_WS.AutoProvision_WS();
            //CPU_Memory_Usage_API.David_API vm_useage = new CPU_Memory_Usage_API.David_API();
            string ftp = ConfigurationManager.AppSettings["FTP_IP"].Replace("ftp://", "").Trim();
            string ftp_user = ConfigurationManager.AppSettings["ftpUsername"].Trim().ToString();
            string ftp_pwd = ConfigurationManager.AppSettings["ftpPassword"].Trim().ToString();
            string ftp_folder = ConfigurationManager.AppSettings["FTP_IP"] + "/" + ConfigurationManager.AppSettings["agentFtpPath"];
            int Max_Create_VM_Num = Convert.ToInt32(ConfigurationManager.AppSettings["Max_Create_VM_Num"].Trim().ToString());
            string vm_account = ConfigurationManager.AppSettings["vm_account"].Trim().ToString();
            string vm_password = ConfigurationManager.AppSettings["vm_password"].Trim().ToString();

            #region //是否有訂單需要刪除
            try//是否有訂單需要刪除
            {
                Create_VM_Service.VMAPI.GCCA_HypervisorAPI vmapi = new GCCA_HypervisorAPI();
                dbManager.Open();
                string sql = "";
                Int32 nCount = 0;
                sql = @"select TOP 1 a.order_audit,a.order_vm_type,a.order_id,order_area,a.company_id,a.temp_id,b.*,c.*
                        from user_vm_order a
                        left outer join config_vm_host b on a.company_id=b.company_id and a.order_vm_type=b.vmtype left outer join order_audit c on a.order_id=c.order_id
                        where c.vm_del='1' and a.order_audit='6'
                        order by a.order_id";
                DataSet ds = dbManager.ExecuteDataSet(CommandType.Text, sql);
                nCount = ds.Tables[0].Rows.Count;
                System.IO.File.AppendAllText(@"C:\AutoProvision\logs.txt", " 是否有訂單需要刪除 : " + nCount + Environment.NewLine);

                if (nCount > 0)
                {
                    string order_id = ds.Tables[0].Rows[0]["order_id"].ToString();
                    string aa = ws.Change_Order_Status(order_id, "8", false);
                    string vmtype = ds.Tables[0].Rows[0]["order_vm_type"].ToString();
                    if (vmtype == "VMware")
                    {
                        string vcenter_url = ds.Tables[0].Rows[0]["vmware_apiurl"].ToString();
                        string vmware_host_account = ds.Tables[0].Rows[0]["vmware_host_account"].ToString();
                        string vmware_host_pwd = CryptoAES.decrypt(ds.Tables[0].Rows[0]["vmware_host_pwd"].ToString(), "[email protected]");
                        string vmware_datacenter_name = ds.Tables[0].Rows[0]["vmware_datacenter_name"].ToString();
                        string vmware_host_name = ds.Tables[0].Rows[0]["vmware_host_name"].ToString();
                        string vmware_datastore_name = ds.Tables[0].Rows[0]["vmware_datastore_name"].ToString();
                        string[] guidf0 = vmapi.init(vcenter_url, vmware_host_account, vmware_host_pwd, vmware_datacenter_name, true).Split(':');
                        string[] guidf1 = guidf0[2].Split('\'');
                        string guid = guidf1[1];

                        string VMWare_Power_off_f = vmapi.powerOffVM(guid, vmware_datacenter_name, vmware_host_name, order_id).Split(':')[1].Split(',')[0];
                        try
                        {
                            if (IsDelImg == "true" && VMWare_Power_off_f == "true")
                            {
                                vmapi.removeVM(guid, vmware_datacenter_name, vmware_host_name, order_id, vmware_datastore_name, true);
                                ws.Change_Order_Status(order_id, "7", false);
                            }
                            else if (IsDelImg == "true" && VMWare_Power_off_f == "false")
                            {
                                ws.Inset_Log(order_id, "Power Off Error");
                            }
                            else if (IsDelImg == "false" && VMWare_Power_off_f == "false")
                            {
                                ws.Inset_Log(order_id, "Power Off Error");
                            }
                            else if (IsDelImg == "false" && VMWare_Power_off_f == "true")
                            {
                                ws.Change_Order_Status(order_id, "7", false);
                            }
                            System.IO.File.AppendAllText(@"C:\AutoProvision\logs.txt", " delete order is : " + order_id + Environment.NewLine);

                        }
                        catch (Exception ex)
                        {
                            dbManager.Dispose();
                            ws.Dispose();
                            ws.Inset_Log(order_id, ex.Message);
                            System.IO.File.AppendAllText(@"C:\AutoProvision\logs.txt", " delete order tppe is VMware,and fail order_id is : " + order_id + Environment.NewLine);

                        }
                    }
                    else if (vmtype == "KVM")
                    {
                        string kvm_hostname = ds.Tables[0].Rows[0]["kvm_hostname"].ToString();
                        string kvm_dsname = ds.Tables[0].Rows[0]["kvm_dsname"].ToString();
                        string kvm_account = ds.Tables[0].Rows[0]["kvm_account"].ToString();
                        string kvm_pwd = CryptoAES.decrypt(ds.Tables[0].Rows[0]["kvm_pwd"].ToString(), "[email protected]");
                        string[] guidf0 = vmapi.init(kvm_hostname, kvm_dsname, kvm_account, kvm_pwd).Split(':');
                        string[] guidf1 = guidf0[2].Split('\'');
                        string guid = guidf1[1];
                        string VMWare_Power_off_f = vmapi.powerOffVM(guid, "", kvm_hostname, order_id).Split(':')[1].Split(',')[0];
                        try
                        {
                            if (IsDelImg == "true" && VMWare_Power_off_f == "true")
//.........这里部分代码省略.........
开发者ID:jedi0605,项目名称:GitTeach,代码行数:101,代码来源:Program.cs

示例2: a

        //test area
        static void a()
        {
            DBManager dbManager = new DBManager(DataProvider.SqlServer);
            dbManager.ConnectionString = ConfigurationManager.AppSettings["SSM"].ToString();

            dbManager.Open();
            dbManager.CreateParameters(4);
            dbManager.AddParameters(0, "@order_area", "TP");
            dbManager.AddParameters(1, "@company_id", "GCCA");
            dbManager.AddParameters(2, "@vmtype", "VMware");
            dbManager.AddParameters(3, "@temp_id", "Temp_20130606_001");
            string sql = @"SELECT vmware_apiurl,vmware_datacenter_name,vmware_datastore_name,vmware_host_account,vmware_host_name,vmware_host_pwd,b.hostname as create_on_hostname,resource_pool_name,b.datacenter_name as create_on_datacentername,b.temp_id
                    FROM config_vm_host a left outer join vm_temp b on a.vmtype=b.vm_type
                    WHERE [email protected]_area and [email protected]_id and [email protected] and [email protected]_id";
            DataSet ds = dbManager.ExecuteDataSet(CommandType.Text, sql);
            int nCount = ds.Tables[0].Rows.Count;
            string vmware_apiurl = ds.Tables[0].Rows[0]["vmware_apiurl"].ToString();
            string vmware_vcenter_ip = vmware_apiurl.Split('/')[2];
            //vmware_datacenter_name = ds.Tables[0].Rows[0]["vmware_datacenter_name"].ToString();
            //vmware_datastore_name = ds.Tables[0].Rows[0]["vmware_datastore_name"].ToString();
            //vmware_host_account = ds.Tables[0].Rows[0]["vmware_host_account"].ToString();
            //vmware_host_name = ds.Tables[0].Rows[0]["vmware_host_name"].ToString();
            //vmware_host_pwd = CryptoAES.decrypt(ds.Tables[0].Rows[0]["vmware_host_pwd"].ToString(), "[email protected]");
            //vmware_host_encryp_pwd = ds.Tables[0].Rows[0]["vmware_host_pwd"].ToString();
            //create_on_hostname = ds.Tables[0].Rows[0]["create_on_hostname"].ToString();
            //create_on_datacentername = ds.Tables[0].Rows[0]["create_on_datacentername"].ToString();
            //resource_pool_name = Convert.ToString(ds.Tables[0].Rows[0]["resource_pool_name"]);
            dbManager.Dispose();
            Create_VM_Service.VMAPI.GCCA_HypervisorAPI vmapi = new GCCA_HypervisorAPI();
            //string[] guidf0 = vmapi.init(vmware_apiurl, "administrator", "Passw0rd", "GCCA_8F_Lab", true).Split(':'); //連線至VMWARE HOST
            //string[] guidf1 = guidf0[2].Split('\'');
            //string guid = guidf1[1];//取得GUID
            string vm_network_name = vmapi.getVMNICNetworkList("f048f491-05c1-44aa-9aff-55e4129b4c1d", "GCCA_8F_Lab", "172.16.10.45", "20130606_006");
            return;
        }
开发者ID:jedi0605,项目名称:GitTeach,代码行数:36,代码来源:Program.cs


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