示例#1
0
        public static EArm AccessSelectByCodeForConvertor(int Code, OleDbTransaction _transaction, OleDbConnection _connection)
        {
            OleDbConnection connection = _connection;
            OleDbCommand    command    = new OleDbCommand("E_Arm_Select", connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _transaction;
            //connection.Open();
            command.Parameters.Add(new OleDbParameter("iCode", Code));
            OleDbDataReader reader = command.ExecuteReader();
            EArm            _eArm  = new EArm();

            if (reader.Read())
            {
                _eArm.Code        = Convert.ToInt32(reader["Code"].ToString());
                _eArm.Name        = Convert.ToString(reader["Name"].ToString());
                _eArm.ProductCode = Convert.ToInt32(reader["ProductCode"].ToString());
                _eArm.XCode       = new Guid(reader["XCode"].ToString());
            }
            else
            {
                _eArm.Code = -1;
            }

            reader.Close();
            //connection.Close();
            return(_eArm);
        }
示例#2
0
        public static EArm SelectByCodeForLocal(int Code, SqlTransaction LocalTransaction, SqlConnection LocalConnection)
        {
            SqlConnection connection = LocalConnection;
            SqlCommand    command    = new SqlCommand("E_Arm_Select", connection);

            command.CommandType = CommandType.StoredProcedure;

            SqlTransaction trans = LocalTransaction;

            command.Parameters.Add(new SqlParameter("iCode", Code));
            EArm arm = new EArm();

            try
            {
                command.Transaction = trans;
                SqlDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    arm.Code = Convert.ToInt16(reader["Code"].ToString());

                    arm.Name        = reader["Name"].ToString();
                    arm.ProductCode = Convert.ToInt32(reader["ProductCode"].ToString());
                    arm.XCode       = new Guid(reader["XCode"].ToString());
                    arm.IsDefault   = Convert.ToBoolean(reader["IsDefault"].ToString());
                }
                else
                {
                    arm.Code = -1;
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage("Error In EArm.SelectByXCodeForDesign.TransAction:{0}\n", ex.Message);
            }

            return(arm);
        }
示例#3
0
        //SentFromLocalToAccess
        public static EArm AccessSelectByXCode(Guid XCode)
        {
            OleDbConnection Connection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
            OleDbCommand    command    = new OleDbCommand("E_Arm_SelectByXCode", Connection);
            Editor          ed         = Application.DocumentManager.MdiActiveDocument.Editor;

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new OleDbParameter("iXCode", XCode));
            Connection.Open();
            OleDbDataReader reader = command.ExecuteReader();
            EArm            _eArm  = new EArm();

            if (reader.Read())
            {
                _eArm.Code        = Convert.ToInt32(reader["Code"].ToString());
                _eArm.Name        = reader["Name"].ToString();
                _eArm.ProductCode = Convert.ToInt32(reader["ProductCode"].ToString());
                _eArm.XCode       = new Guid(reader["XCode"].ToString());
            }
            reader.Close();
            Connection.Close();
            return(_eArm);
        }
示例#4
0
        //Ribbon->btnTransferBProduct
        public static EArm SelectByProductCode(int ProductCode)
        {
            SqlConnection connection = new SqlConnection(Atend.Control.ConnectionString.LocalcnString);
            SqlCommand    command    = new SqlCommand("E_Ramp_SelectByProductCode", connection);

            command.CommandType = CommandType.StoredProcedure;

            connection.Open();
            command.Parameters.Add(new SqlParameter("iProductCode", ProductCode));
            SqlDataReader reader = command.ExecuteReader();
            EArm          Arm    = new EArm();

            if (reader.Read())
            {
                Arm.Code = Convert.ToInt16(reader["Code"].ToString());

                Arm.Name        = reader["Name"].ToString();
                Arm.ProductCode = Convert.ToInt32(reader["ProductCode"].ToString());
                Arm.XCode       = new Guid(reader["XCode"].ToString());
                Arm.IsDefault   = Convert.ToBoolean(reader["IsDefault"].ToString());
            }
            else
            {
                Arm.Code = -1;
            }
            reader.Close();
            connection.Close();

            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage(string.Format(" Values: {0} , {1} , {2}  \n", bus.ProductCode, bus.Size, bus, bus.Type));



            return(Arm);
        }