⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syscordset.cs

📁 酒店管理软件,c#版本可以选择不同的模式
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Data;
using System.Globalization;
using System.Windows.Forms;
using System.Text;
using System.Xml;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;
using System.Data.SqlClient;

namespace Hotel.DA
{
    public class SysCordSet
    {
        public string GetCustomerList()
        {
            // DataReader that will hold the returned results		
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "Select CustomerID, Name, Address, City, Country, PostalCode " +
                "From Customers";
            DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

            StringBuilder readerData = new StringBuilder();

            // The ExecuteReader call will request the connection to be closed upon
            // the closing of the DataReader. The DataReader will be closed 
            // automatically when it is disposed.
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                // Iterate through DataReader and put results to the text box.
                // DataReaders cannot be bound to Windows Form controls (e.g. the
                // resultsDataGrid), but may be bound to Web Form controls.
                while (dataReader.Read())
                {
                    // Get the value of the 'Name' column in the DataReader
                    readerData.Append(dataReader["Name"]);
                    readerData.Append(Environment.NewLine);
                }
            }

            return readerData.ToString();
        }

 
        /// <summary>
        /// Retreives all products in the specified category.
        /// </summary>
        /// <param name="Category">The category containing the products.</param>
        /// <returns>DataSet containing the products.</returns>
        /// <remarks>Demonstrates retrieving multiple rows using a DataSet.</remarks>
        public DataSet GetProductsInCategory(int Category)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "GetProductsByCategory";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

            // DataSet that will hold the returned results		
            DataSet productsDataSet = null;

            productsDataSet = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return productsDataSet;
        }

        public Int32 AddSysCordSetInCordId(string CordId, string CordDm, string CordMemo, Boolean Check1, Boolean Check2)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "AddSysCordSetInCordId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            db.AddInParameter(dbCommand, "CordId", DbType.String, CordId);
            db.AddInParameter(dbCommand, "CordDm", DbType.String, CordDm);
            db.AddInParameter(dbCommand, "CordMemo", DbType.String, CordMemo);
            db.AddInParameter(dbCommand, "Check1", DbType.Boolean, Check1);
            db.AddInParameter(dbCommand, "Check2", DbType.Boolean, Check2);
   

            // DataSet that will hold the returned results		
            Int32 results=db.ExecuteNonQuery(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return results;
        }

        public Int32 DelSysCordSetInCordId(Int32 FlowId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "DelSysCordSetInCordId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            db.AddInParameter(dbCommand, "FlowId", DbType.Int32, FlowId);


            // DataSet that will hold the returned results		
            Int32 results = db.ExecuteNonQuery(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return results;
        }

        public Int32 AddSysCordSet(string CordId, string CordDm, string CordMemo, Boolean Check1, Boolean Check2, Int32 FlowId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "AddSysCordSet";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            db.AddInParameter(dbCommand, "CordId", DbType.String, CordId);
            db.AddInParameter(dbCommand, "FlowId", DbType.Int32, FlowId);

            // DataSet that will hold the returned results		
            Int32 results = db.ExecuteNonQuery(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return results;
        }

        public DataSet GetSysCordSetList()
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "GetSysCordSetList";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
	
            DataSet productsDataSet = null;

            productsDataSet = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return productsDataSet;
        }

        public DataSet GetSysCordSetInCordId(String cordId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase();

            string sqlCommand = "GetSysCordSetInCordId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            // Retrieve products from the specified category.
            db.AddInParameter(dbCommand, "CordId", DbType.String, cordId);

            // DataSet that will hold the returned results		
            DataSet productsDataSet = null;

            productsDataSet = db.ExecuteDataSet(dbCommand);

            // Note: connection was closed by ExecuteDataSet method call 

            return productsDataSet;
        }
        /// <summary>
        /// Updates the product database.
        /// </summary>
        /// <returns>The number of rows affected by the update.</returns>
        /// <remarks>Demonstrates updating a database using a DataSet.</remarks>
        public int UpdateSysCordSetInCordId( DataGridView DataGridViewTemp, DataGridView DataGridViewFornt)
        {
            Int32 results=0;
            
        
            string  CordDm="" ;
            string CordMemo = "";
            Boolean Check1=false;
            Boolean Check2 = false;

           // string  CordDm_Fornt="" ;
            //string CordMemo_Fornt = "";
            //Boolean Check1_Fornt=false;
            //Boolean Check2_Fornt = false;
            Int32 FlowId_Fornt = 0;

            Database db = DatabaseFactory.CreateDatabase();
            string sqlCommand = "UpdateSysCordSetInCordId";


            for (int j = 0; j < DataGridViewTemp.RowCount; j++)
            {

                CordDm = DataGridViewTemp.Rows[j].Cells[0].Value.ToString();
                CordMemo = DataGridViewTemp.Rows[j].Cells[1].Value.ToString();
               // CordDm_Fornt = DataGridViewFornt.Rows[i].Cells[0].Value.ToString();
                //CordMemo_Fornt = DataGridViewFornt.Rows[i].Cells[1].Value.ToString();
                FlowId_Fornt =System.Convert.ToInt32( DataGridViewTemp.Rows[j].Cells[4].Value);

                if (String.Equals(DataGridViewTemp.Rows[j].Cells[2].Value.ToString(), "true", StringComparison.OrdinalIgnoreCase))
                {   Check1 =true ;  }
                else
                { Check1 = false; }

                if (String.Equals(DataGridViewTemp.Rows[j].Cells[3].Value.ToString(), "true", StringComparison.OrdinalIgnoreCase))
                { Check2 = true; }
                else
                { Check2 = false; }

                //if (DataGridViewFornt.Rows[i].Cells[2].Value.ToString() == "")
                //{ Check1_Fornt = false; }
                //else
                //{ Check1_Fornt = true; }

                //if (DataGridViewFornt.Rows[i].Cells[3].Value.ToString() == "")
                //{ Check2_Fornt = false; }
                //else
                //{ Check2_Fornt = true; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -