示例#1
0
        public static EDBPhuse SelectByCode(SqlTransaction Transaction, SqlConnection Connection, int Code)
        {
            SqlConnection connection = Connection;// new SqlConnection(Atend.Control.ConnectionString.LocalcnString);
            SqlCommand command = new SqlCommand("E_DBPhuse_SelectByCode", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("iCode", Code));
            command.Transaction = Transaction;
            //connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            EDBPhuse sbp = new EDBPhuse();
            if (reader.Read())
            {
                sbp.Code = Convert.ToInt32(reader["Code"].ToString());
                sbp.DBXCode = new Guid(reader["DBXCode"].ToString());
                sbp.XCode = new Guid(reader["XCode"].ToString());
                sbp.FeederNum = Convert.ToInt32(reader["FeederNum"].ToString());
                sbp.Comment = reader["Comment"].ToString();
                sbp.PhuseType = Convert.ToByte(reader["PhuseType"].ToString());
                sbp.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString());

                sbp.PhuseXCode = new Guid(reader["PhuseXCode"].ToString());
            }
            else
                sbp.XCode = Guid.Empty;

            reader.Close();
            //connection.Close();

            return sbp;
        }
示例#2
0
        //MEDHAT //ShareOnServer
        public static EDBPhuse ServerSelectByCode(int Code, SqlConnection ServerConnection, SqlTransaction ServerTransaction)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            SqlConnection connection = ServerConnection;
            SqlCommand command = new SqlCommand("E_DBPhuse_SelectByCode", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("iCode", Code));
            command.Transaction = ServerTransaction;

            SqlDataReader reader = command.ExecuteReader();
            EDBPhuse sbp = new EDBPhuse();

            if (reader.Read())
            {
                sbp.Code = Convert.ToInt32(reader["Code"].ToString());
                sbp.DBCode = Convert.ToInt32(reader["DBCode"].ToString());
                sbp.XCode = new Guid(reader["XCode"].ToString());
                sbp.FeederNum = Convert.ToInt32(reader["FeederNum"].ToString());
                sbp.Comment = reader["Comment"].ToString();
                sbp.PhuseType = Convert.ToByte(reader["PhuseType"].ToString());
                sbp.IsDefault = Convert.ToBoolean(reader["IsDefault"].ToString());

                sbp.PhuseCode = Convert.ToInt32(reader["PhuseCode"].ToString());
            }
            else
            {
                sbp.Code = -1;
                ed.WriteMessage("ServerSelectByCode found no row in : db phuse\n");
            }
            reader.Close();
            return sbp;
        }
示例#3
0
        //MEDHAT
        public static EDBPhuse SelectByPhuseXCode(Guid XCode)
        {
            SqlConnection connection = new SqlConnection(Atend.Control.ConnectionString.LocalcnString);
            SqlCommand command = new SqlCommand("E_DBPhuse_SelectByPhuseXCode", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("iXCode", XCode));
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            EDBPhuse sbp = new EDBPhuse();
            if (reader.Read())
            {
                sbp.Code = Convert.ToInt32(reader["Code"].ToString());
                sbp.DBXCode = new Guid(reader["DBXCode"].ToString());
                sbp.FeederNum = Convert.ToInt32(reader["FeederNum"].ToString());
                sbp.Comment = reader["Comment"].ToString();
                sbp.PhuseType = Convert.ToByte(reader["PhuseType"].ToString());
                sbp.PhuseXCode = new Guid(reader["PhuseXCode"].ToString());
                sbp.XCode = new Guid(reader["XCode"].ToString());
            }
            else
            {
                sbp.Code = -1;
            }
            reader.Close();
            connection.Close();

            return sbp;
        }
示例#4
0
        //Hatami
        public static EDBPhuse AccessSelectByCode(int Code)
        {
            OleDbConnection connection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
            OleDbCommand command = new OleDbCommand("E_DBPhuse_SelectByCode", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new OleDbParameter("iCode", Code));
            connection.Open();
            OleDbDataReader reader = command.ExecuteReader();
            EDBPhuse sbp = new EDBPhuse();
            if (reader.Read())
            {
                sbp.Code = Convert.ToInt32(reader["Code"].ToString());
                sbp.DBCode = Convert.ToInt32(reader["DBCode"].ToString());
                sbp.FeederNum = Convert.ToInt32(reader["FeederNum"].ToString());
                sbp.Comment = reader["Comment"].ToString();
                sbp.PhuseType = Convert.ToByte(reader["PhuseType"].ToString());
                sbp.PhuseCode = Convert.ToInt32(reader["PhuseCode"].ToString());
            }
            reader.Close();
            connection.Close();

            return sbp;
        }