示例#1
0
        public static BWorkOrder SelectByACode(int ACode, SqlConnection _connectionLocal)
        {
            SqlConnection Connection = _connectionLocal;
            SqlCommand    Command    = new SqlCommand("B_WorkOrder_SelectByACode", Connection);

            Command.Parameters.Add(new SqlParameter("iACode", ACode));
            Command.CommandType = CommandType.StoredProcedure;
            //Connection.Open();
            SqlDataReader reader    = Command.ExecuteReader();
            BWorkOrder    workOrder = new BWorkOrder();

            if (reader.Read())
            {
                workOrder.Code       = Convert.ToInt32(reader["Code"].ToString());
                workOrder.parentCode = Convert.ToInt32(reader["parentCode"].ToString());
                workOrder.ACode      = Convert.ToInt32(reader["ACode"].ToString());
                workOrder.Name       = reader["Name"].ToString();
            }
            else
            {
                workOrder.code = -1;
            }

            //Connection.Close();
            reader.Close();
            return(workOrder);
        }
示例#2
0
        public static BWorkOrder SelectByCode(int Code)
        {
            SqlConnection Connection = new SqlConnection(Atend.Control.ConnectionString.LocalcnString);
            SqlCommand    Command    = new SqlCommand("B_WorkOrder_Select", Connection);

            Command.Parameters.Add(new SqlParameter("iCode", Code));
            Command.CommandType = CommandType.StoredProcedure;
            Connection.Open();
            SqlDataReader reader    = Command.ExecuteReader();
            BWorkOrder    workOrder = new BWorkOrder();

            if (reader.Read())
            {
                workOrder.Code       = Convert.ToInt32(reader["Code"].ToString());
                workOrder.parentCode = Convert.ToInt32(reader["parentCode"].ToString());
                workOrder.ACode      = Convert.ToInt32(reader["ACode"].ToString());
                workOrder.Name       = reader["Name"].ToString();
            }

            Connection.Close();
            reader.Close();
            return(workOrder);
        }